From 3427b4a7054aa66f1aaa20aed56ad445aecd5ec4 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Wed, 23 Sep 2009 23:30:48 -0500 Subject: expose users_service_dbus_can_activate_session() --- src/users-service-dbus.c | 61 +++++++++++++++++++++++++++--------------------- src/users-service-dbus.h | 1 + 2 files changed, 36 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 96f5cd5..6051e4e 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -447,33 +447,9 @@ static gchar * get_session_for_user (UsersServiceDbus *service, UserData *user) { - UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service); - gboolean can_activate; - GError *error = NULL; - GList *l; - - if (!priv->seat_proxy) - create_seat_proxy (service); - - if (priv->seat == NULL || priv->seat[0] == '\0') - { - return NULL; - } - - if (!dbus_g_proxy_call (priv->seat_proxy, - "CanActivateSessions", - &error, - G_TYPE_INVALID, - G_TYPE_BOOLEAN, &can_activate, - G_TYPE_INVALID)) - { - g_warning ("Failed to determine if seat can activate sessions: %s", error->message); - g_error_free (error); - - return NULL; - } + GList *l; - if (!can_activate) + if (!users_service_dbus_can_activate_session (service)) { return NULL; } @@ -1095,3 +1071,36 @@ users_service_dbus_activate_user_session (UsersServiceDbus *self, return TRUE; } + +gboolean +users_service_dbus_can_activate_session (UsersServiceDbus *self) +{ + UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + gboolean can_activate = FALSE; + GError *error = NULL; + + if (!priv->seat_proxy) + { + create_seat_proxy (self); + } + + if (!priv->seat || priv->seat[0] == '\0') + { + return FALSE; + } + + if (!dbus_g_proxy_call (priv->seat_proxy, + "CanActivateSessions", + &error, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &can_activate, + G_TYPE_INVALID)) + { + g_warning ("Failed to determine if seat can activate sessions: %s", error->message); + g_error_free (error); + + return FALSE; + } + + return can_activate; +} diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index 95db35d..e156520 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -72,6 +72,7 @@ GType users_service_dbus_get_type (void) G_GNUC_CONST; gint users_service_dbus_get_user_count (UsersServiceDbus *self); GList *users_service_dbus_get_user_list (UsersServiceDbus *self); +gboolean users_service_dbus_can_activate_session (UsersServiceDbus *self); gboolean users_service_dbus_activate_user_session (UsersServiceDbus *self, UserData *user); -- cgit v1.2.3