aboutsummaryrefslogtreecommitdiff
path: root/example/simple-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-12 14:49:20 -0600
committerTed Gould <ted@gould.cx>2010-02-12 14:49:20 -0600
commit5fef5a229127903de8e96132a0908d88a0f97723 (patch)
tree10f02191c1e3f6b523933812a7004d6803a43bee /example/simple-client.c
parentf7b909ce3b94c2afb8e8b8a31b63f579c8bcb92e (diff)
parentbe1ce77e65c89fb426b0692745960c440323fd52 (diff)
downloadayatana-indicator-application-5fef5a229127903de8e96132a0908d88a0f97723.tar.gz
ayatana-indicator-application-5fef5a229127903de8e96132a0908d88a0f97723.tar.bz2
ayatana-indicator-application-5fef5a229127903de8e96132a0908d88a0f97723.zip
Updating to Ubuntu Desktop
Diffstat (limited to 'example/simple-client.c')
-rw-r--r--example/simple-client.c37
1 files changed, 32 insertions, 5 deletions
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",