diff options
author | Ted Gould <ted@canonical.com> | 2009-08-19 21:30:02 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-19 21:30:02 -0500 |
commit | cfb0854e7c6bfa7cc9ac5ffdcd6672ad812ecfa0 (patch) | |
tree | f3d43d1457e8fc0cfb2a3ab5138b5f0a5369b8a9 | |
parent | 74df2c7eb2914922bf68940994751b8369991300 (diff) | |
download | ayatana-indicator-messages-cfb0854e7c6bfa7cc9ac5ffdcd6672ad812ecfa0.tar.gz ayatana-indicator-messages-cfb0854e7c6bfa7cc9ac5ffdcd6672ad812ecfa0.tar.bz2 ayatana-indicator-messages-cfb0854e7c6bfa7cc9ac5ffdcd6672ad812ecfa0.zip |
Adding in the activate logic so that the menu items actually launch the application.
-rw-r--r-- | src/launcher-menu-item.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index e8fc269..7970288 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -48,6 +48,7 @@ static void launcher_menu_item_class_init (LauncherMenuItemClass *klass); static void launcher_menu_item_init (LauncherMenuItem *self); static void launcher_menu_item_dispose (GObject *object); static void launcher_menu_item_finalize (GObject *object); +void activate_cb (LauncherMenuItem * self, gpointer data); G_DEFINE_TYPE (LauncherMenuItem, launcher_menu_item, DBUSMENU_TYPE_MENUITEM); @@ -121,6 +122,8 @@ launcher_menu_item_new (const gchar * desktop_file) g_debug("\tName: %s", launcher_menu_item_get_name(self)); dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "label", launcher_menu_item_get_name(self)); + g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); + return self; } @@ -135,3 +138,18 @@ launcher_menu_item_get_name (LauncherMenuItem * appitem) return g_app_info_get_name(priv->appinfo); } } + +void +activate_cb (LauncherMenuItem * self, gpointer data) +{ + LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self); + g_return_if_fail(priv->appinfo != NULL); + + GError * error = NULL; + if (!g_app_info_launch(priv->appinfo, NULL, NULL, &error)) { + g_warning("Application failed to launch '%s' because: %s", launcher_menu_item_get_name(self), error->message); + g_error_free(error); + } + + return; +} |