Merge lp:~ted/libdbusmenu/regex_merge into lp:libdbusmenu/0.6

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 389
Merge reported by: Charles Kerr
Merged at revision: not available
Proposed branch: lp:~ted/libdbusmenu/regex_merge
Merge into: lp:libdbusmenu/0.6
Diff against target: 40 lines (+12/-9)
1 file modified
libdbusmenu-gtk/client.c (+12/-9)
To merge this branch: bzr merge lp:~ted/libdbusmenu/regex_merge
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+98572@code.launchpad.net

Description of the change

Quick fixero for a warning that comes up a lot with unity-panel-service about not having a label. It comes from custom items. This fixes it.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbusmenu-gtk/client.c'
2--- libdbusmenu-gtk/client.c 2012-03-09 17:07:52 +0000
3+++ libdbusmenu-gtk/client.c 2012-03-21 04:00:26 +0000
4@@ -738,24 +738,27 @@
5
6 if (variant != NULL) {
7 const gchar * setname = NULL;
8- setname = g_variant_dup_string(variant, NULL);
9+ setname = g_variant_get_string(variant, NULL);
10 atk_object_set_name(aobj, setname);
11 } else {
12 /* The atk docs advise to set the name of the atk object to an empty
13 * string, but GTK doesn't yet do the same, and setting the name to NULL
14 * causes tests to fail.
15 */
16- gchar * setname = NULL;
17 const gchar * label = NULL;
18- /* We don't want the underscore for mnewmonics */
19 label = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL);
20
21- GRegex * regex = g_regex_new ("_", 0, 0, NULL);
22- setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
23- g_regex_unref(regex);
24-
25- atk_object_set_name(aobj, setname);
26- g_free(setname);
27+ if (label != NULL) {
28+ gchar * setname = NULL;
29+
30+ /* We don't want the underscore for mnewmonics */
31+ GRegex * regex = g_regex_new ("_", 0, 0, NULL);
32+ setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
33+ g_regex_unref(regex);
34+
35+ atk_object_set_name(aobj, setname);
36+ g_free(setname);
37+ }
38 }
39
40 return;

Subscribers

People subscribed via source and target branches

to all changes: