aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/parser.c
diff options
context:
space:
mode:
authorChris Coulson <chrisccoulson@ubuntu.com>2011-03-30 13:31:33 +0100
committerChris Coulson <chrisccoulson@ubuntu.com>2011-03-30 13:31:33 +0100
commitf4bfda45834ee6f3983be3e3d7fd9c0e8fb7512e (patch)
treeb4906604b1c23162f5cf2ba5bb5aac256fb518ee /libdbusmenu-gtk/parser.c
parentccf2e684c6a2f8115dbe9544f43412986acaee79 (diff)
downloadlibdbusmenu-f4bfda45834ee6f3983be3e3d7fd9c0e8fb7512e.tar.gz
libdbusmenu-f4bfda45834ee6f3983be3e3d7fd9c0e8fb7512e.tar.bz2
libdbusmenu-f4bfda45834ee6f3983be3e3d7fd9c0e8fb7512e.zip
Remove the now unneeded null pointer check on label in construct_dbusmenu_for_widget.
Also, don't use a strcmp in widget_notify_cb for checking if the menuitem is a separator. Just do a null pointer check on pdata->label instead
Diffstat (limited to 'libdbusmenu-gtk/parser.c')
-rw-r--r--libdbusmenu-gtk/parser.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 9fc8f53..fc9a3fe 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -512,21 +512,18 @@ construct_dbusmenu_for_widget (GtkWidget * widget)
GtkWidget *label = find_menu_label (widget);
- if (label)
- {
- // Sometimes, an app will directly find and modify the label
- // (like empathy), so watch the label especially for that.
- gchar * text = sanitize_label (GTK_LABEL (label));
- dbusmenu_menuitem_property_set (mi, "label", text);
- g_free (text);
-
- pdata->label = label;
- g_signal_connect (G_OBJECT (label),
- "notify",
- G_CALLBACK (label_notify_cb),
- mi);
- g_object_add_weak_pointer(G_OBJECT (label), (gpointer*)&pdata->label);
- }
+ // Sometimes, an app will directly find and modify the label
+ // (like empathy), so watch the label especially for that.
+ gchar * text = sanitize_label (GTK_LABEL (label));
+ dbusmenu_menuitem_property_set (mi, "label", text);
+ g_free (text);
+
+ pdata->label = label;
+ g_signal_connect (G_OBJECT (label),
+ "notify",
+ G_CALLBACK (label_notify_cb),
+ mi);
+ g_object_add_weak_pointer(G_OBJECT (label), (gpointer*)&pdata->label);
if (GTK_IS_ACTIVATABLE (widget))
{
@@ -891,7 +888,8 @@ widget_notify_cb (GtkWidget *widget,
}
else if (pspec->name == g_intern_static_string ("label"))
{
- if (!g_strcmp0 (dbusmenu_menuitem_property_get (child, DBUSMENU_MENUITEM_PROP_TYPE), "separator"))
+ ParserData *pdata = g_object_get_data (G_OBJECT (widget), PARSER_DATA);
+ if (!pdata->label)
{
/* GtkMenuItem's can start life as a separator if they have no child
* GtkLabel. In this case, we need to convert the DbusmenuMenuitem from
@@ -902,7 +900,6 @@ widget_notify_cb (GtkWidget *widget,
g_return_if_fail (label != NULL);
dbusmenu_menuitem_property_remove (child, DBUSMENU_MENUITEM_PROP_TYPE);
- ParserData *pdata = g_object_get_data (G_OBJECT (widget), PARSER_DATA);
pdata->label = label;
g_signal_connect (G_OBJECT (label),
"notify",