diff options
author | Ted Gould <ted@gould.cx> | 2010-11-09 17:01:37 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-11-09 17:01:37 -0600 |
commit | 40c2ed841e817647a7f9bf0798815bbf8279769c (patch) | |
tree | 4d261465dc41759a949822626b595019ab7fe0f7 /example | |
parent | 02e634b42f174aaf771eaed445b6ddf0b690692a (diff) | |
download | libayatana-appindicator-40c2ed841e817647a7f9bf0798815bbf8279769c.tar.gz libayatana-appindicator-40c2ed841e817647a7f9bf0798815bbf8279769c.tar.bz2 libayatana-appindicator-40c2ed841e817647a7f9bf0798815bbf8279769c.zip |
Add a menu item to use the local icon
Diffstat (limited to 'example')
-rw-r--r-- | example/simple-client.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/example/simple-client.c b/example/simple-client.c index f2fac6f..734aff6 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -60,6 +60,20 @@ activate_clicked_cb (GtkWidget *widget, gpointer data) } static void +local_icon_toggle_cb (GtkWidget *widget, gpointer data) +{ + AppIndicator * ci = APP_INDICATOR(data); + + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + app_indicator_set_icon(ci, LOCAL_ICON); + } else { + app_indicator_set_icon(ci, "indicator-messages"); + } + + return; +} + +static void item_clicked_cb (GtkWidget *widget, gpointer data) { const gchar *text = (const gchar *)data; @@ -192,6 +206,12 @@ main (int argc, char ** argv) gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show(item); + item = gtk_check_menu_item_new_with_label ("Set Local Icon"); + g_signal_connect (item, "activate", + G_CALLBACK (local_icon_toggle_cb), ci); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show(item); + app_indicator_set_menu (ci, GTK_MENU (menu)); mainloop = g_main_loop_new(NULL, FALSE); |