diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-02-20 14:43:27 -0500 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2007-02-20 14:43:27 -0500 |
commit | ef89bbdb1be20fbca2a83037fcc922b444b7b513 (patch) | |
tree | b2e49cc8649d4ec9c7eda19e0b02292ca8a4044b | |
parent | 10a6532e35f4e40135006329a6975942ee896817 (diff) |
make the idle hint getters sync dbus methods
This makes it easier to use from C code. Also fix a bug where
we weren't emitting the argument in the idle-hint-changed signal.
-rw-r--r-- | src/ck-session.c | 23 | ||||
-rw-r--r-- | src/ck-session.h | 6 | ||||
-rw-r--r-- | src/ck-session.xml | 2 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/ck-session.c b/src/ck-session.c index 8696b57..bfcde83 100644 --- a/src/ck-session.c +++ b/src/ck-session.c @@ -219,12 +219,13 @@ session_set_idle_hint_internal (CkSession *session, { if (session->priv->idle_hint != idle_hint) { session->priv->idle_hint = idle_hint; + g_object_notify (G_OBJECT (session), "idle-hint"); /* FIXME: can we get a time from the dbus message? */ g_get_current_time (&session->priv->idle_since_hint); ck_debug ("Emitting idle-changed for session %s", session->priv->id); - g_signal_emit (session, signals [IDLE_HINT_CHANGED], 0); + g_signal_emit (session, signals [IDLE_HINT_CHANGED], 0, idle_hint); } return TRUE; @@ -287,18 +288,23 @@ ck_session_set_idle_hint (CkSession *session, } gboolean -ck_session_get_idle_hint (CkSession *session, - DBusGMethodInvocation *context) +ck_session_get_idle_hint (CkSession *session, + gboolean *idle_hint, + GError **error) { g_return_val_if_fail (CK_IS_SESSION (session), FALSE); - dbus_g_method_return (context, session->priv->idle_hint); + if (idle_hint != NULL) { + *idle_hint = session->priv->idle_hint; + } + return TRUE; } gboolean -ck_session_get_idle_since_hint (CkSession *session, - DBusGMethodInvocation *context) +ck_session_get_idle_since_hint (CkSession *session, + char **iso8601_datetime, + GError **error) { char *date_str; @@ -309,7 +315,10 @@ ck_session_get_idle_since_hint (CkSession *session, date_str = g_time_val_to_iso8601 (&session->priv->idle_since_hint); } - dbus_g_method_return (context, date_str); + if (iso8601_datetime != NULL) { + *iso8601_datetime = g_strdup (date_str); + } + g_free (date_str); return TRUE; diff --git a/src/ck-session.h b/src/ck-session.h index 6a33ac2..2486371 100644 --- a/src/ck-session.h +++ b/src/ck-session.h @@ -141,9 +141,11 @@ gboolean ck_session_get_creation_time (CkSession *sessi /* Non-authoritative properties */ gboolean ck_session_get_idle_hint (CkSession *session, - DBusGMethodInvocation *context); + gboolean *idle_hint, + GError **error); gboolean ck_session_get_idle_since_hint (CkSession *session, - DBusGMethodInvocation *context); + char **iso8601_datetime, + GError **error); gboolean ck_session_set_idle_hint (CkSession *session, gboolean idle_hint, DBusGMethodInvocation *context); diff --git a/src/ck-session.xml b/src/ck-session.xml index fa6213a..71ba983 100644 --- a/src/ck-session.xml +++ b/src/ck-session.xml @@ -45,11 +45,9 @@ </method> <method name="GetIdleHint"> - <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <arg name="idle_hint" type="b" direction="out"/> </method> <method name="GetIdleSinceHint"> - <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <arg name="iso8601_datetime" type="s" direction="out"/> </method> <method name="SetIdleHint"> |