aboutsummaryrefslogtreecommitdiff
path: root/src/libappindicator
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-01-07 13:34:11 -0600
committerTed Gould <ted@gould.cx>2010-01-07 13:34:11 -0600
commite76d63c3cfdcbb39419499681e9d58448c693c92 (patch)
tree56b4373bdb70453fa8f85e67dd74f47282687b87 /src/libappindicator
parentdd2ed951b8aeb16671bebd2ea104953252ab54a5 (diff)
parenta60f25e5ca657a7c781bed90fd67020c7caa2320 (diff)
downloadlibayatana-appindicator-e76d63c3cfdcbb39419499681e9d58448c693c92.tar.gz
libayatana-appindicator-e76d63c3cfdcbb39419499681e9d58448c693c92.tar.bz2
libayatana-appindicator-e76d63c3cfdcbb39419499681e9d58448c693c92.zip
Support for check items in the libappindicator menu parser.
Diffstat (limited to 'src/libappindicator')
-rw-r--r--src/libappindicator/app-indicator.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index bb68cb2..ec598db 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -660,6 +660,14 @@ activate_menuitem (DbusmenuMenuitem *mi, gpointer user_data)
}
static void
+widget_toggled (GtkWidget *widget, DbusmenuMenuitem *mi)
+{
+ dbusmenu_menuitem_property_set (mi,
+ DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED,
+ gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED);
+}
+
+static void
menuitem_iterate (GtkWidget *widget,
gpointer data)
{
@@ -692,9 +700,33 @@ container_iterate (GtkWidget *widget,
}
else
{
- label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget));
+ if (GTK_IS_CHECK_MENU_ITEM (widget))
+ {
+ GtkCheckMenuItem *check;
+
+ check = GTK_CHECK_MENU_ITEM (widget);
+ label = gtk_menu_item_get_label (GTK_MENU_ITEM (widget));
+
+ dbusmenu_menuitem_property_set (child,
+ DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE,
+ GTK_IS_RADIO_MENU_ITEM (widget) ? DBUSMENU_MENUITEM_TOGGLE_RADIO : DBUSMENU_MENUITEM_TOGGLE_CHECK);
- if (GTK_IS_IMAGE_MENU_ITEM (widget))
+ dbusmenu_menuitem_property_set (child,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ label);
+
+ label_set = TRUE;
+
+ dbusmenu_menuitem_property_set (child,
+ DBUSMENU_MENUITEM_PROP_TOGGLE_CHECKED,
+ gtk_check_menu_item_get_active (check) ? DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED : DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED);
+
+ g_signal_connect (widget,
+ "toggled",
+ G_CALLBACK (widget_toggled),
+ child);
+ }
+ else if (GTK_IS_IMAGE_MENU_ITEM (widget))
{
GtkWidget *image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (widget));