[gdm/gnome-2-30] Revert "Update duplicate real names to be unique"
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/gnome-2-30] Revert "Update duplicate real names to be unique"
- Date: Fri, 11 Jun 2010 01:50:03 +0000 (UTC)
commit f3b2e8e98af88cb31d0ec3ed086db82d38be484a
Author: William Jon McCann <jmccann redhat com>
Date: Mon Jun 7 21:28:23 2010 -0400
Revert "Update duplicate real names to be unique"
This reverts commit dfc66ca1f169c8b9f1c504f762b3d01605917a98.
From https://bugzilla.gnome.org/show_bug.cgi?id=549349
This is a very expensive change and one that I think can be done
in a better way. It doesn't make sense to me to have automatically
generated and changing display names. We want the user's display name
to be editable and discoverable using the user account settings tool.
There are already a few way to disambiguate the user identity. The first
is the name field. It can be changed to add a "(work)" label or whatever
the user wants. Another is the account icon. And lastly the tooltip over
the user list entry will show the username for the account.
https://bugzilla.gnome.org/show_bug.cgi?id=620908
gui/simple-greeter/gdm-user-chooser-widget.c | 2 +-
gui/simple-greeter/gdm-user-manager.c | 52 ++------------
gui/simple-greeter/gdm-user-private.h | 3 -
gui/simple-greeter/gdm-user.c | 101 --------------------------
gui/simple-greeter/gdm-user.h | 1 -
gui/user-switch-applet/applet.c | 4 +-
6 files changed, 10 insertions(+), 153 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
index c63c2ba..2ffd3f8 100644
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
@@ -395,7 +395,7 @@ add_user (GdmUserChooserWidget *widget,
gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
gdm_user_get_user_name (user),
pixbuf,
- gdm_user_get_display_name (user),
+ gdm_user_get_real_name (user),
tooltip,
gdm_user_get_login_frequency (user),
is_logged_in,
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index 949d7bd..74a5e4d 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -738,39 +738,11 @@ create_user (GdmUserManager *manager)
return user;
}
-static gint
-match_real_name_cmpfunc (gconstpointer a,
- gconstpointer b)
-{
- if (a == b)
- return -1;
-
- return g_strcmp0 (gdm_user_get_real_name ((GdmUser *) a),
- gdm_user_get_real_name ((GdmUser *) b));
-}
-
-static gboolean
-match_real_name_hrfunc (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- return (g_strcmp0 (user_data, gdm_user_get_real_name (value)) == 0);
-}
-
static void
add_user (GdmUserManager *manager,
GdmUser *user)
{
- GdmUser *dup;
-
add_sessions_for_user (manager, user);
- dup = g_hash_table_find (manager->priv->users,
- match_real_name_hrfunc,
- (char *) gdm_user_get_real_name (user));
- if (dup != NULL) {
- _gdm_user_show_full_display_name (user);
- _gdm_user_show_full_display_name (dup);
- }
g_hash_table_insert (manager->priv->users,
g_strdup (gdm_user_get_user_name (user)),
g_object_ref (user));
@@ -1424,7 +1396,6 @@ reload_passwd (GdmUserManager *manager)
GSList *old_users;
GSList *new_users;
GSList *list;
- GSList *dup;
FILE *fp;
old_users = NULL;
@@ -1444,7 +1415,6 @@ reload_passwd (GdmUserManager *manager)
for (list = old_users; list; list = list->next) {
if (gdm_user_get_num_sessions (list->data) > 0) {
g_object_freeze_notify (G_OBJECT (list->data));
- _gdm_user_show_short_display_name (list->data);
new_users = g_slist_prepend (new_users, g_object_ref (list->data));
}
}
@@ -1503,6 +1473,13 @@ reload_passwd (GdmUserManager *manager)
}
}
+ /* Go through and handle added users */
+ for (list = new_users; list; list = list->next) {
+ if (! g_slist_find (old_users, list->data)) {
+ add_user (manager, list->data);
+ }
+ }
+
/* Go through and handle removed users */
for (list = old_users; list; list = list->next) {
if (! g_slist_find (new_users, list->data)) {
@@ -1512,21 +1489,6 @@ reload_passwd (GdmUserManager *manager)
}
}
- /* Go through and handle added users or update display names */
- for (list = new_users; list; list = list->next) {
- if (g_slist_find (old_users, list->data)) {
- dup = g_slist_find_custom (new_users,
- list->data,
- match_real_name_cmpfunc);
- if (dup != NULL) {
- _gdm_user_show_full_display_name (list->data);
- _gdm_user_show_full_display_name (dup->data);
- }
- } else {
- add_user (manager, list->data);
- }
- }
-
add_included_users (manager);
out:
diff --git a/gui/simple-greeter/gdm-user-private.h b/gui/simple-greeter/gdm-user-private.h
index 79cdcf4..a765199 100644
--- a/gui/simple-greeter/gdm-user-private.h
+++ b/gui/simple-greeter/gdm-user-private.h
@@ -37,9 +37,6 @@ void _gdm_user_add_session (GdmUser *user,
void _gdm_user_remove_session (GdmUser *user,
const char *session_id);
-void _gdm_user_show_full_display_name (GdmUser *user);
-void _gdm_user_show_short_display_name (GdmUser *user);
-
G_END_DECLS
#endif /* !__GDM_USER_PRIVATE__ */
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index 35f4286..3fde99c 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/gdm-user.c
@@ -46,7 +46,6 @@ enum {
PROP_0,
PROP_MANAGER,
PROP_REAL_NAME,
- PROP_DISPLAY_NAME,
PROP_USER_NAME,
PROP_UID,
PROP_HOME_DIR,
@@ -67,7 +66,6 @@ struct _GdmUser {
uid_t uid;
char *user_name;
char *real_name;
- char *display_name;
char *home_dir;
char *shell;
GList *sessions;
@@ -203,9 +201,6 @@ gdm_user_get_property (GObject *object,
case PROP_REAL_NAME:
g_value_set_string (value, user->real_name);
break;
- case PROP_DISPLAY_NAME:
- g_value_set_string (value, user->display_name);
- break;
case PROP_HOME_DIR:
g_value_set_string (value, user->home_dir);
break;
@@ -253,14 +248,6 @@ gdm_user_class_init (GdmUserClass *class)
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
- PROP_DISPLAY_NAME,
- g_param_spec_string ("display-name",
- "Display Name",
- "The unique name to display for this user.",
- NULL,
- G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class,
PROP_UID,
g_param_spec_ulong ("uid",
"User ID",
@@ -314,7 +301,6 @@ gdm_user_init (GdmUser *user)
user->manager = NULL;
user->user_name = NULL;
user->real_name = NULL;
- user->display_name = NULL;
user->sessions = NULL;
}
@@ -327,7 +313,6 @@ gdm_user_finalize (GObject *object)
g_free (user->user_name);
g_free (user->real_name);
- g_free (user->display_name);
if (G_OBJECT_CLASS (gdm_user_parent_class)->finalize)
(*G_OBJECT_CLASS (gdm_user_parent_class)->finalize) (object);
@@ -396,16 +381,6 @@ _gdm_user_update (GdmUser *user,
g_free (real_name);
}
- /* Unique Display Name */
- if ((!user->real_name && user->display_name) ||
- (user->real_name &&
- user->display_name &&
- strncmp (user->real_name, user->display_name, strlen (user->real_name)) != 0)) {
- g_free (user->display_name);
- user->display_name = NULL;
- g_object_notify (G_OBJECT (user), "display-name");
- }
-
/* UID */
if (pwent->pw_uid != user->uid) {
user->uid = pwent->pw_uid;
@@ -486,26 +461,6 @@ gdm_user_get_real_name (GdmUser *user)
}
/**
- * gdm_user_get_display_name:
- * @user: the user object to examine.
- *
- * Retrieves the unique display name of @user.
- *
- * Returns: a pointer to an array of characters which must not be modified or
- * freed, or %NULL.
- *
- * Since: 1.0
- **/
-G_CONST_RETURN gchar *
-gdm_user_get_display_name (GdmUser *user)
-{
- g_return_val_if_fail (GDM_IS_USER (user), NULL);
-
- return (user->display_name ? user->display_name
- : gdm_user_get_real_name (user));
-}
-
-/**
* gdm_user_get_user_name:
* @user: the user object to examine.
*
@@ -573,62 +528,6 @@ gdm_user_get_login_frequency (GdmUser *user)
return user->login_frequency;
}
-/**
- * _gdm_user_show_full_display_name:
- * @user: the user object to examine.
- *
- * Updates the unique display name of @user to "Real Name (username)".
- *
- * Since: 1.0
- **/
-void
-_gdm_user_show_full_display_name (GdmUser *user)
-{
- char *uniq_name;
-
- g_return_if_fail (GDM_IS_USER (user));
-
- if (user->real_name != NULL) {
- uniq_name = g_strdup_printf ("%s (%s)",
- user->real_name,
- user->user_name);
- } else {
- uniq_name = NULL;
- }
-
- if ((user->real_name && !user->display_name) ||
- (!user->real_name && user->display_name) ||
- (user->real_name &&
- user->display_name &&
- strcmp (uniq_name, user->display_name) != 0)) {
- g_free (user->display_name);
- user->display_name = uniq_name;
- g_object_notify (G_OBJECT (user), "display-name");
- } else {
- g_free (uniq_name);
- }
-}
-
-/**
- * _gdm_user_show_short_display_name:
- * @user: the user object to examine.
- *
- * Resets the unique display name of @user.
- *
- * Since: 1.0
- **/
-void
-_gdm_user_show_short_display_name (GdmUser *user)
-{
- g_return_if_fail (GDM_IS_USER (user));
-
- if (user->display_name) {
- g_free (user->display_name);
- user->display_name = NULL;
- g_object_notify (G_OBJECT (user), "display-name");
- }
-}
-
int
gdm_user_collate (GdmUser *user1,
GdmUser *user2)
diff --git a/gui/simple-greeter/gdm-user.h b/gui/simple-greeter/gdm-user.h
index 9f153d9..5c72b2f 100644
--- a/gui/simple-greeter/gdm-user.h
+++ b/gui/simple-greeter/gdm-user.h
@@ -42,7 +42,6 @@ GType gdm_user_get_type (void) G_GNUC_CONST;
uid_t gdm_user_get_uid (GdmUser *user);
G_CONST_RETURN char *gdm_user_get_user_name (GdmUser *user);
G_CONST_RETURN char *gdm_user_get_real_name (GdmUser *user);
-G_CONST_RETURN char *gdm_user_get_display_name (GdmUser *user);
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);
diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
index 4fecf1c..f0c005f 100644
--- a/gui/user-switch-applet/applet.c
+++ b/gui/user-switch-applet/applet.c
@@ -985,11 +985,11 @@ update_label (GdmAppletData *adata)
#ifdef BUILD_PRESENSE_STUFF
markup = g_strdup_printf ("<b>%s</b> <small>(%s)</small>",
- gdm_user_get_display_name (GDM_USER (adata->user)),
+ gdm_user_get_real_name (GDM_USER (adata->user)),
_(statuses[adata->current_status].display_name));
#else
markup = g_strdup_printf ("<b>%s</b>",
- gdm_user_get_display_name (GDM_USER (adata->user)));
+ gdm_user_get_real_name (GDM_USER (adata->user)));
#endif
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]