[gnome-panel] menu-items: fix user switching with gdm
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] menu-items: fix user switching with gdm
- Date: Sat, 30 Jul 2016 09:35:40 +0000 (UTC)
commit 10b5fcf3a25b003069459339824d7ee667578961
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Jul 29 03:59:15 2016 +0300
menu-items: fix user switching with gdm
https://bugzilla.gnome.org/show_bug.cgi?id=769009
configure.ac | 1 +
gnome-panel/panel-menu-items.c | 35 ++++++++++-------------------------
2 files changed, 11 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e834850..7c17773 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,7 @@ PKG_CHECK_MODULES([PANEL], [
pango >= $PANGO_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
cairo-xlib
+ gdm
glib-2.0 >= $GLIB_REQUIRED
gmodule-2.0 >= $GLIB_REQUIRED
gio-2.0 >= $GLIB_REQUIRED
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 4c62b90..2dfec6f 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -46,6 +46,7 @@
#include <libpanel-util/panel-end-session-dialog.h>
#include <libpanel-util/panel-session-manager.h>
#include <libpanel-util/panel-show.h>
+#include <gdm/gdm-user-switching.h>
#include "menu.h"
#include "panel-action-button.h"
@@ -342,20 +343,20 @@ panel_menu_items_create_action_item (PanelActionButtonType action_type)
NULL, NULL, FALSE);
}
-#define GDM_FLEXISERVER_COMMAND "gdmflexiserver"
-#define GDM_FLEXISERVER_ARGS "--startnew"
-
static void
panel_menu_item_activate_switch_user (GtkWidget *menuitem,
gpointer user_data)
{
+ GError *error;
+
if (panel_lockdown_get_disable_switch_user_s ())
return;
+ error = NULL;
+
/* If running under LightDM switch to the greeter using dbus */
if (g_getenv("XDG_SEAT_PATH")) {
GDBusConnection *bus;
- GError *error = NULL;
GVariant *result = NULL;
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
@@ -382,29 +383,13 @@ panel_menu_item_activate_switch_user (GtkWidget *menuitem,
if (result)
g_variant_unref (result);
} else {
- GdkScreen *screen;
- GAppInfo *app_info;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (menuitem));
- app_info = g_app_info_create_from_commandline (GDM_FLEXISERVER_COMMAND " "
GDM_FLEXISERVER_ARGS,
- GDM_FLEXISERVER_COMMAND,
- G_APP_INFO_CREATE_NONE,
- NULL);
-
- if (app_info) {
- GdkAppLaunchContext *launch_context;
- GdkDisplay *display;
-
- display = gdk_screen_get_display (screen);
- launch_context = gdk_display_get_app_launch_context (display);
- gdk_app_launch_context_set_screen (launch_context, screen);
+ gboolean ret;
- g_app_info_launch (app_info, NULL,
- G_APP_LAUNCH_CONTEXT (launch_context),
- NULL);
+ ret = gdm_goto_login_session_sync (NULL, &error);
- g_object_unref (launch_context);
- g_object_unref (app_info);
+ if (!ret) {
+ g_warning ("Failed to switch to greeter: %s", error->message);
+ g_error_free (error);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]