aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-09 11:07:52 -0600
committerTed Gould <ted@gould.cx>2012-03-09 11:07:52 -0600
commit633cd3f92e926b587b07dbc910b513d1daacf0f5 (patch)
tree4988a21c5cb094811f18b25abba31974996791e8 /libdbusmenu-gtk
parent004ede5cfbcab69652857f0d25d7ddab5bfe0b23 (diff)
downloadlibdbusmenu-633cd3f92e926b587b07dbc910b513d1daacf0f5.tar.gz
libdbusmenu-633cd3f92e926b587b07dbc910b513d1daacf0f5.tar.bz2
libdbusmenu-633cd3f92e926b587b07dbc910b513d1daacf0f5.zip
Restructuring slightly to have two cases, allocating memory and not allocating
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 95d6b8b..9cb1144 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -735,27 +735,29 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant,
return;
}
- const gchar * setname = NULL;
- const gchar * label = 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) {
+ 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;
}