diff options
author | Ted Gould <ted@gould.cx> | 2012-06-13 14:27:08 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-06-13 14:27:08 -0500 |
commit | e3950826c9eae772094139ae3abd6a966d6b39e0 (patch) | |
tree | 853d23921340babcf66baba411fdebe16ef5f95a | |
parent | b30eb6635cdc00589e85b2867ce056d33dee8451 (diff) | |
parent | 4e49daa82ca948228a7cef9fb552f703d0c80757 (diff) | |
download | libdbusmenu-e3950826c9eae772094139ae3abd6a966d6b39e0.tar.gz libdbusmenu-e3950826c9eae772094139ae3abd6a966d6b39e0.tar.bz2 libdbusmenu-e3950826c9eae772094139ae3abd6a966d6b39e0.zip |
Merging in Ubuntu Desktop
-rw-r--r-- | debian/changelog | 22 | ||||
-rw-r--r-- | libdbusmenu-gtk/genericmenuitem.c | 32 |
2 files changed, 50 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog index 943ea59..e54dc38 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,17 @@ -libdbusmenu (0.6.1-0ubuntu1~ppa1) precise; urgency=low +libdbusmenu (0.6.1-0ubuntu3) precise-proposed; urgency=low + + * Backport fix for keybindings not showing in menus bug (lp: #982656) + + -- Sebastien Bacher <seb128@ubuntu.com> Mon, 16 Apr 2012 21:28:05 +0200 + +libdbusmenu (0.6.1-0ubuntu2) precise; urgency=low + + * libdbusmenu-gtk/genericmenuitem.c + - Fixed duplicated underscores in menus (LP: #979301) + + -- Ken VanDine <ken.vandine@canonical.com> Thu, 12 Apr 2012 12:42:47 -0400 + +libdbusmenu (0.6.1-0ubuntu1) precise; urgency=low * New upstream release. * Fix mnemonics in wifi hotspot names. (LP: #903200) @@ -9,6 +22,13 @@ libdbusmenu (0.6.1-0ubuntu1~ppa1) precise; urgency=low -- Charles Kerr <charles.kerr@canonical.com> Wed, 11 Apr 2012 11:58:22 -0500 +libdbusmenu (0.5.99-0ubuntu3) precise; urgency=low + + * libdbusmenu-gtk/parser.c + - switch the smoke test to a g_debug statement (LP: #977803) + + -- Ken VanDine <ken.vandine@canonical.com> Tue, 10 Apr 2012 13:21:02 -0400 + libdbusmenu (0.5.99-0ubuntu2) precise; urgency=low * libdbusmenu-glib/server.c diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 9effd82..4125828 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -241,6 +241,27 @@ has_mnemonic (const gchar * string, gboolean previous_underscore) return FALSE; } +/* Sanitize the label by removing "__" meaning "_" */ +G_INLINE_FUNC gchar * +sanitize_label (const gchar * in_label) +{ + static GRegex * underscore_regex = NULL; + + g_return_val_if_fail(in_label != NULL, NULL); + + if (underscore_regex == NULL) { + underscore_regex = g_regex_new("__", 0, 0, NULL); + } + + return g_regex_replace_literal(underscore_regex, + in_label, + -1, /* length */ + 0, /* start */ + "_", /* replacement */ + 0, /* flags */ + NULL); /* error */ +} + /* Set the label on the item */ static void set_label (GtkMenuItem * menu_item, const gchar * in_label) @@ -314,11 +335,15 @@ set_label (GtkMenuItem * menu_item, const gchar * in_label) labelw = GTK_LABEL(gtk_accel_label_new(local_label)); gtk_label_set_use_markup(GTK_LABEL(labelw), TRUE); gtk_misc_set_alignment(GTK_MISC(labelw), 0.0, 0.5); + gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(labelw), GTK_WIDGET(menu_item)); if (has_mnemonic(in_label, FALSE)) { gtk_label_set_use_underline(GTK_LABEL(labelw), TRUE); - gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(labelw), GTK_WIDGET(menu_item)); gtk_label_set_markup_with_mnemonic(labelw, local_label); + } else { + gchar * sanitized = sanitize_label(local_label); + gtk_label_set_markup(labelw, sanitized); + g_free(sanitized); } gtk_widget_show(GTK_WIDGET(labelw)); @@ -340,10 +365,11 @@ set_label (GtkMenuItem * menu_item, const gchar * in_label) } else { if (has_mnemonic(in_label, FALSE)) { gtk_label_set_use_underline(GTK_LABEL(labelw), TRUE); - gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(labelw), GTK_WIDGET(menu_item)); gtk_label_set_markup_with_mnemonic(labelw, local_label); } else { - gtk_label_set_markup(labelw, local_label); + gchar * sanitized = sanitize_label(local_label); + gtk_label_set_markup(labelw, sanitized); + g_free(sanitized); } } } |