summaryrefslogtreecommitdiffstats
path: root/src/ck-seat.c
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2008-02-12 22:30:05 -0500
committerWilliam Jon McCann <jmccann@redhat.com>2008-02-12 22:30:05 -0500
commit5ab3eee820e97d632aa9401cbd2d25dc828ee1f0 (patch)
treeca006a7e0d50871d01cc8a47ad48974ab6c41e91 /src/ck-seat.c
parent885708f75f493b85fb67114d112e950b6bfac652 (diff)
ck_seat_get_active_session shouldn't return a null ssid
Da bus no likey nulls for object paths. Return false and set error if there is no active session.
Diffstat (limited to 'src/ck-seat.c')
-rw-r--r--src/ck-seat.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/ck-seat.c b/src/ck-seat.c
index bc39010..8d93693 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -124,17 +124,37 @@ ck_seat_get_active_session (CkSeat *seat,
char **ssid,
GError **error)
{
+ gboolean ret;
+ char *session_id;
+
g_return_val_if_fail (CK_IS_SEAT (seat), FALSE);
+ g_debug ("CkSeat: get active session");
+ session_id = NULL;
+ ret = FALSE;
if (seat->priv->active_session != NULL) {
- ck_session_get_id (seat->priv->active_session, ssid, NULL);
+ gboolean res;
+ res = ck_session_get_id (seat->priv->active_session, &session_id, NULL);
+ if (res) {
+ ret = TRUE;
+ }
+ } else {
+ g_debug ("CkSeat: seat has no active session");
+ }
+
+ if (! ret) {
+ g_set_error (error,
+ CK_SEAT_ERROR,
+ CK_SEAT_ERROR_GENERAL,
+ "%s", "Seat has no active session");
} else {
if (ssid != NULL) {
- *ssid = NULL;
+ *ssid = g_strdup (session_id);
}
}
- return TRUE;
+ g_free (session_id);
+ return ret;
}
typedef struct