[gdm] Ensure users-loaded signal is emitted
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] Ensure users-loaded signal is emitted
- Date: Tue, 8 Jun 2010 18:55:36 +0000 (UTC)
commit d131b965cb652ba1e37a7adaa8399080b09727ed
Author: William Jon McCann <jmccann redhat com>
Date: Mon Jun 7 20:00:59 2010 -0400
Ensure users-loaded signal is emitted
The users-loaded signal is used to indentify the point when it is acceptable
to call gdm_user_manager_list_users(). This signal normally
gets emitted after getting a list of frequently logged in users from ConsoleKit.
In the event the ConsoleKit daemon isn't available, however, the signal was
never getting emitted. This commit causes the signal to get emitted from those
cases as well.
https://bugzilla.gnome.org/show_bug.cgi?id=620908
gui/simple-greeter/gdm-user-manager.c | 44 +++++++++++++++++++++------------
1 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index c62aa07..be2888d 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -95,7 +95,7 @@ struct GdmUserManagerPrivate
GSList *include;
gboolean include_all;
- guint reload_id;
+ guint load_id;
guint ck_history_id;
guint8 users_dirty : 1;
@@ -1288,8 +1288,8 @@ ck_history_watch (GIOChannel *source,
return TRUE;
}
-static void
-reload_ck_history (GdmUserManager *manager)
+static gboolean
+load_ck_history (GdmUserManager *manager)
{
char *command;
const char *seat_id;
@@ -1299,6 +1299,10 @@ reload_ck_history (GdmUserManager *manager)
int standard_out;
GIOChannel *channel;
+ g_assert (manager->priv->ck_history_id == 0);
+
+ command = NULL;
+
seat_id = NULL;
if (manager->priv->seat_id != NULL
&& g_str_has_prefix (manager->priv->seat_id, "/org/freedesktop/ConsoleKit/")) {
@@ -1308,7 +1312,7 @@ reload_ck_history (GdmUserManager *manager)
if (seat_id == NULL) {
g_warning ("Unable to find users: no seat-id found");
- return;
+ goto out;
}
command = g_strdup_printf ("ck-history --frequent --seat='%s' --session-type=''",
@@ -1360,7 +1364,10 @@ reload_ck_history (GdmUserManager *manager)
g_io_channel_unref (channel);
out:
+
g_free (command);
+
+ return manager->priv->ck_history_id != 0;
}
static void
@@ -1518,30 +1525,35 @@ reload_passwd (GdmUserManager *manager)
}
static void
-reload_users (GdmUserManager *manager)
+load_users (GdmUserManager *manager)
{
- reload_ck_history (manager);
+ gboolean res;
+
+ res = load_ck_history (manager);
reload_passwd (manager);
+ if (! res) {
+ g_signal_emit (G_OBJECT (manager), signals[USERS_LOADED], 0);
+ }
}
static gboolean
-reload_users_timeout (GdmUserManager *manager)
+load_users_idle (GdmUserManager *manager)
{
- reload_users (manager);
- manager->priv->reload_id = 0;
+ load_users (manager);
+ manager->priv->load_id = 0;
return FALSE;
}
static void
-queue_reload_users (GdmUserManager *manager)
+queue_load_users (GdmUserManager *manager)
{
- if (manager->priv->reload_id > 0) {
+ if (manager->priv->load_id > 0) {
return;
}
g_signal_emit (G_OBJECT (manager), signals[LOADING_USERS], 0);
- manager->priv->reload_id = g_idle_add ((GSourceFunc)reload_users_timeout, manager);
+ manager->priv->load_id = g_idle_add ((GSourceFunc)load_users_idle, manager);
}
static void
@@ -1763,7 +1775,7 @@ gdm_user_manager_init (GdmUserManager *manager)
get_seat_proxy (manager);
- queue_reload_users (manager);
+ queue_load_users (manager);
manager->priv->users_dirty = FALSE;
}
@@ -1797,9 +1809,9 @@ gdm_user_manager_finalize (GObject *object)
manager->priv->ck_history_id = 0;
}
- if (manager->priv->reload_id > 0) {
- g_source_remove (manager->priv->reload_id);
- manager->priv->reload_id = 0;
+ if (manager->priv->load_id > 0) {
+ g_source_remove (manager->priv->load_id);
+ manager->priv->load_id = 0;
}
g_hash_table_destroy (manager->priv->sessions);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]