[gdm] Don't bother showing hostname if it's not unique



commit 03e01936f5c11580a1485c492355eb0a468ea0f6
Author: Ray Strode <rstrode redhat com>
Date:   Mon Oct 26 10:53:25 2009 -0400

    Don't bother showing hostname if it's not unique
    
    The advantage of showing hostname by default is it is a
    unique identifier for people who have multiple machines.
    
    If it only says "localhost" or "localhost.localdomain"
    that advantage is mitigated, and it's probably better to
    show OS release.

 gui/simple-greeter/gdm-greeter-login-window.c |   27 +++++++++++++++++++-----
 1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 9d75b8c..8de74df 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -887,10 +887,8 @@ on_user_unchosen (GdmUserChooserWidget  *user_chooser,
         do_cancel (login_window);
 }
 
-static gboolean
-on_computer_info_label_button_press (GtkWidget             *widget,
-                                     GdkEventButton        *event,
-                                     GdmGreeterLoginWindow *login_window)
+static void
+rotate_computer_info (GdmGreeterLoginWindow *login_window)
 {
         GtkWidget *notebook;
         int        current_page;
@@ -907,6 +905,14 @@ on_computer_info_label_button_press (GtkWidget             *widget,
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
         }
 
+}
+
+static gboolean
+on_computer_info_label_button_press (GtkWidget             *widget,
+                                     GdkEventButton        *event,
+                                     GdmGreeterLoginWindow *login_window)
+{
+        rotate_computer_info (login_window);
         return FALSE;
 }
 
@@ -996,11 +1002,20 @@ create_computer_info (GdmGreeterLoginWindow *login_window)
 
         label = glade_xml_get_widget (login_window->priv->xml, "computer-info-name-label");
         if (label != NULL) {
-                char localhost[HOST_NAME_MAX + 1] = "";â?¢
+                char localhost[HOST_NAME_MAX + 1] = "";
 
-                if (gethostname (localhost, HOST_NAME_MAX) == 0) {â?¢
+                if (gethostname (localhost, HOST_NAME_MAX) == 0) {
                         gtk_label_set_text (GTK_LABEL (label), localhost);
                 }
+
+                /* If this isn't actually unique identifier for the computer, then
+                 * don't bother showing it by default.
+                 */
+                if (strcmp (localhost, "localhost") == 0 ||
+                    strcmp (localhost, "localhost.localdomain") == 0) {
+
+                    rotate_computer_info (login_window);
+                }
         }
 
         label = glade_xml_get_widget (login_window->priv->xml, "computer-info-version-label");



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