diff options
author | Ted Gould <ted@gould.cx> | 2012-03-09 14:25:35 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-03-09 14:25:35 -0600 |
commit | 5f817c2496b1384ef731fec619fe23103c9e8abf (patch) | |
tree | 7e9c1f1271086e6dc2f571ca343d065d0d375fb5 /libdbusmenu-gtk/client.c | |
parent | 466446b76e6f4512ea3eb2ab9d78d0615569eeac (diff) | |
parent | 890165c74783d1771e0a391987630481885cbe4a (diff) | |
download | libdbusmenu-5f817c2496b1384ef731fec619fe23103c9e8abf.tar.gz libdbusmenu-5f817c2496b1384ef731fec619fe23103c9e8abf.tar.bz2 libdbusmenu-5f817c2496b1384ef731fec619fe23103c9e8abf.zip |
* New upstream release.
* Fixing setting name of ATK objects
* Cleaning up a warning on shutdown (LP: #950762)
Diffstat (limited to 'libdbusmenu-gtk/client.c')
-rw-r--r-- | libdbusmenu-gtk/client.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 830356a..9cb1144 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -735,17 +735,29 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, return; } - const gchar * setname = NULL; if (variant != NULL) { - setname = g_variant_get_string(variant, NULL); - } - - if (setname == NULL) { - setname = ""; + const gchar * setname = NULL; + setname = g_variant_dup_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); + + atk_object_set_name(aobj, setname); + g_free(setname); } - atk_object_set_name(aobj, setname); return; } |