aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-02-12 17:17:08 +0100
committerSebastien Bacher <seb128@ubuntu.com>2010-02-12 17:17:08 +0100
commitbe1ce77e65c89fb426b0692745960c440323fd52 (patch)
tree10f02191c1e3f6b523933812a7004d6803a43bee
parent4102c4d56e73cab5b733efb9a5a28a4eaed8b81d (diff)
parentaf5ac815104f9a9ec2f0f86264441b536965f7b2 (diff)
downloadlibayatana-appindicator-be1ce77e65c89fb426b0692745960c440323fd52.tar.gz
libayatana-appindicator-be1ce77e65c89fb426b0692745960c440323fd52.tar.bz2
libayatana-appindicator-be1ce77e65c89fb426b0692745960c440323fd52.zip
releasing version 0.0.13-0ubuntu20.0.13-0ubuntu2
-rw-r--r--debian/changelog7
-rw-r--r--example/simple-client.c37
-rw-r--r--src/libappindicator/app-indicator.c23
3 files changed, 57 insertions, 10 deletions
diff --git a/debian/changelog b/debian/changelog
index 6a3bbbf..b16f347 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-application (0.0.13-0ubuntu2) lucid; urgency=low
+
+ * Backported lp:~bratsche/indicator-application/submenus to make the submenus
+ working in the application indicators (lp: #519625)
+
+ -- Sebastien Bacher <seb128@ubuntu.com> Fri, 12 Feb 2010 17:12:58 +0100
+
indicator-application (0.0.13-0ubuntu1) lucid; urgency=low
* Upstream release 0.0.13
diff --git a/example/simple-client.c b/example/simple-client.c
index f1b8d37..997a446 100644
--- a/example/simple-client.c
+++ b/example/simple-client.c
@@ -68,6 +68,34 @@ image_clicked_cb (GtkWidget *widget, gpointer data)
GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
}
+static void
+append_submenu (GtkWidget *item)
+{
+ GtkWidget *menu;
+ GtkWidget *mi;
+
+ menu = gtk_menu_new ();
+
+ mi = gtk_menu_item_new_with_label ("Sub 1");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+ g_signal_connect (mi, "activate",
+ G_CALLBACK (item_clicked_cb), "Sub 1");
+
+ mi = gtk_menu_item_new_with_label ("Sub 2");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+ g_signal_connect (mi, "activate",
+ G_CALLBACK (item_clicked_cb), "Sub 2");
+
+ mi = gtk_menu_item_new_with_label ("Sub 3");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+ g_signal_connect (mi, "activate",
+ G_CALLBACK (item_clicked_cb), "Sub 3");
+
+ gtk_widget_show_all (menu);
+
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
+}
+
int
main (int argc, char ** argv)
{
@@ -91,19 +119,18 @@ main (int argc, char ** argv)
g_signal_connect (item, "activate",
G_CALLBACK (item_clicked_cb), "1");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show(item);
+ gtk_widget_show (item);
item = gtk_radio_menu_item_new_with_label (NULL, "2");
g_signal_connect (item, "activate",
G_CALLBACK (item_clicked_cb), "2");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show(item);
+ gtk_widget_show (item);
item = gtk_menu_item_new_with_label ("3");
- g_signal_connect (item, "activate",
- G_CALLBACK (item_clicked_cb), "3");
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show(item);
+ append_submenu (item);
+ gtk_widget_show (item);
GtkWidget *toggle_item = gtk_menu_item_new_with_label ("Toggle 3");
g_signal_connect (toggle_item, "activate",
diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c
index 0ca68d4..d179df7 100644
--- a/src/libappindicator/app-indicator.c
+++ b/src/libappindicator/app-indicator.c
@@ -1133,6 +1133,7 @@ container_iterate (GtkWidget *widget,
{
DbusmenuMenuitem *root = (DbusmenuMenuitem *)data;
DbusmenuMenuitem *child;
+ GtkWidget *submenu = NULL;
const gchar *label = NULL;
gboolean label_set = FALSE;
@@ -1213,6 +1214,17 @@ container_iterate (GtkWidget *widget,
}
}
+ if (GTK_IS_MENU_ITEM (widget))
+ {
+ submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
+ if (submenu != NULL)
+ {
+ gtk_container_forall (GTK_CONTAINER (submenu),
+ container_iterate,
+ child);
+ }
+ }
+
g_signal_connect (widget, "notify",
G_CALLBACK (widget_notify_cb), child);
@@ -1235,11 +1247,12 @@ setup_dbusmenu (AppIndicator *self)
container_iterate,
root);
- if (priv->menuservice == NULL) {
- gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id);
- priv->menuservice = dbusmenu_server_new (path);
- g_free(path);
- }
+ if (priv->menuservice == NULL)
+ {
+ gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id);
+ priv->menuservice = dbusmenu_server_new (path);
+ g_free(path);
+ }
dbusmenu_server_set_root (priv->menuservice, root);