[gdm/gnome-2-30] Add new gdm_user_is_logged_in method



commit 26d50b6e9fd4db7b47733a80a5ab6be2cb283571
Author: Ray Strode <rstrode redhat com>
Date:   Thu Mar 11 09:07:21 2010 -0500

    Add new gdm_user_is_logged_in method
    
    Before we were doing
    
    if (gdm_user_get_num_sessions > 0)
    
    all over the place.  This is slightly
    more clear.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=610179

 gui/simple-greeter/gdm-user-chooser-widget.c |    4 ++--
 gui/simple-greeter/gdm-user.c                |    6 ++++++
 gui/simple-greeter/gdm-user.h                |    1 +
 3 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index 2ffd3f8..fe20a07 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -385,7 +385,7 @@ add_user (GdmUserChooserWidget *widget,
         tooltip = g_strdup_printf (_("Log in as %s"),
                                    gdm_user_get_user_name (user));
 
-        is_logged_in = gdm_user_get_num_sessions (user) > 0;
+        is_logged_in = gdm_user_is_logged_in (user);
 
         g_debug ("GdmUserChooserWidget: User added name:%s logged-in:%d pixbuf:%p",
                  gdm_user_get_user_name (user),
@@ -453,7 +453,7 @@ on_user_is_logged_in_changed (GdmUserManager       *manager,
         g_debug ("GdmUserChooserWidget: User logged in changed: %s", gdm_user_get_user_name (user));
 
         user_name = gdm_user_get_user_name (user);
-        is_logged_in = gdm_user_get_num_sessions (user) > 0;
+        is_logged_in = gdm_user_is_logged_in (user);
 
         gdm_chooser_widget_set_item_in_use (GDM_CHOOSER_WIDGET (widget),
                                             user_name,
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index 3fde99c..52a2a5f 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/gdm-user.c
@@ -856,6 +856,12 @@ frame_pixbuf (GdkPixbuf *source)
         return dest;
 }
 
+gboolean
+gdm_user_is_logged_in (GdmUser *user)
+{
+        return user->sessions != NULL;
+}
+
 GdkPixbuf *
 gdm_user_render_icon (GdmUser   *user,
                       gint       icon_size)
diff --git a/gui/simple-greeter/gdm-user.h b/gui/simple-greeter/gdm-user.h
index 5c72b2f..997b965 100644
--- a/gui/simple-greeter/gdm-user.h
+++ b/gui/simple-greeter/gdm-user.h
@@ -46,6 +46,7 @@ G_CONST_RETURN char  *gdm_user_get_home_directory  (GdmUser   *user);
 G_CONST_RETURN char  *gdm_user_get_shell           (GdmUser   *user);
 guint                 gdm_user_get_num_sessions    (GdmUser   *user);
 GList                *gdm_user_get_sessions        (GdmUser   *user);
+gboolean              gdm_user_is_logged_in        (GdmUser   *user);
 gulong                gdm_user_get_login_frequency (GdmUser   *user);
 
 GdkPixbuf            *gdm_user_render_icon         (GdmUser   *user,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]