aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-search-bar.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-05-21 04:45:35 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-05-21 04:45:35 +0800
commit888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7 (patch)
tree3b07d927d2745c54cd88cc1c5754632073317c93 /widgets/misc/e-search-bar.c
parentf91f431dc4796be98f06abd2ecfad5c23212d717 (diff)
downloadgsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar.gz
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar.bz2
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar.lz
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar.xz
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.tar.zst
gsoc2013-evolution-888c7ceeb83ae8a9a1cc6e3f15c27c9e1b369ac7.zip
Strip underscores from the menu item labels.
* e-search-bar.c (activate_by_subitems): Strip underscores from the menu item labels. svn path=/trunk/; revision=16952
Diffstat (limited to 'widgets/misc/e-search-bar.c')
-rw-r--r--widgets/misc/e-search-bar.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index cbf7984f05..71848b9c3c 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -261,6 +261,32 @@ subitem_activated_cb (GtkWidget *widget, ESearchBar *esb)
emit_search_activated (esb);
}
+static char *
+string_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;
+}
+
static void
activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems)
{
@@ -339,11 +365,13 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
char *str;
if (subitems[i].translate)
- str = _(subitems[i].text);
+ str = string_without_underscores (_(subitems[i].text));
else
- str = subitems[i].text;
+ str = string_without_underscores (subitems[i].text);
menu_item = gtk_menu_item_new_with_label (str);
+
+ g_free (str);
} else {
menu_item = gtk_menu_item_new ();
gtk_widget_set_sensitive (menu_item, FALSE);
@@ -564,12 +592,16 @@ set_option (ESearchBar *esb, ESearchBarItem *items)
if (items[i].text) {
char *str;
- str = _(items[i].text);
- if (str == items[i].text) {
+
+ str = string_without_underscores (_(items[i].text));
+ if (_(items[i].text) == items[i].text) {
/* It may be english string, or utf8 rule name */
item = e_utf8_gtk_menu_item_new_with_label (GTK_MENU (menu), str);
- } else
+ } else {
item = gtk_menu_item_new_with_label (str);
+ }
+
+ g_free (str);
} else {
item = gtk_menu_item_new ();
gtk_widget_set_sensitive (item, FALSE);