aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indicator-session.c9
-rw-r--r--src/session-service.c28
2 files changed, 33 insertions, 4 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 55579b9..c21579a 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -36,6 +36,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator.h>
#include <libindicator/indicator-object.h>
#include <libindicator/indicator-service-manager.h>
+#include <libindicator/indicator-image-helper.h>
#include "dbus-shared-names.h"
#include "dbusmenu-shared.h"
@@ -112,7 +113,7 @@ indicator_session_init (IndicatorSession *self)
self->service = indicator_service_manager_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION);
g_signal_connect(G_OBJECT(self->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(service_connection_cb), self);
- self->status_image = GTK_IMAGE(gtk_image_new_from_icon_name(ICON_DEFAULT, GTK_ICON_SIZE_MENU));
+ self->status_image = indicator_image_helper(ICON_DEFAULT);
self->menu = dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT);
DbusmenuClient * client = DBUSMENU_CLIENT(dbusmenu_gtkmenu_get_client(self->menu));
@@ -176,7 +177,7 @@ icon_name_get_cb (DBusGProxy *proxy, char * OUT_name, GError *error, gpointer us
}
IndicatorSession * self = INDICATOR_SESSION(userdata);
- gtk_image_set_from_icon_name(self->status_image, OUT_name, GTK_ICON_SIZE_MENU);
+ indicator_image_helper_update(self->status_image, OUT_name);
return;
}
@@ -188,7 +189,7 @@ service_connection_cb (IndicatorServiceManager * sm, gboolean connected, gpointe
if (connected) {
org_ayatana_indicator_session_service_get_icon_async(self->service_proxy, icon_name_get_cb, user_data);
} else {
- gtk_image_set_from_icon_name(self->status_image, ICON_DEFAULT, GTK_ICON_SIZE_MENU);
+ indicator_image_helper_update(self->status_image, ICON_DEFAULT);
}
return;
@@ -204,7 +205,7 @@ static void
icon_changed (DBusGProxy * proxy, gchar * icon_name, gpointer user_data)
{
IndicatorSession * session = INDICATOR_SESSION(user_data);
- gtk_image_set_from_icon_name(session->status_image, icon_name, GTK_ICON_SIZE_MENU);
+ indicator_image_helper_update(session->status_image, icon_name);
return;
}
diff --git a/src/session-service.c b/src/session-service.c
index c4df661..fa90da2 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n.h>
#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-bindings.h>
@@ -51,6 +52,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define UP_OBJECT "/org/freedesktop/UPower"
#define UP_INTERFACE "org.freedesktop.UPower"
+#define DESKTOP_FILE "/usr/share/applications/indicator-session-extra.desktop"
+
#define GUEST_SESSION_LAUNCHER "/usr/share/gdm/guest-session/guest-session-launch"
#define LOCKDOWN_DIR "/desktop/gnome/lockdown"
@@ -417,6 +420,16 @@ compare_users_by_username (const gchar *a,
return retval;
}
+/* Take a desktop file and execute it */
+static void
+desktop_activate_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer data)
+{
+ GAppInfo * appinfo = G_APP_INFO(data);
+ g_return_if_fail(appinfo != NULL);
+ g_app_info_launch(appinfo, NULL, NULL, NULL);
+ return;
+}
+
/* Builds up the menu for us */
static void
rebuild_items (DbusmenuMenuitem *root,
@@ -582,6 +595,21 @@ rebuild_items (DbusmenuMenuitem *root,
update_menu_entries(restart_shutdown_logout_mi);
+ if (g_file_test(DESKTOP_FILE, G_FILE_TEST_EXISTS)) {
+ GAppInfo * appinfo = G_APP_INFO(g_desktop_app_info_new_from_filename(DESKTOP_FILE));
+
+ if (appinfo != NULL) {
+ DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_append(root, separator);
+
+ DbusmenuMenuitem * desktop_mi = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(desktop_mi, DBUSMENU_MENUITEM_PROP_LABEL, g_app_info_get_name(appinfo));
+ g_signal_connect(G_OBJECT(desktop_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(desktop_activate_cb), appinfo);
+ dbusmenu_menuitem_child_append(root, desktop_mi);
+ }
+ }
+
return;
}