[gdm/f14/master] Fix user switcher
Ray Strode
rstrode at fedoraproject.org
Tue Sep 7 21:11:46 UTC 2010
commit 4fc1ab9a723d1993d307923d4d6332ea465adf02
Author: Ray Strode <rstrode at redhat.com>
Date: Tue Sep 7 17:10:49 2010 -0400
Fix user switcher
Previously, it was showing "(null)" instead of the logged in user's
name because of fallout from the new async code.
fix-user-async-issue.patch | 226 ++++++++++++++++++++++++++++++++++++++++++++
gdm.spec | 5 +-
2 files changed, 230 insertions(+), 1 deletions(-)
---
diff --git a/fix-user-async-issue.patch b/fix-user-async-issue.patch
index d0aa054..627be69 100644
--- a/fix-user-async-issue.patch
+++ b/fix-user-async-issue.patch
@@ -518,3 +518,229 @@ index 9e3ae73..043928d 100644
--
1.7.2.2
+From 97b693497806e5436d832ba3a66c6810546d6478 Mon Sep 17 00:00:00 2001
+From: Ray Strode <rstrode at redhat.com>
+Date: Tue, 7 Sep 2010 17:04:51 -0400
+Subject: [PATCH 1/3] Fix gdm_user_manager_get_user
+
+Before it was assuming that as soon as a user was added, it would be
+in the hash table of loaded users. That's no longer true, now that
+the user is loaded asynchronously.
+---
+ gui/simple-greeter/gdm-user-manager.c | 14 ++++++++------
+ 1 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
+index 138fbb6..4382481 100644
+--- a/gui/simple-greeter/gdm-user-manager.c
++++ b/gui/simple-greeter/gdm-user-manager.c
+@@ -819,24 +819,27 @@ on_new_user_loaded (GdmUser *user,
+ }
+ }
+
+-static void
++static GdmUser *
+ add_new_user_for_object_path (const char *object_path,
+ GdmUserManager *manager)
+ {
+ GdmUser *user;
+
+- if (g_hash_table_lookup (manager->priv->users_by_object_path, object_path)) {
+- return;
++ user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
++
++ if (user != NULL) {
++ return user;
+ }
+ user = gdm_user_new_from_object_path (object_path);
+
+ if (user == NULL) {
+- return;
++ return NULL;
+ }
+
+ manager->priv->new_users = g_slist_prepend (manager->priv->new_users, user);
+
+ g_signal_connect (user, "notify::is-loaded", G_CALLBACK (on_new_user_loaded), manager);
++ return user;
+ }
+
+ static void
+@@ -1563,9 +1566,8 @@ gdm_user_manager_get_user (GdmUserManager *manager,
+ object_path = get_user_object_path_from_accounts_service (manager, username);
+
+ if (object_path != NULL) {
+- add_new_user_for_object_path (object_path, manager);
++ user = add_new_user_for_object_path (object_path, manager);
+ g_free (object_path);
+- user = g_hash_table_lookup (manager->priv->users_by_name, username);
+ }
+ } else {
+ struct passwd *pwent;
+--
+1.7.2.2
+
+
+From eec3d265a53167f411eec9769851bebfabee3d1b Mon Sep 17 00:00:00 2001
+From: Ray Strode <rstrode at redhat.com>
+Date: Tue, 7 Sep 2010 17:06:33 -0400
+Subject: [PATCH 2/3] Show menu after adding children
+
+This prevents a warning on the console
+---
+ gui/user-switch-applet/applet.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
+index a3e0881..66479fa 100644
+--- a/gui/user-switch-applet/applet.c
++++ b/gui/user-switch-applet/applet.c
+@@ -1062,7 +1062,6 @@ create_sub_menu (GdmAppletData *adata)
+ G_CALLBACK (menu_style_set_cb), adata);
+ g_signal_connect (adata->menu, "show",
+ G_CALLBACK (menu_expose_cb), adata);
+- gtk_widget_show (adata->menu);
+
+ #ifdef BUILD_PRESENSE_STUFF
+ adata->user_item = gdm_entry_menu_item_new ();
+@@ -1177,6 +1176,7 @@ create_sub_menu (GdmAppletData *adata)
+ g_signal_connect (adata->quit_session_item, "activate",
+ G_CALLBACK (on_quit_session_activate), adata);
+ gtk_widget_show (adata->quit_session_item);
++ gtk_widget_show (adata->menu);
+ }
+
+ static void
+--
+1.7.2.2
+
+
+From c9c1269681e102dc8a5778f52c38bc4c7ef69fdf Mon Sep 17 00:00:00 2001
+From: Ray Strode <rstrode at redhat.com>
+Date: Tue, 7 Sep 2010 17:07:43 -0400
+Subject: [PATCH 3/3] Don't try to read users real name until user loaded
+
+The user switcher puts the full name of the the currently
+loaded user on the panel. Now that the user is loaded
+asynchronously, we need to defer putting that name up until
+later in startup.
+---
+ gui/user-switch-applet/applet.c | 75 +++++++++++++++++++++++++++-----------
+ 1 files changed, 53 insertions(+), 22 deletions(-)
+
+diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
+index 66479fa..edb69e4 100644
+--- a/gui/user-switch-applet/applet.c
++++ b/gui/user-switch-applet/applet.c
+@@ -79,7 +79,8 @@ typedef struct _GdmAppletData
+ guint client_notify_lockdown_id;
+
+ guint current_status;
+- guint user_notify_id;
++ guint user_loaded_notify_id;
++ guint user_changed_notify_id;
+ gint8 pixel_size;
+ gint panel_size;
+ GtkIconSize icon_size;
+@@ -479,7 +480,13 @@ gdm_applet_data_free (GdmAppletData *adata)
+ {
+ gconf_client_notify_remove (adata->client, adata->client_notify_lockdown_id);
+
+- g_signal_handler_disconnect (adata->user, adata->user_notify_id);
++ if (adata->user_loaded_notify_id != 0) {
++ g_signal_handler_disconnect (adata->user, adata->user_changed_notify_id);
++ }
++
++ if (adata->user_changed_notify_id != 0) {
++ g_signal_handler_disconnect (adata->user, adata->user_changed_notify_id);
++ }
+
+ #ifdef BUILD_PRESENSE_STUFF
+ if (adata->presence_proxy != NULL) {
+@@ -1263,39 +1270,63 @@ reset_icon (GdmAppletData *adata)
+ }
+
+ static void
+-setup_current_user (GdmAppletData *adata)
++setup_current_user_now (GdmAppletData *adata)
++{
++ g_assert (adata->user != NULL);
++
++ g_signal_handler_disconnect (adata->user, adata->user_loaded_notify_id);
++ adata->user_loaded_notify_id = 0;
++
++ update_label (adata);
++ reset_icon (adata);
++ adata->user_changed_notify_id =
++ g_signal_connect (adata->user,
++ "changed",
++ G_CALLBACK (on_user_changed),
++ adata);
++}
++
++static void
++on_current_user_loaded (GdmUser *user,
++ GParamSpec *pspec,
++ GdmAppletData *adata)
+ {
+- const char *name;
+- GtkWidget *label;
++ if (!gdm_user_is_loaded (user)) {
++ return;
++ }
++
++ setup_current_user_now (adata);
++}
+
++static void
++setup_current_user (GdmAppletData *adata)
++{
+ adata->user = gdm_user_manager_get_user_by_uid (adata->manager, getuid ());
+- if (adata->user != NULL) {
+- g_object_ref (adata->user);
+- name = gdm_user_get_real_name (adata->user);
+- } else {
+- name = _("Unknown");
++
++ if (adata->user == NULL) {
++ g_warning ("Could not setup current user");
++ return;
+ }
+
+- adata->menuitem = gtk_image_menu_item_new_with_label (name);
++ g_object_ref (adata->user);
++
++ adata->menuitem = gtk_image_menu_item_new_with_label ("");
+ #ifndef BUILD_PRESENSE_STUFF
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (adata->menuitem),
+ gtk_image_new ());
+ #endif
+- label = gtk_bin_get_child (GTK_BIN (adata->menuitem));
+ gtk_menu_shell_append (GTK_MENU_SHELL (adata->menubar), adata->menuitem);
+ gtk_widget_show (adata->menuitem);
+
+- update_label (adata);
+-
+- if (adata->user != NULL) {
+- reset_icon (adata);
+-
+- adata->user_notify_id =
+- g_signal_connect (adata->user,
+- "changed",
+- G_CALLBACK (on_user_changed),
+- adata);
++ if (gdm_user_is_loaded (adata->user)) {
++ setup_current_user_now (adata);
++ return;
+ }
++
++ adata->user_loaded_notify_id = g_signal_connect (adata->user,
++ "notify::is-loaded",
++ G_CALLBACK (on_current_user_loaded),
++ adata);
+ }
+
+ #ifdef BUILD_PRESENSE_STUFF
+--
+1.7.2.2
+
diff --git a/gdm.spec b/gdm.spec
index 941fdea..d905722 100644
--- a/gdm.spec
+++ b/gdm.spec
@@ -15,7 +15,7 @@
Summary: The GNOME Display Manager
Name: gdm
Version: 2.31.90
-Release: 3%{?dist}
+Release: 4%{?dist}
Epoch: 1
License: GPLv2+
Group: User Interface/X
@@ -374,6 +374,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/ull || :
%{_libdir}/gdm/simple-greeter/plugins/fingerprint.so
%changelog
+* Tue Sep 07 2010 Ray Strode <rstrode at redhat.com> 2.31.90-4
+- Fix user switch name
+
* Tue Aug 31 2010 Ray Strode <rstrode at redhat.com> 2.31.90-3
- Fix icons in user list
More information about the scm-commits
mailing list