aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-24 20:45:45 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-24 20:45:45 +0800
commitda6333c06e51b7c4447d6d534d301c3f728679d9 (patch)
tree6bb3fe88d45e9f75bece2938f6b2396d58932e81 /lib
parent3844f2dc783a6e505e7f114bc1a747e5c040021c (diff)
downloadgsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.gz
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.tar.zst
gsoc2013-epiphany-da6333c06e51b7c4447d6d534d301c3f728679d9.zip
Do not use _ as accellerators in bookmarks menus.
2003-09-24 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-string.c: (ephy_string_double_underscores): * lib/ephy-string.h: * src/bookmarks/ephy-bookmark-action.c: (sync_bookmark_properties): * src/bookmarks/ephy-bookmarks-menu.c: (ephy_bookmarks_menu_rebuild): * src/bookmarks/ephy-topic-action.c: (create_menu_item), (sync_topic_properties): Do not use _ as accellerators in bookmarks menus.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-string.c39
-rw-r--r--lib/ephy-string.h2
2 files changed, 41 insertions, 0 deletions
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index fdadfbd17..1c4ff358d 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -156,3 +156,42 @@ ephy_string_elide_underscores (const gchar *original)
return result;
}
+
+char *
+ephy_string_double_underscores (const char *string)
+{
+ int underscores;
+ const char *p;
+ char *q;
+ char *escaped;
+
+ if (string == NULL)
+ {
+ return NULL;
+ }
+
+ underscores = 0;
+ for (p = string; *p != '\0'; p++)
+ {
+ underscores += (*p == '_');
+ }
+
+ if (underscores == 0)
+ {
+ return g_strdup (string);
+ }
+
+ escaped = g_new (char, strlen (string) + underscores + 1);
+ for (p = string, q = escaped; *p != '\0'; p++, q++)
+ {
+ /* Add an extra underscore. */
+ if (*p == '_') {
+ *q++ = '_';
+ }
+ *q = *p;
+ }
+ *q = '\0';
+
+ return escaped;
+}
+
diff --git a/lib/ephy-string.h b/lib/ephy-string.h
index a7d083457..89aa4564c 100644
--- a/lib/ephy-string.h
+++ b/lib/ephy-string.h
@@ -34,6 +34,8 @@ char *ephy_string_shorten (const gchar *str,
char *ephy_string_elide_underscores (const gchar *original);
+char *ephy_string_double_underscores (const char *string);
+
G_END_DECLS
#endif