aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/app-menu-item.c59
-rw-r--r--src/launcher-menu-item.c362
-rw-r--r--src/launcher-menu-item.h68
-rw-r--r--src/messages-service.c415
-rw-r--r--test/Makefile.am2
6 files changed, 175 insertions, 733 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fa8c7a5..4fdc8a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,8 +46,6 @@ indicator_messages_service_SOURCES = \
im-menu-item.h \
app-menu-item.c \
app-menu-item.h \
- launcher-menu-item.c \
- launcher-menu-item.h \
dbus-data.h \
\
status-items.c \
diff --git a/src/app-menu-item.c b/src/app-menu-item.c
index 6ed00a2..48aef3e 100644
--- a/src/app-menu-item.c
+++ b/src/app-menu-item.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gio/gdesktopappinfo.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
+#include <libindicator/indicator-desktop-shortcuts.h>
#include "app-menu-item.h"
#include "dbus-data.h"
@@ -55,6 +56,8 @@ struct _AppMenuItemPrivate
DbusmenuClient * client;
DbusmenuMenuitem * root;
GList * shortcuts;
+ GList * static_shortcuts;
+ IndicatorDesktopShortcuts * ids;
};
#define APP_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_MENU_ITEM_TYPE, AppMenuItemPrivate))
@@ -131,6 +134,7 @@ app_menu_item_init (AppMenuItem *self)
priv->client = NULL;
priv->root = NULL;
priv->shortcuts = NULL;
+ priv->static_shortcuts = NULL;
dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
@@ -165,6 +169,17 @@ app_menu_item_dispose (GObject *object)
priv->shortcuts = NULL;
}
+ if (priv->static_shortcuts != NULL) {
+ g_list_foreach(priv->static_shortcuts, func_unref, object);
+ g_list_free(priv->static_shortcuts);
+ priv->static_shortcuts = NULL;
+ }
+
+ if (priv->ids != NULL) {
+ g_object_unref(priv->ids);
+ priv->ids = NULL;
+ }
+
if (priv->root != NULL) {
g_object_unref(priv->root);
priv->root = NULL;
@@ -201,6 +216,29 @@ app_menu_item_finalize (GObject *object)
return;
}
+/* Respond to one of the shortcuts getting clicked on. */
+static void
+nick_activate_cb (DbusmenuMenuitem * self, guint timestamp, gpointer data)
+{
+ gchar * nick = g_object_get_data(G_OBJECT(self), "ids-nick-data");
+ AppMenuItem * mi = APP_MENU_ITEM(data);
+
+ g_return_if_fail(nick != NULL);
+ g_return_if_fail(mi != NULL);
+
+ AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(mi);
+
+ g_return_if_fail(priv->ids != NULL);
+
+ if (!indicator_desktop_shortcuts_nick_exec(priv->ids, nick)) {
+ g_warning("Unable to execute nick '%s' for desktop file '%s'",
+ nick, g_desktop_app_info_get_filename (priv->appinfo));
+ }
+
+ return;
+}
+
+
static void
app_menu_item_set_appinfo (AppMenuItem *self,
GDesktopAppInfo *appinfo)
@@ -247,6 +285,24 @@ app_menu_item_set_appinfo (AppMenuItem *self,
g_signal_emit(G_OBJECT(self), signals[NAME_CHANGED], 0, app_menu_item_get_name(self), TRUE);
+ /* Start to build static shortcuts */
+ priv->ids = indicator_desktop_shortcuts_new(g_desktop_app_info_get_filename (priv->appinfo), "Messaging Menu");
+ const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->ids);
+ gint i;
+ for (i = 0; nicks[i] != NULL; i++) {
+ DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE);
+ g_object_set_data(G_OBJECT(mi), "ids-nick-data", (gpointer)nicks[i]);
+
+ gchar *name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);
+ dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, name);
+ g_free(name);
+
+ g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self);
+
+ priv->static_shortcuts = g_list_append(priv->static_shortcuts, mi);
+ }
+
g_key_file_unref(keyfile);
}
@@ -574,5 +630,6 @@ app_menu_item_get_items (AppMenuItem * appitem)
{
g_return_val_if_fail(IS_APP_MENU_ITEM(appitem), NULL);
AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(appitem);
- return priv->shortcuts;
+ return g_list_concat (g_list_copy (priv->shortcuts),
+ g_list_copy (priv->static_shortcuts));
}
diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c
deleted file mode 100644
index fd04f52..0000000
--- a/src/launcher-menu-item.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
-An indicator to show information that is in messaging applications
-that the user is using.
-
-Copyright 2009 Canonical Ltd.
-
-Authors:
- Ted Gould <ted@canonical.com>
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 3, as published
-by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gdk/gdk.h>
-#include <glib/gi18n.h>
-#include <gio/gdesktopappinfo.h>
-#include <libindicator/indicator-desktop-shortcuts.h>
-#include "launcher-menu-item.h"
-#include "dbus-data.h"
-
-enum {
- NAME_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-typedef struct _LauncherMenuItemPrivate LauncherMenuItemPrivate;
-struct _LauncherMenuItemPrivate
-{
- GAppInfo * appinfo;
- GKeyFile * keyfile;
- gchar * desktop;
- IndicatorDesktopShortcuts * ids;
- GList * shortcuts;
-};
-
-#define LAUNCHER_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), LAUNCHER_MENU_ITEM_TYPE, LauncherMenuItemPrivate))
-
-#define NICK_DATA "ids-nick-data"
-
-/* Prototypes */
-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);
-static void activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data);
-static void nick_activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data);
-
-
-G_DEFINE_TYPE (LauncherMenuItem, launcher_menu_item, DBUSMENU_TYPE_MENUITEM);
-
-static void
-launcher_menu_item_class_init (LauncherMenuItemClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (LauncherMenuItemPrivate));
-
- object_class->dispose = launcher_menu_item_dispose;
- object_class->finalize = launcher_menu_item_finalize;
-
- signals[NAME_CHANGED] = g_signal_new(LAUNCHER_MENU_ITEM_SIGNAL_NAME_CHANGED,
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (LauncherMenuItemClass, name_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- return;
-}
-
-static void
-launcher_menu_item_init (LauncherMenuItem *self)
-{
- g_debug("Building new Launcher Menu Item");
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self);
-
- priv->appinfo = NULL;
- priv->desktop = NULL;
- priv->keyfile = NULL;
-
- priv->ids = NULL;
- priv->shortcuts = NULL;
-
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE);
-
- return;
-}
-
-static void
-func_unref (gpointer data, gpointer user_data)
-{
- g_object_unref(G_OBJECT(data));
- return;
-}
-
-static void
-launcher_menu_item_dispose (GObject *object)
-{
- LauncherMenuItem * self = LAUNCHER_MENU_ITEM(object);
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self);
-
- if (priv->appinfo != NULL) {
- g_object_unref(priv->appinfo);
- priv->appinfo = NULL;
- }
-
- if (priv->keyfile != NULL) {
- g_object_unref(priv->keyfile);
- priv->keyfile = NULL;
- }
-
- if (priv->ids != NULL) {
- g_object_unref(priv->ids);
- priv->ids = NULL;
- }
-
- if (priv->shortcuts != NULL) {
- g_list_foreach(priv->shortcuts, func_unref, NULL);
- g_list_free(priv->shortcuts);
- priv->shortcuts = NULL;
- }
-
- G_OBJECT_CLASS (launcher_menu_item_parent_class)->dispose (object);
-}
-
-static void
-launcher_menu_item_finalize (GObject *object)
-{
- LauncherMenuItem * self = LAUNCHER_MENU_ITEM(object);
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self);
-
- if (priv->desktop != NULL) {
- g_free(priv->desktop);
- priv->desktop = NULL;
- }
-
- G_OBJECT_CLASS (launcher_menu_item_parent_class)->finalize (object);
-
- return;
-}
-
-LauncherMenuItem *
-launcher_menu_item_new (const gchar * desktop_file)
-{
- LauncherMenuItem * self = g_object_new(LAUNCHER_MENU_ITEM_TYPE, NULL);
- g_debug("\tDesktop file: %s", desktop_file);
-
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(self);
-
- /* Parse the desktop file we've been given. */
- priv->appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(desktop_file));
- priv->keyfile = g_key_file_new();
- g_key_file_load_from_file(priv->keyfile, desktop_file, G_KEY_FILE_NONE, NULL);
- priv->desktop = g_strdup(desktop_file);
-
- /* Set the appropriate values on this menu item based on the
- app info that we've parsed */
- g_debug("\tName: %s", launcher_menu_item_get_name(self));
-
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(self));
-
- gchar * iconstr = launcher_menu_item_get_icon(self);
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_ICON_NAME, iconstr);
- g_free(iconstr);
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
-
- g_signal_connect(G_OBJECT(self), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), NULL);
-
- /* Start to build static shortcuts */
- priv->ids = indicator_desktop_shortcuts_new(priv->desktop, "Messaging Menu");
- const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->ids);
- gint i;
- for (i = 0; nicks[i] != NULL; i++) {
- DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE);
- g_object_set_data(G_OBJECT(mi), NICK_DATA, (gpointer)nicks[i]);
-
- gchar *name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);
- dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, name);
- g_free(name);
-
- g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self);
-
- priv->shortcuts = g_list_append(priv->shortcuts, mi);
- }
-
- /* Check to see if we should be eclipsed */
- if (priv->appinfo == NULL) {
- launcher_menu_item_set_eclipsed(self, TRUE);
- }
-
- return self;
-}
-
-const gchar *
-launcher_menu_item_get_name (LauncherMenuItem * appitem)
-{
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(appitem);
-
- if (priv->appinfo == NULL) {
- return NULL;
- } else {
- return g_app_info_get_name(priv->appinfo);
- }
-}
-
-/* Respond to one of the shortcuts getting clicked on. */
-static void
-nick_activate_cb (LauncherMenuItem * self, guint timestamp, gpointer data)
-{
- gchar * nick = (gchar *)g_object_get_data(G_OBJECT(self), NICK_DATA);
- LauncherMenuItem * lmi = LAUNCHER_MENU_ITEM(data);
-
- g_return_if_fail(nick != NULL);
- g_return_if_fail(lmi != NULL);
-
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(lmi);
-
- g_return_if_fail(priv->ids != NULL);
-
- if (!indicator_desktop_shortcuts_nick_exec(priv->ids, nick)) {
- g_warning("Unable to execute nick '%s' for desktop file '%s'", nick, priv->desktop);
- }
-
- return;
-}
-
-/* Figure out the appropriate icon for this launcher */
-gchar *
-launcher_menu_item_get_icon (LauncherMenuItem * appitem)
-{
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(appitem);
- gchar * retval = NULL;
-
- /* Check to see if there is a specific icon for the messaging
- menu first. */
- if (g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, ICON_KEY, NULL) && retval == NULL) {
- GError * error = NULL;
-
- retval = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, ICON_KEY, &error);
-
- if (error != NULL) {
- /* Can't figure out why this would happen, but sure, let's print something */
- g_warning("Error getting '" ICON_KEY "' from desktop file: %s", error->message);
- g_error_free(error);
- }
- }
-
- /* If there's not, or there is an error, we'll use the one
- from the application info */
- if (priv->appinfo != NULL && retval == NULL) {
- GIcon * icon = g_app_info_get_icon(priv->appinfo);
- retval = g_icon_to_string(icon);
- }
-
- return retval;
-}
-
-/* When the menu item is clicked on it tries to launch
- the application that is represented by the desktop file */
-static void
-activate_cb (LauncherMenuItem * self, guint timestamp, 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;
-}
-
-const gchar *
-launcher_menu_item_get_desktop (LauncherMenuItem * launchitem)
-{
- g_return_val_if_fail(IS_LAUNCHER_MENU_ITEM(launchitem), NULL);
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(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);
-}
-
-/* Apply the eclipse value to all the shortcuts */
-static void
-eclipse_shortcuts_cb (gpointer data, gpointer user_data)
-{
- DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(data);
- g_return_if_fail(mi != NULL);
-
- gboolean eclipsed = GPOINTER_TO_UINT(user_data);
-
- dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !eclipsed);
- return;
-}
-
-/* Hides the menu item based on whether it is eclipsed
- or not. */
-void
-launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed)
-{
- g_return_if_fail(IS_LAUNCHER_MENU_ITEM(li));
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(li);
-
- g_debug("Laucher '%s' is %s", launcher_menu_item_get_name(li), eclipsed ? "now eclipsed" : "shown again");
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE, !eclipsed);
-
- g_list_foreach(priv->shortcuts, eclipse_shortcuts_cb, GINT_TO_POINTER(eclipsed));
-
- /* If we're being reshown let's re-evaluate how we should be
- showing the label */
- if (!eclipsed) {
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_LABEL, launcher_menu_item_get_name(li));
- }
-
- return;
-}
-
-/* Check to see if this item is eclipsed */
-gboolean
-launcher_menu_item_get_eclipsed (LauncherMenuItem * li)
-{
- gboolean show = dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(li), DBUSMENU_MENUITEM_PROP_VISIBLE);
- g_debug("Launcher check eclipse: %s", show ? "false" : "true");
- return !show;
-}
-
-/* Gets the shortcuts that are associated with this
- launcher. They're a list of DbusmenuMenuitems */
-GList *
-launcher_menu_item_get_items (LauncherMenuItem * li)
-{
- g_return_val_if_fail(IS_LAUNCHER_MENU_ITEM(li), NULL);
- LauncherMenuItemPrivate * priv = LAUNCHER_MENU_ITEM_GET_PRIVATE(li);
- return priv->shortcuts;
-}
diff --git a/src/launcher-menu-item.h b/src/launcher-menu-item.h
deleted file mode 100644
index ace1f85..0000000
--- a/src/launcher-menu-item.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-An indicator to show information that is in messaging applications
-that the user is using.
-
-Copyright 2009 Canonical Ltd.
-
-Authors:
- Ted Gould <ted@canonical.com>
-
-This program is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 3, as published
-by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranties of
-MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
-PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __LAUNCHER_MENU_ITEM_H__
-#define __LAUNCHER_MENU_ITEM_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libdbusmenu-glib/menuitem.h>
-
-G_BEGIN_DECLS
-
-#define LAUNCHER_MENU_ITEM_TYPE (launcher_menu_item_get_type ())
-#define LAUNCHER_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LAUNCHER_MENU_ITEM_TYPE, LauncherMenuItem))
-#define LAUNCHER_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LAUNCHER_MENU_ITEM_TYPE, LauncherMenuItemClass))
-#define IS_LAUNCHER_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LAUNCHER_MENU_ITEM_TYPE))
-#define IS_LAUNCHER_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LAUNCHER_MENU_ITEM_TYPE))
-#define LAUNCHER_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LAUNCHER_MENU_ITEM_TYPE, LauncherMenuItemClass))
-
-#define LAUNCHER_MENU_ITEM_SIGNAL_NAME_CHANGED "name-changed"
-
-typedef struct _LauncherMenuItem LauncherMenuItem;
-typedef struct _LauncherMenuItemClass LauncherMenuItemClass;
-
-struct _LauncherMenuItemClass {
- DbusmenuMenuitemClass parent_class;
-
- void (* name_changed) (gchar * name);
-};
-
-struct _LauncherMenuItem {
- DbusmenuMenuitem parent;
-};
-
-GType launcher_menu_item_get_type (void);
-LauncherMenuItem * launcher_menu_item_new (const gchar * desktop_file);
-const gchar * launcher_menu_item_get_name (LauncherMenuItem * appitem);
-const gchar * launcher_menu_item_get_desktop (LauncherMenuItem * launchitem);
-const gchar * launcher_menu_item_get_description (LauncherMenuItem * li);
-gchar * launcher_menu_item_get_icon (LauncherMenuItem * appitem);
-void launcher_menu_item_set_eclipsed (LauncherMenuItem * li, gboolean eclipsed);
-gboolean launcher_menu_item_get_eclipsed (LauncherMenuItem * li);
-GList * launcher_menu_item_get_items (LauncherMenuItem * li);
-
-G_END_DECLS
-
-#endif /* __LAUNCHER_MENU_ITEM_H__ */
-
diff --git a/src/messages-service.c b/src/messages-service.c
index 1b01e4b..0934b9c 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -36,7 +36,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "im-menu-item.h"
#include "app-menu-item.h"
-#include "launcher-menu-item.h"
#include "dbus-data.h"
#include "messages-service-dbus.h"
#include "status-items.h"
@@ -44,7 +43,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
static IndicatorService * service = NULL;
static IndicateListener * listener = NULL;
static GList * serverList = NULL;
-static GList * launcherList = NULL;
static DbusmenuMenuitem * root_menuitem = NULL;
static DbusmenuMenuitem * status_separator = NULL;
@@ -64,11 +62,8 @@ static void server_name_changed (AppMenuItem * appitem, gchar * name, gpointer d
static void im_time_changed (ImMenuItem * imitem, glong seconds, gpointer data);
static void resort_menu (DbusmenuMenuitem * menushell);
static void indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gpointer data);
-static void check_eclipses (AppMenuItem * ai);
-static void remove_eclipses (AppMenuItem * ai);
static gboolean build_launcher (gpointer data);
static gboolean build_launchers (gpointer data);
-static void check_hidden (void);
/*
@@ -161,56 +156,6 @@ imList_sort (gconstpointer a, gconstpointer b)
return (gint)(im_menu_item_get_seconds(IM_MENU_ITEM(pb->menuitem)) - im_menu_item_get_seconds(IM_MENU_ITEM(pa->menuitem)));
}
-/*
- * Launcher List
- */
-
-typedef struct _launcherList_t launcherList_t;
-struct _launcherList_t {
- LauncherMenuItem * menuitem;
- DbusmenuMenuitem * separator;
-};
-
-static gint
-launcherList_sort (gconstpointer a, gconstpointer b)
-{
- launcherList_t * pa, * pb;
-
- pa = (launcherList_t *)a;
- pb = (launcherList_t *)b;
-
- const gchar * pan = launcher_menu_item_get_name(pa->menuitem);
- const gchar * pbn = launcher_menu_item_get_name(pb->menuitem);
-
- return g_strcmp0(pan, pbn);
-}
-
-static void
-launcherList_count_helper (gpointer data, gpointer user_data)
-{
- guint * count = (guint *)user_data;
- launcherList_t * li = (launcherList_t *)data;
-
- if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
- *count = *count + 1;
- }
-
- return;
-}
-
-static guint
-launcherList_count (void)
-{
- guint count = 0;
-
- g_list_foreach(launcherList, launcherList_count_helper, &count);
-
- return count;
-}
-
-/*
- * More code
- */
/* Goes through all the servers and sees if any of them
want attention. If they do, then well we'll give it
@@ -259,6 +204,84 @@ server_attention (serverList_t * slt)
return;
}
+static void
+desktop_cb (IndicateListener *listener,
+ IndicateListenerServer *server,
+ const gchar *value,
+ gpointer data)
+{
+ DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data);
+ GList *listitem;
+ serverList_t * sl_item = NULL;
+
+ /* Check to see if we already have a launcher for this app */
+ for (listitem = serverList; listitem != NULL; listitem = listitem->next) {
+ serverList_t * slt = listitem->data;
+ if (!g_strcmp0(app_menu_item_get_desktop(slt->menuitem), value)) {
+ sl_item = slt;
+ break;
+ }
+ }
+
+ if (!sl_item) {
+ /* Build the Menu item */
+ AppMenuItem * menuitem = app_menu_item_new_with_server (listener, server);
+
+ /* Build a possible server structure */
+ sl_item = g_new0(serverList_t, 1);
+ sl_item->server = server;
+ sl_item->menuitem = menuitem;
+ sl_item->imList = NULL;
+ sl_item->attention = FALSE;
+ sl_item->count = 0;
+
+ /* Build a separator */
+ sl_item->separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+
+ /* Connect the signals up to the menu item */
+ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_COUNT_CHANGED, G_CALLBACK(server_count_changed), sl_item);
+ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_NAME_CHANGED, G_CALLBACK(server_name_changed), menushell);
+ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_SHORTCUT_ADDED, G_CALLBACK(server_shortcut_added), menushell);
+ g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_SHORTCUT_REMOVED, G_CALLBACK(server_shortcut_removed), menushell);
+
+ /* Put our new menu item in, with the separator behind it.
+ resort_menu will take care of whether it should be hidden
+ or not. */
+ dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem));
+
+ /* Incase we got an indicator first */
+ GList * alreadythere = g_list_find_custom(serverList, sl_item, serverList_equal);
+ if (alreadythere != NULL) {
+ /* Use the one we already had */
+ g_free(sl_item);
+ sl_item = (serverList_t *)alreadythere->data;
+ sl_item->menuitem = menuitem;
+ serverList = g_list_sort(serverList, serverList_sort);
+ } else {
+ /* Insert the new one in the list */
+ serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort);
+ }
+
+ dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(sl_item->separator));
+ }
+ else {
+ app_menu_item_set_server (sl_item->menuitem, listener, server);
+ }
+
+ GList * shortcuts = app_menu_item_get_items(sl_item->menuitem);
+ GList * shortcut = shortcuts;
+ while (shortcut != NULL) {
+ DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(shortcut->data);
+ g_debug("\tAdding shortcut: %s", dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL));
+ dbusmenu_menuitem_child_append(menushell, mi);
+ shortcut = g_list_next(shortcut);
+ }
+ g_list_free (shortcuts);
+
+ resort_menu(menushell);
+}
+
/* A new server has been created on the indicate bus.
We need to check to see if we like it. And build
structures for it if so. */
@@ -279,65 +302,9 @@ server_added (IndicateListener * listener, IndicateListenerServer * server, gcha
return;
}
- DbusmenuMenuitem * menushell = DBUSMENU_MENUITEM(data);
- if (menushell == NULL) {
- g_error("\tData in callback is not a menushell");
- return;
- }
-
- /* Build the Menu item */
- AppMenuItem * menuitem = app_menu_item_new_with_server (listener, server);
-
- /* Build a possible server structure */
- serverList_t * sl_item = g_new0(serverList_t, 1);
- sl_item->server = server;
- sl_item->menuitem = menuitem;
- sl_item->imList = NULL;
- sl_item->attention = FALSE;
- sl_item->count = 0;
-
- /* Incase we got an indicator first */
- GList * alreadythere = g_list_find_custom(serverList, sl_item, serverList_equal);
- if (alreadythere != NULL) {
- /* Use the one we already had */
- g_free(sl_item);
- sl_item = (serverList_t *)alreadythere->data;
- sl_item->menuitem = menuitem;
- serverList = g_list_sort(serverList, serverList_sort);
- } else {
- /* Insert the new one in the list */
- serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort);
- }
-
- /* Build a separator */
- sl_item->separator = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
-
- /* Connect the signals up to the menu item */
- g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_COUNT_CHANGED, G_CALLBACK(server_count_changed), sl_item);
- g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_NAME_CHANGED, G_CALLBACK(server_name_changed), menushell);
- g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_SHORTCUT_ADDED, G_CALLBACK(server_shortcut_added), menushell);
- g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_SHORTCUT_REMOVED, G_CALLBACK(server_shortcut_removed), menushell);
-
- /* Put our new menu item in, with the separator behind it.
- resort_menu will take care of whether it should be hidden
- or not. */
- dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(menuitem));
-
- GList * shortcuts = app_menu_item_get_items(sl_item->menuitem);
- while (shortcuts != NULL) {
- DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(shortcuts->data);
- g_debug("\tAdding shortcut: %s", dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL));
- dbusmenu_menuitem_child_append(menushell, mi);
- shortcuts = g_list_next(shortcuts);
- }
-
- dbusmenu_menuitem_child_append(menushell, DBUSMENU_MENUITEM(sl_item->separator));
-
- resort_menu(menushell);
- check_hidden();
-
- return;
+ /* fetch the desktop file before creating the menu item, in case we
+ * already have a launcher for it */
+ indicate_listener_server_get_desktop(listener, server, desktop_cb, data);
}
/* Server shortcut has been added */
@@ -372,7 +339,6 @@ static void
server_name_changed (AppMenuItem * appitem, gchar * name, gpointer data)
{
serverList = g_list_sort(serverList, serverList_sort);
- check_eclipses(appitem);
resort_menu(DBUSMENU_MENUITEM(data));
return;
}
@@ -466,19 +432,18 @@ server_removed (IndicateListener * listener, IndicateListenerServer * server, gc
/* Remove from the server list */
serverList = g_list_remove(serverList, sltp);
- /* Remove launchers this could be eclipsing */
- remove_eclipses(sltp->menuitem);
-
/* If there is a menu item, let's get rid of it. */
if (sltp->menuitem != NULL) {
/* If there are shortcuts remove them */
GList * shortcuts = app_menu_item_get_items(sltp->menuitem);
- while (shortcuts != NULL) {
- g_debug("\tRemoving shortcut: %s", dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(shortcuts->data), DBUSMENU_MENUITEM_PROP_LABEL));
- dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(shortcuts->data), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), DBUSMENU_MENUITEM(shortcuts->data));
- shortcuts = g_list_next(shortcuts);
+ GList * shortcut = shortcuts;
+ while (shortcut != NULL) {
+ g_debug("\tRemoving shortcut: %s", dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(shortcut->data), DBUSMENU_MENUITEM_PROP_LABEL));
+ dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(shortcut->data), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ dbusmenu_menuitem_child_delete(DBUSMENU_MENUITEM(data), DBUSMENU_MENUITEM(shortcut->data));
+ shortcut = g_list_next(shortcut);
}
+ g_list_free (shortcuts);
g_debug("\tRemoving item");
dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(sltp->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
@@ -506,8 +471,6 @@ server_removed (IndicateListener * listener, IndicateListenerServer * server, gc
g_free(sltp);
- check_hidden();
-
return;
}
@@ -531,9 +494,12 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) {
AppMenuItem * appmenu = APP_MENU_ITEM(data_mi);
if (!g_strcmp0(INDICATE_LISTENER_SERVER_DBUS_NAME((IndicateListenerServer*)msl->server), INDICATE_LISTENER_SERVER_DBUS_NAME(app_menu_item_get_server(appmenu)))) {
+ GList *shortcuts = app_menu_item_get_items(appmenu);
msl->found = TRUE;
/* Return a position at the end of our shortcuts */
- msl->position += g_list_length(app_menu_item_get_items(appmenu));
+ msl->position += g_list_length(shortcuts);
+ g_list_free (shortcuts);
+
} else {
msl->position++;
}
@@ -541,24 +507,6 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) {
return;
}
-static void
-check_hidden (void)
-{
- g_debug("Checking Hidden...");
- gboolean hide = FALSE;
- if (launcherList_count() == 0) {
- g_debug("\tZero Launchers");
- /* If we don't have visible launchers we need to look more */
- if (g_list_length(serverList) == 0) {
- g_debug("\tZero Applications");
- hide = TRUE;
- }
- }
-
- message_service_dbus_set_icon(dbus_interface, hide);
- return;
-}
-
/* This function takes care of putting the menu in the right order.
It basically it rebuilds the order by looking through all the
applications and launchers and puts them in the right place. The
@@ -569,7 +517,6 @@ resort_menu (DbusmenuMenuitem * menushell)
{
guint position = 0;
GList * serverentry;
- GList * launcherentry = launcherList;
g_debug("Reordering Menu:");
@@ -581,41 +528,6 @@ resort_menu (DbusmenuMenuitem * menushell)
for (serverentry = serverList; serverentry != NULL; serverentry = serverentry->next) {
serverList_t * si = (serverList_t *)serverentry->data;
- /* Looking to see if there are any launchers we need to insert
- into the menu structure. We put as many as we need to. */
- if (launcherentry != NULL) {
- launcherList_t * li = (launcherList_t *)launcherentry->data;
- while (launcherentry != NULL && g_strcmp0(launcher_menu_item_get_name(li->menuitem), app_menu_item_get_name(si->menuitem)) < 0) {
- /* Putting the launcher item in */
- g_debug("\tMoving launcher '%s' to position %d", launcher_menu_item_get_name(li->menuitem), position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->menuitem), position);
- position++;
-
- /* Inserting the shortcuts from the launcher */
- GList * shortcuts = launcher_menu_item_get_items(li->menuitem);
- while (shortcuts != NULL) {
- g_debug("\t\tMoving shortcut to position %d", position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(shortcuts->data), position);
- position++;
- shortcuts = g_list_next(shortcuts);
- }
-
- /* Putting the launcher separator in */
- g_debug("\tMoving launcher separator to position %d", position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->separator), position);
- if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
- /* Only clear the visiblity if we're not eclipsed */
- dbusmenu_menuitem_property_set_bool(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- }
- position++;
-
- launcherentry = launcherentry->next;
- if (launcherentry != NULL) {
- li = (launcherList_t *)launcherentry->data;
- }
- }
- }
-
/* Putting the app menu item in */
if (si->menuitem != NULL) {
g_debug("\tMoving app %s to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position);
@@ -624,12 +536,14 @@ resort_menu (DbusmenuMenuitem * menushell)
/* Inserting the shortcuts from the launcher */
GList * shortcuts = app_menu_item_get_items(si->menuitem);
- while (shortcuts != NULL) {
+ GList * shortcut = shortcuts;
+ while (shortcut != NULL) {
g_debug("\t\tMoving shortcut to position %d", position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(shortcuts->data), position);
+ dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(shortcut->data), position);
position++;
- shortcuts = g_list_next(shortcuts);
+ shortcut = g_list_next(shortcut);
}
+ g_list_free (shortcuts);
}
/* Putting all the indicators that are related to this application
@@ -668,36 +582,6 @@ resort_menu (DbusmenuMenuitem * menushell)
}
}
- /* Put any leftover launchers in at the end of the list. */
- while (launcherentry != NULL) {
- launcherList_t * li = (launcherList_t *)launcherentry->data;
-
- /* Putting the launcher in */
- g_debug("\tMoving launcher '%s' to position %d", launcher_menu_item_get_name(li->menuitem), position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->menuitem), position);
- position++;
-
- /* Inserting the shortcuts from the launcher */
- GList * shortcuts = launcher_menu_item_get_items(li->menuitem);
- while (shortcuts != NULL) {
- g_debug("\t\tMoving shortcut to position %d", position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(shortcuts->data), position);
- position++;
- shortcuts = g_list_next(shortcuts);
- }
-
- /* Putting the launcher separator in */
- g_debug("\tMoving launcher separator to position %d", position);
- dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(li->separator), position);
- if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
- /* Only clear the visiblity if we're not eclipsed */
- dbusmenu_menuitem_property_set_bool(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- }
- position++;
-
- launcherentry = launcherentry->next;
- }
-
if (clear_attention != NULL) {
dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), clear_attention, position);
position++; /* Not needed, but reduce bugs on code tacked on here, compiler will remove */
@@ -870,73 +754,22 @@ indicator_removed (IndicateListener * listener, IndicateListenerServer * server,
return;
}
-/* Check to see if a new desktop file causes
- any of the launchers to be eclipsed by a running
- process */
-static void
-check_eclipses (AppMenuItem * ai)
-{
- g_debug("Checking eclipsing");
- const gchar * aidesktop = app_menu_item_get_desktop(ai);
- if (aidesktop == NULL) return;
- g_debug("\tApp desktop: %s", aidesktop);
-
- GList * llitem;
- for (llitem = launcherList; llitem != NULL; llitem = llitem->next) {
- launcherList_t * ll = (launcherList_t *)llitem->data;
- const gchar * lidesktop = launcher_menu_item_get_desktop(ll->menuitem);
- g_debug("\tLauncher desktop: %s", lidesktop);
-
- if (!g_strcmp0(aidesktop, lidesktop)) {
- launcher_menu_item_set_eclipsed(ll->menuitem, TRUE);
- dbusmenu_menuitem_property_set_bool(ll->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- break;
- }
- }
-
- return;
-}
-
-/* Remove any eclipses that might have been caused
- by this app item that is now retiring */
-static void
-remove_eclipses (AppMenuItem * ai)
-{
- const gchar * aidesktop = app_menu_item_get_desktop(ai);
- if (aidesktop == NULL) return;
-
- GList * llitem;
- for (llitem = launcherList; llitem != NULL; llitem = llitem->next) {
- launcherList_t * ll = (launcherList_t *)llitem->data;
- const gchar * lidesktop = launcher_menu_item_get_desktop(ll->menuitem);
-
- if (!g_strcmp0(aidesktop, lidesktop)) {
- launcher_menu_item_set_eclipsed(ll->menuitem, FALSE);
- dbusmenu_menuitem_property_set_bool(ll->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- break;
- }
- }
-
- return;
-}
-
/* This function turns a specific file into a menu
item and registers it appropriately with everyone */
static gboolean
build_launcher (gpointer data)
{
gchar *desktop_id = data;
- const gchar *desktop = data;
GDesktopAppInfo *appinfo;
+ GList *listitem;
appinfo = g_desktop_app_info_new (desktop_id);
- desktop = g_desktop_app_info_get_filename (appinfo);
/* Check to see if we already have a launcher */
- GList * listitem;
- for (listitem = launcherList; listitem != NULL; listitem = listitem->next) {
- launcherList_t * li = (launcherList_t *)listitem->data;
- if (!g_strcmp0(launcher_menu_item_get_desktop(li->menuitem), desktop)) {
+ for (listitem = serverList; listitem != NULL; listitem = listitem->next) {
+ serverList_t * slt = listitem->data;
+ if (!g_strcmp0(app_menu_item_get_desktop(slt->menuitem),
+ g_desktop_app_info_get_filename (appinfo))) {
break;
}
}
@@ -944,43 +777,29 @@ build_launcher (gpointer data)
if (listitem == NULL) {
/* If not */
/* Build the item */
- launcherList_t * ll = g_new0(launcherList_t, 1);
- ll->menuitem = launcher_menu_item_new(desktop);
+ serverList_t * sl_item = g_new0(serverList_t, 1);
+ sl_item->menuitem = app_menu_item_new(appinfo);
/* Build a separator */
- ll->separator = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(ll->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ sl_item->separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
/* Add it to the list */
- launcherList = g_list_insert_sorted(launcherList, ll, launcherList_sort);
+ serverList = g_list_insert_sorted (serverList, sl_item, serverList_sort);
/* Add it to the menu */
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(ll->menuitem), DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE);
- dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(ll->menuitem));
- GList * shortcuts = launcher_menu_item_get_items(ll->menuitem);
- while (shortcuts != NULL) {
- dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(shortcuts->data));
- shortcuts = g_list_next(shortcuts);
- }
- dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(ll->separator));
-
- /* If we've gotten eclipsed by something else, hide the item
- * and the separator. */
- if (launcher_menu_item_get_eclipsed(ll->menuitem)) {
- launcher_menu_item_set_eclipsed(ll->menuitem, TRUE);
- dbusmenu_menuitem_property_set_bool(ll->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- }
-
- /* Check to see if any of the current applications should
- be eclipsing us. */
- GList * server;
- for (server = serverList; server != NULL; server = g_list_next(server)) {
- serverList_t * slt = (serverList_t *)server->data;
- check_eclipses(slt->menuitem);
+ dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(sl_item->menuitem), DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE);
+ dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(sl_item->menuitem));
+ GList * shortcuts = app_menu_item_get_items(sl_item->menuitem);
+ GList * shortcut = shortcuts;
+ while (shortcut != NULL) {
+ dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(shortcut->data));
+ shortcut = g_list_next(shortcut);
}
+ g_list_free (shortcuts);
+ dbusmenu_menuitem_child_append(root_menuitem, DBUSMENU_MENUITEM(sl_item->separator));
resort_menu(root_menuitem);
- check_hidden();
}
g_object_unref (appinfo);
@@ -1005,7 +824,7 @@ build_launchers (gpointer data)
g_idle_add(build_launcher, g_strdup (*app));
}
- launcherList = g_list_sort(launcherList, launcherList_sort);
+ serverList = g_list_sort(serverList, serverList_sort);
g_strfreev (applications);
return FALSE;
diff --git a/test/Makefile.am b/test/Makefile.am
index 9206036..bb58ab2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -42,7 +42,6 @@ libindicator_messages_service_la_HEADERS = \
$(top_srcdir)/src/gen-messages-service.xml.h \
$(top_srcdir)/src/im-menu-item.h \
$(top_srcdir)/src/app-menu-item.h \
- $(top_srcdir)/src/launcher-menu-item.h \
$(top_srcdir)/src/dbus-data.h \
$(top_srcdir)/src/status-items.h
@@ -52,7 +51,6 @@ libindicator_messages_service_la_SOURCES = \
$(top_srcdir)/src/gen-messages-service.xml.c \
$(top_srcdir)/src/im-menu-item.c \
$(top_srcdir)/src/app-menu-item.c \
- $(top_srcdir)/src/launcher-menu-item.c \
$(top_srcdir)/src/status-items.c
libindicator_messages_service_ladir = \