diff options
| author | William Jon McCann <mccann@jhu.edu> | 2007-02-20 12:07:29 -0500 | 
|---|---|---|
| committer | William Jon McCann <mccann@jhu.edu> | 2007-02-20 12:07:29 -0500 | 
| commit | 10a6532e35f4e40135006329a6975942ee896817 (patch) | |
| tree | 83eb9dfc65ad6e6f9ebe59a85d00d9150e54d143 | |
| parent | 7f7124d4f7583347043b271472e570614d975f35 (diff) | |
rename idle methods and signal to indicate they are hints
Rename GetIdle to GetIdleHint (etc) to make it clear that these
are not authoritative properties.
| -rw-r--r-- | src/ck-session.c | 62 | ||||
| -rw-r--r-- | src/ck-session.h | 24 | ||||
| -rw-r--r-- | src/ck-session.xml | 12 | ||||
| -rw-r--r-- | tools/list-sessions.c | 12 | 
4 files changed, 55 insertions, 55 deletions
diff --git a/src/ck-session.c b/src/ck-session.c index b028baa..8696b57 100644 --- a/src/ck-session.c +++ b/src/ck-session.c @@ -60,8 +60,8 @@ struct CkSessionPrivate          GTimeVal         creation_time; -        gboolean         idle; -        GTimeVal         idle_since; +        gboolean         idle_hint; +        GTimeVal         idle_since_hint;          DBusGConnection *connection;          DBusGProxy      *bus_proxy; @@ -72,7 +72,7 @@ enum {          LOCK,          UNLOCK,          ACTIVE_CHANGED, -        IDLE_CHANGED, +        IDLE_HINT_CHANGED,          LAST_SIGNAL  }; @@ -87,7 +87,7 @@ enum {          PROP_HOST_NAME,          PROP_IS_LOCAL,          PROP_ACTIVE, -        PROP_IDLE, +        PROP_IDLE_HINT,  };  static guint signals [LAST_SIGNAL] = { 0, }; @@ -214,17 +214,17 @@ out:  }  static gboolean -session_set_idle_internal (CkSession      *session, -                           gboolean        idle) +session_set_idle_hint_internal (CkSession      *session, +                                gboolean        idle_hint)  { -        if (session->priv->idle != idle) { -                session->priv->idle = idle; +        if (session->priv->idle_hint != idle_hint) { +                session->priv->idle_hint = idle_hint;                  /* FIXME: can we get a time from the dbus message? */ -                g_get_current_time (&session->priv->idle_since); +                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_CHANGED], 0); +                g_signal_emit (session, signals [IDLE_HINT_CHANGED], 0);          }          return TRUE; @@ -235,12 +235,12 @@ session_set_idle_internal (CkSession      *session,    dbus-send --system --dest=org.freedesktop.ConsoleKit \    --type=method_call --print-reply --reply-timeout=2000 \    /org/freedesktop/ConsoleKit/Session1 \ -  org.freedesktop.ConsoleKit.Session.SetIdle boolean:TRUE +  org.freedesktop.ConsoleKit.Session.SetIdleHint boolean:TRUE  */  gboolean -ck_session_set_idle (CkSession             *session, -                     gboolean               idle, -                     DBusGMethodInvocation *context) +ck_session_set_idle_hint (CkSession             *session, +                          gboolean               idle_hint, +                          DBusGMethodInvocation *context)  {          char       *sender;          uid_t       calling_uid; @@ -274,39 +274,39 @@ ck_session_set_idle (CkSession             *session,                  GError *error;                  error = g_error_new (CK_SESSION_ERROR,                                       CK_SESSION_ERROR_GENERAL, -                                     _("Only session owner may set idle state")); +                                     _("Only session owner may set idle hint state"));                  dbus_g_method_return_error (context, error);                  g_error_free (error);                  return FALSE;          } -        session_set_idle_internal (session, idle); +        session_set_idle_hint_internal (session, idle_hint);          dbus_g_method_return (context);          return TRUE;  }  gboolean -ck_session_get_idle (CkSession             *session, -                     DBusGMethodInvocation *context) +ck_session_get_idle_hint (CkSession             *session, +                          DBusGMethodInvocation *context)  {          g_return_val_if_fail (CK_IS_SESSION (session), FALSE); -        dbus_g_method_return (context, session->priv->idle); +        dbus_g_method_return (context, session->priv->idle_hint);          return TRUE;  }  gboolean -ck_session_get_idle_since (CkSession             *session, -                           DBusGMethodInvocation *context) +ck_session_get_idle_since_hint (CkSession             *session, +                                DBusGMethodInvocation *context)  {          char *date_str;          g_return_val_if_fail (CK_IS_SESSION (session), FALSE);          date_str = NULL; -        if (session->priv->idle) { -                date_str = g_time_val_to_iso8601 (&session->priv->idle_since); +        if (session->priv->idle_hint) { +                date_str = g_time_val_to_iso8601 (&session->priv->idle_since_hint);          }          dbus_g_method_return (context, date_str); @@ -654,8 +654,8 @@ ck_session_set_property (GObject            *object,          case PROP_HOST_NAME:                  ck_session_set_host_name (self, g_value_get_string (value), NULL);                  break; -        case PROP_IDLE: -                session_set_idle_internal (self, g_value_get_boolean (value)); +        case PROP_IDLE_HINT: +                session_set_idle_hint_internal (self, g_value_get_boolean (value));                  break;          default:                  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -701,8 +701,8 @@ ck_session_get_property (GObject    *object,          case PROP_HOST_NAME:                  g_value_set_string (value, self->priv->host_name);                  break; -        case PROP_IDLE: -                g_value_set_boolean (value, self->priv->idle); +        case PROP_IDLE_HINT: +                g_value_set_boolean (value, self->priv->idle_hint);                  break;          default:                  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -759,11 +759,11 @@ ck_session_class_init (CkSessionClass *klass)                                g_cclosure_marshal_VOID__VOID,                                G_TYPE_NONE,                                0); -        signals [IDLE_CHANGED] = -                g_signal_new ("idle-changed", +        signals [IDLE_HINT_CHANGED] = +                g_signal_new ("idle-hint-changed",                                G_TYPE_FROM_CLASS (object_class),                                G_SIGNAL_RUN_LAST, -                              G_STRUCT_OFFSET (CkSessionClass, idle_changed), +                              G_STRUCT_OFFSET (CkSessionClass, idle_hint_changed),                                NULL,                                NULL,                                g_cclosure_marshal_VOID__BOOLEAN, @@ -839,7 +839,7 @@ ck_session_class_init (CkSessionClass *klass)                                                              G_PARAM_READWRITE));          g_object_class_install_property (object_class,                                           PROP_ACTIVE, -                                         g_param_spec_boolean ("idle", +                                         g_param_spec_boolean ("idle-hint",                                                                 NULL,                                                                 NULL,                                                                 FALSE, diff --git a/src/ck-session.h b/src/ck-session.h index c0c1d22..6a33ac2 100644 --- a/src/ck-session.h +++ b/src/ck-session.h @@ -47,16 +47,16 @@ typedef struct          GObjectClass   parent_class;          /* internal signals */ -        void          (* activate)       (CkSession             *session, -                                          DBusGMethodInvocation *context); +        void          (* activate)          (CkSession             *session, +                                             DBusGMethodInvocation *context);          /* exported signals */ -        void          (* lock)           (CkSession *session); -        void          (* unlock)         (CkSession *session); -        void          (* active_changed) (CkSession *session, -                                          gboolean   active); -        void          (* idle_changed)   (CkSession *session, -                                          gboolean   idle); +        void          (* lock)              (CkSession *session); +        void          (* unlock)            (CkSession *session); +        void          (* active_changed)    (CkSession *session, +                                             gboolean   active); +        void          (* idle_hint_changed) (CkSession *session, +                                             gboolean   idle_hint);  } CkSessionClass;  typedef enum @@ -140,12 +140,12 @@ gboolean            ck_session_get_creation_time   (CkSession             *sessi                                                      GError               **error);  /* Non-authoritative properties */ -gboolean            ck_session_get_idle            (CkSession             *session, +gboolean            ck_session_get_idle_hint       (CkSession             *session,                                                      DBusGMethodInvocation *context); -gboolean            ck_session_get_idle_since      (CkSession             *session, +gboolean            ck_session_get_idle_since_hint (CkSession             *session,                                                      DBusGMethodInvocation *context); -gboolean            ck_session_set_idle            (CkSession             *session, -                                                    gboolean               idle, +gboolean            ck_session_set_idle_hint       (CkSession             *session, +                                                    gboolean               idle_hint,                                                      DBusGMethodInvocation *context);  /* Privileged actions */ diff --git a/src/ck-session.xml b/src/ck-session.xml index e1102fb..fa6213a 100644 --- a/src/ck-session.xml +++ b/src/ck-session.xml @@ -44,24 +44,24 @@        <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>      </method> -    <method name="GetIdle"> +    <method name="GetIdleHint">        <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="idle" type="b" direction="out"/> +      <arg name="idle_hint" type="b" direction="out"/>      </method> -    <method name="GetIdleSince"> +    <method name="GetIdleSinceHint">        <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>        <arg name="iso8601_datetime" type="s" direction="out"/>      </method> -    <method name="SetIdle"> +    <method name="SetIdleHint">        <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="idle" type="b" direction="in"/> +      <arg name="idle_hint" type="b" direction="in"/>      </method>      <signal name="ActiveChanged"/>      <signal name="Lock"/>      <signal name="Unlock"/> -    <signal name="IdleChanged"/> +    <signal name="IdleHintChanged"/>    </interface>  </node> diff --git a/tools/list-sessions.c b/tools/list-sessions.c index fd37cf3..6b2a593 100644 --- a/tools/list-sessions.c +++ b/tools/list-sessions.c @@ -168,7 +168,7 @@ list_session (DBusGConnection *connection,          char       *display_device;          char       *host_name;          char       *creation_time; -        char       *idle_since; +        char       *idle_since_hint;          gboolean    is_active;          gboolean    is_local;          char       *short_sid; @@ -187,7 +187,7 @@ list_session (DBusGConnection *connection,          xdisplay = NULL;          host_name = NULL;          creation_time = NULL; -        idle_since = NULL; +        idle_since_hint = NULL;          get_int (proxy, "GetUser", &uid);          get_path (proxy, "GetSeatId", &sid); @@ -198,7 +198,7 @@ list_session (DBusGConnection *connection,          get_boolean (proxy, "IsActive", &is_active);          get_boolean (proxy, "IsLocal", &is_local);          get_string (proxy, "GetCreationTime", &creation_time); -        get_string (proxy, "GetIdleSince", &idle_since); +        get_string (proxy, "GetIdleSinceHint", &idle_since_hint);          realname = get_real_name (uid); @@ -214,12 +214,12 @@ list_session (DBusGConnection *connection,          printf ("%s:\n\tuid = '%d'\n\trealname = '%s'\n\tseat = '%s'\n\tsession-type = '%s'\n\tactive = %s\n\tx11-display = '%s'\n\tdisplay-device = '%s'\n\thost-name = '%s'\n\tis-local = %s\n\ton-since = '%s'",                  short_ssid, uid, realname, short_sid, session_type, is_active ? "TRUE" : "FALSE", xdisplay, display_device, host_name, is_local ? "TRUE" : "FALSE", creation_time); -        if (idle_since != NULL && idle_since[0] != '\0') { -                printf ("\n\tidle-since = '%s'", idle_since); +        if (idle_since_hint != NULL && idle_since_hint[0] != '\0') { +                printf ("\n\tidle-since-hint = '%s'", idle_since_hint);          }          printf ("\n"); -        g_free (idle_since); +        g_free (idle_since_hint);          g_free (creation_time);          g_free (host_name);          g_free (realname);  | 
