diff options
author | Ted Gould <ted@gould.cx> | 2009-12-04 14:48:18 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-04 14:48:18 -0600 |
commit | 549868147d2bbf6e68df4134d1a1c12d29691f25 (patch) | |
tree | 79ac792d56f3bee5a4090c5d85e61647e96380cf /example | |
parent | 25d7d9956bb04408438d813cf222e3df59bd0518 (diff) | |
parent | 2906ee43d836d60912a8aa66f202a63cadc083d1 (diff) | |
download | ayatana-indicator-application-549868147d2bbf6e68df4134d1a1c12d29691f25.tar.gz ayatana-indicator-application-549868147d2bbf6e68df4134d1a1c12d29691f25.tar.bz2 ayatana-indicator-application-549868147d2bbf6e68df4134d1a1c12d29691f25.zip |
* Upstream release 0.0.2
* Updates API to use GTK instead of dbusmenu to make it
easier for upstream developers to use.
Diffstat (limited to 'example')
-rw-r--r-- | example/simple-client.c | 37 |
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); |