diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-03-20 23:44:48 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-03-20 23:44:48 -0500 |
commit | 06c5fccf713238d14d999a966b373fc832371b97 (patch) | |
tree | 69dd622967871aa6d9c57dc8bbd4d9f5afbc800b /libdbusmenu-gtk | |
parent | 4801af0799f19a2921650cb7086c46bfeaf271b1 (diff) | |
parent | 24647064d5447a63987713844d6e59ee7f980be7 (diff) | |
download | libdbusmenu-06c5fccf713238d14d999a966b373fc832371b97.tar.gz libdbusmenu-06c5fccf713238d14d999a966b373fc832371b97.tar.bz2 libdbusmenu-06c5fccf713238d14d999a966b373fc832371b97.zip |
merge lp:~ted/dbusmenu/regex_merge to fix a warning that comes up a lot with unity-panel-service about not having a label.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/client.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 9cb1144..f507a56 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -738,24 +738,27 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, if (variant != NULL) { const gchar * setname = NULL; - setname = g_variant_dup_string(variant, NULL); + setname = g_variant_get_string(variant, NULL); atk_object_set_name(aobj, setname); } else { /* The atk docs advise to set the name of the atk object to an empty * string, but GTK doesn't yet do the same, and setting the name to NULL * causes tests to fail. */ - gchar * setname = NULL; const gchar * label = NULL; - /* We don't want the underscore for mnewmonics */ label = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL); - GRegex * regex = g_regex_new ("_", 0, 0, NULL); - setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL); - g_regex_unref(regex); + if (label != NULL) { + gchar * setname = NULL; - atk_object_set_name(aobj, setname); - g_free(setname); + /* We don't want the underscore for mnewmonics */ + GRegex * regex = g_regex_new ("_", 0, 0, NULL); + setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL); + g_regex_unref(regex); + + atk_object_set_name(aobj, setname); + g_free(setname); + } } return; |