~ubuntu-branches/debian/lenny/evolution/lenny

« back to all changes in this revision

Viewing changes to e-util/e-util.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-06-19 10:52:49 UTC
  • Revision ID: james.westby@ubuntu.com-20070619105249-g8exw8g89lmp94b6
Tags: upstream-2.11.4
ImportĀ upstreamĀ versionĀ 2.11.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include "e-util.h"
50
50
#include "e-util-private.h"
51
51
 
 
52
/**
 
53
 * e_str_without_underscores:
 
54
 * @s: the string to strip underscores from.
 
55
 *
 
56
 * Strips underscores from a string in the same way @gtk_label_new_with_mnemonis does.
 
57
 * The returned string should be freed.
 
58
 */
 
59
char *
 
60
e_str_without_underscores (const char *s)
 
61
{
 
62
        char *new_string;
 
63
        const char *sp;
 
64
        char *dp;
 
65
        
 
66
        new_string = g_malloc (strlen (s) + 1);
 
67
        
 
68
        dp = new_string;
 
69
        for (sp = s; *sp != '\0'; sp ++) {
 
70
                if (*sp != '_') {
 
71
                        *dp = *sp;
 
72
                        dp ++;
 
73
                } else if (sp[1] == '_') {
 
74
                        /* Translate "__" in "_".  */
 
75
                        *dp = '_';
 
76
                        dp ++;
 
77
                        sp ++;
 
78
                }
 
79
        }
 
80
        *dp = 0;
 
81
        
 
82
        return new_string;
 
83
}
 
84
 
52
85
gint
53
86
e_str_compare (gconstpointer x, gconstpointer y)
54
87
{