aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/session-menu-mgr.c10
-rw-r--r--src/users-service-dbus.c52
2 files changed, 45 insertions, 17 deletions
diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c
index 697218f..427f274 100644
--- a/src/session-menu-mgr.c
+++ b/src/session-menu-mgr.c
@@ -775,6 +775,7 @@ user_menuitem_new (AccountsUser * user, SessionMenuMgr * mgr)
/* set the is-current-user property */
const gboolean is_current_user =
!g_strcmp0 (g_get_user_name(), accounts_user_get_user_name(user));
+
dbusmenu_menuitem_property_set_bool (mi,
USER_ITEM_PROP_IS_CURRENT_USER,
is_current_user);
@@ -1077,9 +1078,14 @@ static void
action_func_switch_to_user (AccountsUser * user)
{
SessionMenuMgr * mgr = user_get_mgr (user);
+
g_return_if_fail (mgr != NULL);
- action_func_lock (mgr);
- users_service_dbus_activate_user_session (mgr->users_dbus_facade, user);
+
+ if (g_strcmp0 (g_get_user_name(), accounts_user_get_user_name(user)) != 0)
+ {
+ action_func_lock (mgr);
+ users_service_dbus_activate_user_session (mgr->users_dbus_facade, user);
+ }
}
static void
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index fec17dc..f12f47c 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -927,11 +927,16 @@ users_service_dbus_get_user_list (UsersServiceDbus * self)
void
users_service_dbus_show_greeter (UsersServiceDbus * self)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -942,11 +947,16 @@ users_service_dbus_show_greeter (UsersServiceDbus * self)
void
users_service_dbus_activate_guest_session (UsersServiceDbus * self)
{
- g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
+ DisplayManagerSeat * dp;
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
- g_clear_object (&dp);
+ g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -958,12 +968,17 @@ void
users_service_dbus_activate_user_session (UsersServiceDbus * self,
AccountsUser * user)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- const char * const username = accounts_user_get_user_name (user);
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ const char * const username = accounts_user_get_user_name (user);
+ display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -974,11 +989,18 @@ users_service_dbus_activate_user_session (UsersServiceDbus * self,
gboolean
users_service_dbus_guest_session_enabled (UsersServiceDbus * self)
{
- g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
+ DisplayManagerSeat * dp;
+ gboolean enabled = FALSE;
+
+ g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), enabled);
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ enabled = display_manager_seat_get_has_guest_account (dp);
+ g_clear_object (&dp);
+ }
- DisplayManagerSeat * dp = create_display_proxy (self);
- const gboolean enabled = display_manager_seat_get_has_guest_account (dp);
- g_clear_object (&dp);
return enabled;
}