From 13ca9a89915c4a06806d5f46bf304e2952848bd2 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 17 Feb 2012 15:01:53 +1100 Subject: Do not set the accessible name to an empty string if the accessible_desc property = NULL. Yes this was recently changed so that dbusmenu conformed to Atk documentation, but the GTK menu item accessibility code does not yet conform to sed documentation. As a result, all dbusmenu menu items that do not have the accessible_desc property set end up getting an empty string for their accessible name. In the long term, GTK accessibility needs to be fixed. --- libdbusmenu-gtk/client.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 830356a..1883eea 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -741,10 +741,6 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, setname = g_variant_get_string(variant, NULL); } - if (setname == NULL) { - setname = ""; - } - atk_object_set_name(aobj, setname); return; } -- cgit v1.2.3 From 6d953d231b4d974d1c79e604e88b55c13499433d Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Thu, 8 Mar 2012 16:15:06 +1100 Subject: Set the accessible name from the dbusmenu item label. THis is a work-around until GTK follows atk docs. --- libdbusmenu-gtk/client.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 1883eea..4c3f1c2 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -741,6 +741,14 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, setname = g_variant_get_string(variant, NULL); } + /* 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); + } + atk_object_set_name(aobj, setname); return; } -- cgit v1.2.3 From 004ede5cfbcab69652857f0d25d7ddab5bfe0b23 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 9 Mar 2012 11:30:43 +1100 Subject: Remove the underscores used for mnewmonics, as orca speaks them, which is not what we want. --- libdbusmenu-gtk/client.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 4c3f1c2..95d6b8b 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -736,6 +736,7 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, } const gchar * setname = NULL; + const gchar * label = NULL; if (variant != NULL) { setname = g_variant_get_string(variant, NULL); @@ -746,7 +747,12 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, * causes tests to fail. */ if (setname == NULL) { - setname = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL); + /* 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); -- cgit v1.2.3 From 633cd3f92e926b587b07dbc910b513d1daacf0f5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Mar 2012 11:07:52 -0600 Subject: Restructuring slightly to have two cases, allocating memory and not allocating --- libdbusmenu-gtk/client.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'libdbusmenu-gtk/client.c') 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; } -- cgit v1.2.3 From 0386a8f6273e5bca12af38402148ccb45194119d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 20 Mar 2012 22:53:24 -0500 Subject: Handle the case of the label being NULL which can happen on custom items --- libdbusmenu-gtk/client.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 9cb1144..31b01d5 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -745,17 +745,20 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant, * 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; -- cgit v1.2.3 From 24647064d5447a63987713844d6e59ee7f980be7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 20 Mar 2012 22:53:52 -0500 Subject: Fix string leak --- libdbusmenu-gtk/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 31b01d5..f507a56 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -738,7 +738,7 @@ 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 -- cgit v1.2.3 From 1dedf32ffdfd3ac56fb2ed46ddfc1e7be44eaf80 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 27 Mar 2012 14:23:09 -0700 Subject: fold client's two DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED signal handlers together for clarity --- libdbusmenu-gtk/client.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'libdbusmenu-gtk/client.c') diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index f507a56..60af93f 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -787,22 +787,13 @@ menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * variant, Db process_disposition(mi, gmi, variant, gtkclient); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC)) { process_a11y_desc(mi, gmi, variant, gtkclient); + } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_SHORTCUT)) { + refresh_shortcut(gtkclient, mi); } return; } -/* Special handler for the shortcut changing as we need to have the - client for that one to get the accel group. */ -static void -menu_shortcut_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * value, DbusmenuGtkClient * client) -{ - if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_SHORTCUT)) { - refresh_shortcut(client, mi); - } - return; -} - /* The new menuitem signal only happens if we don't have a type handler for the type of the item. This should be an error condition and we're printing out a message. */ @@ -918,7 +909,6 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * /* DbusmenuMenuitem signals */ g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_prop_change_cb), client); - g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menu_shortcut_change_cb), client); g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(delete_child), client); g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(move_child), client); -- cgit v1.2.3