diff options
author | Ted Gould <ted@gould.cx> | 2012-03-09 11:08:22 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-03-09 11:08:22 -0600 |
commit | a88fd2c81c268b6b9528378bb0cfc65b876a8b83 (patch) | |
tree | 9207f983aafaac4b0440d3587cb8fecbc037a34a | |
parent | 848d920a5044f02fd45660c4bb429b2dff9e5de3 (diff) | |
parent | 633cd3f92e926b587b07dbc910b513d1daacf0f5 (diff) | |
download | libdbusmenu-a88fd2c81c268b6b9528378bb0cfc65b876a8b83.tar.gz libdbusmenu-a88fd2c81c268b6b9528378bb0cfc65b876a8b83.tar.bz2 libdbusmenu-a88fd2c81c268b6b9528378bb0cfc65b876a8b83.zip |
Removing underscores in the ATK name
-rw-r--r-- | libdbusmenu-gtk/client.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 4c3f1c2..9cb1144 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -735,21 +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); - } - + 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. */ - if (setname == NULL) { - setname = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL); + 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; } |