ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00052
[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 8: Merging in the sensitivity branch. It adds a property for adjusting the sensitivity of menu items.
Merge authors:
Ted Gould (ted)
Related merge proposals:
https://code.launchpad.net/~ted/dbusmenu/sensitivity/+merge/11062
proposed by: Ted Gould (ted)
review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 8 [merge]
committer: Ted Gould <ted@xxxxxxxxxxxxx>
branch nick: libdbusmenu
timestamp: Wed 2009-09-02 16:07:11 -0500
message:
Merging in the sensitivity branch. It adds a property for adjusting the sensitivity of menu items.
modified:
libdbusmenu-glib/menuitem.h
libdbusmenu-gtk/client.c
tests/test-gtk-label.json
--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription.
=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h 2009-08-26 20:18:50 +0000
+++ libdbusmenu-glib/menuitem.h 2009-09-02 14:48:52 +0000
@@ -51,6 +51,7 @@
#define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM))
#define DBUSMENU_MENUITEM_PROP_VISIBLE "visible"
+#define DBUSMENU_MENUITEM_PROP_SENSITIVE "sensitive"
#define DBUSMENU_MENUITEM_PROP_LABEL "label"
#define DBUSMENU_MENUITEM_PROP_ICON "icon"
#define DBUSMENU_MENUITEM_PROP_ICON_DATA "icon-data"
=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c 2009-08-27 13:45:49 +0000
+++ libdbusmenu-gtk/client.c 2009-09-02 14:48:52 +0000
@@ -48,6 +48,9 @@
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 @@
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 @@
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 @@
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));
=== modified file 'tests/test-gtk-label.json'
--- tests/test-gtk-label.json 2009-08-26 20:32:37 +0000
+++ tests/test-gtk-label.json 2009-09-02 14:56:21 +0000
@@ -49,6 +49,52 @@
"label": "value29"}
]
},
+ {"id": 4, "type": "menuitem",
+ "label": "value4",
+ "submenu": [
+ {"id": 40,
+ "type": "menuitem",
+ "sensitive": "true",
+ "label": "value40"},
+ {"id": 41,
+ "type": "menuitem",
+ "sensitive": "false",
+ "label": "value41"},
+ {"id": 42,
+ "type": "menuitem",
+ "sensitive": "true",
+ "label": "value42"},
+ {"id": 43,
+ "type": "menuitem",
+ "sensitive": "false",
+ "label": "value43"},
+ {"id": 44,
+ "type": "menuitem",
+ "sensitive": "true",
+ "label": "value44"},
+ {"id": 45,
+ "type": "menuitem",
+ "sensitive": "false",
+ "label": "value45"},
+ {"id": 46,
+ "type": "menuitem",
+ "sensitive": "true",
+ "label": "value46"},
+ {"id": 47,
+ "type": "menuitem",
+ "sensitive": "false",
+ "label": "value47"},
+ {"id": 48,
+ "type": "menuitem",
+ "sensitive": "true",
+ "label": "value48"},
+ {"id": 49,
+ "type": "menuitem",
+ "visible": "false",
+ "sensitive": "false",
+ "label": "value49"}
+ ]
+ },
{"id": 3, "type": "menuitem",
"label": "a super long label that is really of unreasonable length but we should make sure it makes it across the bus",
"not.a.value": "A useless value",