aboutsummaryrefslogtreecommitdiff
path: root/src/example-service.c
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-09 15:30:54 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-09 15:30:54 -0400
commit064c67947dbd7930408a3136c41998dbb48cd5ad (patch)
tree0d2ecf66fe7e04d1b2c27ef066042cd8d2f4cac2 /src/example-service.c
parent86b44a284d250a285ac070527c9636a1f3e42fdd (diff)
downloadayatana-indicator-notifications-064c67947dbd7930408a3136c41998dbb48cd5ad.tar.gz
ayatana-indicator-notifications-064c67947dbd7930408a3136c41998dbb48cd5ad.tar.bz2
ayatana-indicator-notifications-064c67947dbd7930408a3136c41998dbb48cd5ad.zip
Testing the item-activate signal by launching various programs.
Diffstat (limited to 'src/example-service.c')
-rw-r--r--src/example-service.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/example-service.c b/src/example-service.c
index 84a33bb..8f87c74 100644
--- a/src/example-service.c
+++ b/src/example-service.c
@@ -47,19 +47,37 @@ static ExampleInterface *dbus = NULL;
static DbusmenuMenuitem *item_1 = NULL;
static DbusmenuMenuitem *item_2 = NULL;
+/* Test the item activation signal */
+static void
+activate_cb(DbusmenuMenuitem *item, guint timestamp, const gchar *command)
+{
+ GError *error = NULL;
+
+ if(!g_spawn_command_line_async(command, &error)) {
+ g_warning("Unable to start command %s: %s\n", command, error->message);
+ g_error_free(error);
+ }
+}
+
static void
build_menus(DbusmenuMenuitem *root)
{
g_debug("Building Menus.");
if (item_1 == NULL) {
item_1 = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(item_1, DBUSMENU_MENUITEM_PROP_LABEL, _("Test Item 1"));
+ dbusmenu_menuitem_property_set(item_1, DBUSMENU_MENUITEM_PROP_LABEL, _("Launch Gedit"));
dbusmenu_menuitem_child_append(root, item_1);
+
+ g_signal_connect(G_OBJECT(item_1), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb),
+ "gedit");
}
if (item_2 == NULL) {
item_2 = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(item_2, DBUSMENU_MENUITEM_PROP_LABEL, _("Test Item 2"));
+ dbusmenu_menuitem_property_set(item_2, DBUSMENU_MENUITEM_PROP_LABEL, _("Launch Xterm"));
dbusmenu_menuitem_child_append(root, item_2);
+
+ g_signal_connect(G_OBJECT(item_2), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb),
+ "xterm");
}
return;