aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2009-12-03 23:23:01 -0600
committerCody Russell <crussell@canonical.com>2009-12-03 23:23:01 -0600
commit580f2be463c2ede353491c8ca0ea056b861aec69 (patch)
treeafd24b34125fa2efbde67c2475c22b22e7b44fdf /example
parent92a3e89c7690bda61d1548fb5c21b056be078192 (diff)
downloadlibayatana-appindicator-580f2be463c2ede353491c8ca0ea056b861aec69.tar.gz
libayatana-appindicator-580f2be463c2ede353491c8ca0ea056b861aec69.tar.bz2
libayatana-appindicator-580f2be463c2ede353491c8ca0ea056b861aec69.zip
API changes, gtk menu support
Diffstat (limited to 'example')
-rw-r--r--example/simple-client.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/example/simple-client.c b/example/simple-client.c
index 80d6d9c..ab2e24d 100644
--- a/example/simple-client.c
+++ b/example/simple-client.c
@@ -29,31 +29,32 @@ GMainLoop * mainloop = NULL;
int
main (int argc, char ** argv)
{
- g_type_init();
+ GtkWidget *menu = NULL;
+ AppIndicator *ci = NULL;
- AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, NULL));
- g_assert(ci != NULL);
+ gtk_init (&argc, &argv);
- app_indicator_set_id(ci, "example-simple-client");
- app_indicator_set_category(ci, APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
- app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE);
- app_indicator_set_icon(ci, "indicator-messages");
- app_indicator_set_attention_icon(ci, "indicator-messages-new");
+ ci = app_indicator_new ("example-simple-client",
+ "indicator-messages",
+ APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
+
+ g_assert (IS_APP_INDICATOR (ci));
+ g_assert (G_IS_OBJECT (ci));
- DbusmenuMenuitem * root = dbusmenu_menuitem_new();
+ app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE);
+ app_indicator_set_attention_icon(ci, "indicator-messages-new");
- DbusmenuMenuitem * item = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Item 1");
- dbusmenu_menuitem_child_append(root, item);
+ menu = gtk_menu_new ();
+ GtkWidget *item = gtk_menu_item_new_with_label ("1");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- item = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Item 2");
- dbusmenu_menuitem_child_append(root, item);
+ item = gtk_menu_item_new_with_label ("2");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- DbusmenuServer * menuservice = dbusmenu_server_new ("/need/a/menu/path");
- dbusmenu_server_set_root(menuservice, root);
+ item = gtk_menu_item_new_with_label ("3");
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- app_indicator_set_menu(ci, menuservice);
+ app_indicator_set_menu (ci, GTK_MENU (menu));
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);