diff options
author | Ted Gould <ted@canonical.com> | 2009-08-27 10:10:18 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-27 10:10:18 -0500 |
commit | 3f3da424ad9598486672ac43a531bd7565d765a8 (patch) | |
tree | 84cfbeb206edaf98c56e90f27eb9931e5a7fd1ee /src/launcher-menu-item.c | |
parent | ec04bfc2ba1caed976374344ae7bf7fb71cad38c (diff) | |
parent | 86cab293762c8b864a58f3e297c057cc05794daf (diff) | |
download | ayatana-indicator-messages-3f3da424ad9598486672ac43a531bd7565d765a8.tar.gz ayatana-indicator-messages-3f3da424ad9598486672ac43a531bd7565d765a8.tar.bz2 ayatana-indicator-messages-3f3da424ad9598486672ac43a531bd7565d765a8.zip |
Merging in a branch that updates to the new dbusmenu but also uses it to add a custom launcher item.
Diffstat (limited to 'src/launcher-menu-item.c')
-rw-r--r-- | src/launcher-menu-item.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index 802575f..822196b 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <glib/gi18n.h> #include <gio/gdesktopappinfo.h> #include "launcher-menu-item.h" +#include "dbus-data.h" enum { NAME_CHANGED, @@ -130,7 +131,9 @@ launcher_menu_item_new (const gchar * desktop_file) priv->desktop = g_strdup(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)); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "type", LAUNCHER_MENUITEM_TYPE); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_NAME, launcher_menu_item_get_name(self)); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), LAUNCHER_MENUITEM_PROP_APP_DESC, launcher_menu_item_get_description(self)); g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL); @@ -157,23 +160,12 @@ activate_cb (LauncherMenuItem * self, gpointer data) LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self); g_return_if_fail(priv->appinfo != NULL); - /* This should manage the X stuff for us */ - GdkAppLaunchContext * context = gdk_app_launch_context_new(); - - /* Using the current time as we don't have the event - time as that's not sent across the bus */ - GTimeVal time; - g_get_current_time(&time); - gdk_app_launch_context_set_timestamp(context, time.tv_usec / 1000); - GError * error = NULL; - if (!g_app_info_launch(priv->appinfo, NULL, G_APP_LAUNCH_CONTEXT(context), &error)) { + 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); } - g_object_unref(G_OBJECT(context)); - return; } @@ -185,20 +177,30 @@ launcher_menu_item_get_desktop (LauncherMenuItem * launchitem) return priv->desktop; } +/* Gets the decription for the item that should + go in the messaging menu */ +const gchar * +launcher_menu_item_get_description (LauncherMenuItem * li) +{ + g_return_val_if_fail(IS_LAUNCHER_MENU_ITEM(li), NULL); + LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(li); + return g_app_info_get_description(priv->appinfo); +} + /* Hides the menu item based on whether it is eclipsed or not. */ void launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed) { g_debug("Laucher '%s' is %s", launcher_menu_item_get_name(li), eclipsed ? "now eclipsed" : "shown again"); - dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), "show", eclipsed ? "false" : "true"); + dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE, eclipsed ? "false" : "true"); return; } gboolean launcher_menu_item_get_eclipsed (LauncherMenuItem * li) { - const gchar * show = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(li), "show"); + const gchar * show = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE); if (show == NULL) { return FALSE; } |