aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-02-12 15:10:40 -0600
committerCody Russell <crussell@canonical.com>2010-02-12 15:10:40 -0600
commit8b257dca7cebd4c727023a4c30daac0f8666101a (patch)
tree95d725b8d148a9291f4d4fa5946590575f23a8cb /src
parenta98fd45c6f4e19d998e55c17a61c8860e6834049 (diff)
downloadayatana-indicator-application-8b257dca7cebd4c727023a4c30daac0f8666101a.tar.gz
ayatana-indicator-application-8b257dca7cebd4c727023a4c30daac0f8666101a.tar.bz2
ayatana-indicator-application-8b257dca7cebd4c727023a4c30daac0f8666101a.zip
Handle menuitem visibility changes, and additions/removals from menus.
Diffstat (limited to 'src')
-rw-r--r--src/libappindicator/app-indicator.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index d179df7..9a6498e 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -1125,6 +1125,12 @@ widget_notify_cb (GtkWidget *widget,
DBUSMENU_MENUITEM_PROP_LABEL,
gtk_menu_item_get_label (GTK_MENU_ITEM (widget)));
}
+ else if (pspec->name == g_intern_static_string ("visible"))
+ {
+ dbusmenu_menuitem_property_set (child,
+ DBUSMENU_MENUITEM_PROP_VISIBLE,
+ gtk_widget_get_visible (widget));
+ }
}
static void
@@ -1259,14 +1265,22 @@ setup_dbusmenu (AppIndicator *self)
return;
}
+static void
+client_menu_changed (GtkWidget *widget,
+ GtkWidget *child,
+ AppIndicator *indicator)
+{
+ setup_dbusmenu (indicator);
+}
+
/**
app_indicator_set_menu:
@self: The #AppIndicator
@menu: A #GtkMenu to set
- Sets the menu that should be shown when the Application Indicator
- is clicked on in the panel. An application indicator will not
- be rendered unless it has a menu.
+ Sets the menu that should be shown when the Application Indicator
+ is clicked on in the panel. An application indicator will not
+ be rendered unless it has a menu.
**/
void
app_indicator_set_menu (AppIndicator *self, GtkMenu *menu)
@@ -1287,6 +1301,15 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu)
priv->menu = GTK_WIDGET (menu);
g_object_ref (priv->menu);
+ g_signal_connect (menu,
+ "add",
+ G_CALLBACK (client_menu_changed),
+ self);
+ g_signal_connect (menu,
+ "remove",
+ G_CALLBACK (client_menu_changed),
+ self);
+
setup_dbusmenu (self);
check_connect (self);