ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00961
[Merge] lp:~ted/libindicate/im-client-menu into lp:libindicate
Ted Gould has proposed merging lp:~ted/libindicate/im-client-menu into lp:libindicate.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Adding the ability in the sample code to set dynamic menus.
--
https://code.launchpad.net/~ted/libindicate/im-client-menu/+merge/19571
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== modified file 'examples/im-client.c'
--- examples/im-client.c 2009-08-28 19:40:56 +0000
+++ examples/im-client.c 2010-02-18 03:06:13 +0000
@@ -78,6 +78,12 @@
g_debug("Someone is no longer interested in my for: %d", interest);
}
+void
+menuitem_click (DbusmenuMenuitem * menuitem, guint timestamp, gpointer data)
+{
+ g_debug("Menuitem '%s' clicked at %d", (gchar *)data, timestamp);
+}
+
int
main (int argc, char ** argv)
{
@@ -90,6 +96,23 @@
g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL);
g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_REMOVED, G_CALLBACK(interest_removed), NULL);
+ DbusmenuServer * dmserver = dbusmenu_server_new("/dbusmenu/path");
+ DbusmenuMenuitem * root = dbusmenu_menuitem_new();
+ dbusmenu_server_set_root(dmserver, root);
+ DbusmenuMenuitem * item;
+
+ item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Label 1");
+ dbusmenu_menuitem_child_append(root, item);
+ g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(menuitem_click), "Label 1");
+
+ item = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Label 2");
+ dbusmenu_menuitem_child_append(root, item);
+ g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(menuitem_click), "Label 2");
+
+ indicate_server_set_menu(server, dmserver);
+
IndicateIndicator * indicator;
indicator = indicate_indicator_new();
Follow ups