aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2009-09-23 23:30:48 -0500
committerCody Russell <crussell@canonical.com>2009-09-23 23:30:48 -0500
commit3427b4a7054aa66f1aaa20aed56ad445aecd5ec4 (patch)
treeb76705b7bfb88aa8cf3ba1cb42950b499f39f314 /src
parent2bb61203e78626f51bdbfbc8fb1440a046bab7be (diff)
downloadayatana-indicator-session-3427b4a7054aa66f1aaa20aed56ad445aecd5ec4.tar.gz
ayatana-indicator-session-3427b4a7054aa66f1aaa20aed56ad445aecd5ec4.tar.bz2
ayatana-indicator-session-3427b4a7054aa66f1aaa20aed56ad445aecd5ec4.zip
expose users_service_dbus_can_activate_session()
Diffstat (limited to 'src')
-rw-r--r--src/users-service-dbus.c61
-rw-r--r--src/users-service-dbus.h1
2 files changed, 36 insertions, 26 deletions
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);