aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog7
-rw-r--r--e-util/e-util.c33
-rw-r--r--e-util/e-util.h1
3 files changed, 41 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index fc5751421a..c12d6c07e5 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-18 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #448223 from Gilles Dartiguelongue
+
+ * e-util.c: (e_str_without_underscores):
+ * e-util.h:
+
2007-06-15 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #446870
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 4cfc5988b2..716c02e8bd 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -49,6 +49,39 @@
#include "e-util.h"
#include "e-util-private.h"
+/**
+ * e_str_without_underscores:
+ * @s: the string to strip underscores from.
+ *
+ * Strips underscores from a string in the same way @gtk_label_new_with_mnemonis does.
+ * The returned string should be freed.
+ */
+char *
+e_str_without_underscores (const char *s)
+{
+ char *new_string;
+ const char *sp;
+ char *dp;
+
+ new_string = g_malloc (strlen (s) + 1);
+
+ dp = new_string;
+ for (sp = s; *sp != '\0'; sp ++) {
+ if (*sp != '_') {
+ *dp = *sp;
+ dp ++;
+ } else if (sp[1] == '_') {
+ /* Translate "__" in "_". */
+ *dp = '_';
+ dp ++;
+ sp ++;
+ }
+ }
+ *dp = 0;
+
+ return new_string;
+}
+
gint
e_str_compare (gconstpointer x, gconstpointer y)
{
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 1d4307dab4..2cbae35cb8 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -68,6 +68,7 @@ typedef enum {
E_FOCUS_END
} EFocus;
+char * e_str_without_underscores (const char *s);
gint e_str_compare (gconstpointer x,
gconstpointer y);
gint e_str_case_compare (gconstpointer x,