diff options
author | Ted Gould <ted@canonical.com> | 2009-09-02 09:48:52 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-09-02 09:48:52 -0500 |
commit | 309891ed2caf92e93934276fa91d0b16c7f9f557 (patch) | |
tree | b8df46930085e71327e92b1840972f43072a2e09 /libdbusmenu-gtk | |
parent | d3b9f1d9459e1476f305b9268b9280cf6bb0a25c (diff) | |
download | libdbusmenu-309891ed2caf92e93934276fa91d0b16c7f9f557.tar.gz libdbusmenu-309891ed2caf92e93934276fa91d0b16c7f9f557.tar.bz2 libdbusmenu-309891ed2caf92e93934276fa91d0b16c7f9f557.zip |
Basic support for the sensitive property.
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r-- | libdbusmenu-gtk/client.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 7271c37..b3d55d9 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -48,6 +48,9 @@ static gboolean new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuite static gboolean new_item_seperator (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_item_image (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); +static void process_visible (GtkMenuItem * gmi, const gchar * value); +static void process_sensitive (GtkMenuItem * gmi, const gchar * value); + /* GObject Stuff */ G_DEFINE_TYPE (DbusmenuGtkClient, dbusmenu_gtkclient, DBUSMENU_TYPE_CLIENT); @@ -116,6 +119,18 @@ process_visible (GtkMenuItem * gmi, const gchar * value) return; } +/* Process the sensitive property */ +static void +process_sensitive (GtkMenuItem * gmi, const gchar * value) +{ + if (value == NULL || !g_strcmp0(value, "true")) { + gtk_widget_set_sensitive(GTK_WIDGET(gmi), TRUE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(gmi), FALSE); + } + return; +} + /* Whenever we have a property change on a DbusmenuMenuitem we need to be responsive to that. */ static void @@ -125,6 +140,8 @@ menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, gchar * value, GtkMenu gtk_menu_item_set_label(gmi, value); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) { process_visible(gmi, value); + } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_SENSITIVE)) { + process_sensitive(gmi, value); } return; @@ -171,6 +188,7 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * g_object_weak_ref(G_OBJECT(item), destoryed_dbusmenuitem_cb, gmi); process_visible(gmi, dbusmenu_menuitem_property_get(item, DBUSMENU_MENUITEM_PROP_VISIBLE)); + process_sensitive(gmi, dbusmenu_menuitem_property_get(item, DBUSMENU_MENUITEM_PROP_SENSITIVE)); if (parent != NULL) { new_child(parent, item, dbusmenu_menuitem_get_position(item, parent), DBUSMENU_GTKCLIENT(client)); |