aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 13:28:09 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2007-06-18 13:28:09 +0800
commit70b5e473c89cb4397ebaa365bcf39e60abce49fe (patch)
treece4ff140c2868a5e65ae2114b3e963835ec7b57c /e-util/e-util.c
parent68b50c270671de5d3e854ff949efcd66f4c2f745 (diff)
downloadgsoc2013-evolution-70b5e473c89cb4397ebaa365bcf39e60abce49fe.tar.gz
gsoc2013-evolution-70b5e473c89cb4397ebaa365bcf39e60abce49fe.tar.zst
gsoc2013-evolution-70b5e473c89cb4397ebaa365bcf39e60abce49fe.zip
Fix for bug #448223 from Gilles Dartiguelongue
svn path=/trunk/; revision=33700
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c33
1 files changed, 33 insertions, 0 deletions
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)
{