[gdm] Use an unlock button when the user is currently logged in



commit 706a532dffa717f25c4af9c0491c906cead1116c
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Jun 11 03:51:19 2010 -0400

    Use an unlock button when the user is currently logged in
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617194

 gui/simple-greeter/gdm-greeter-login-window.c  |   30 +++++++++++++++-
 gui/simple-greeter/gdm-greeter-login-window.ui |   44 +++++++++---------------
 2 files changed, 45 insertions(+), 29 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-greeter-login-window.c b/gui/simple-greeter/gdm-greeter-login-window.c
index 0342386..77ced21 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.c
+++ b/gui/simple-greeter/gdm-greeter-login-window.c
@@ -378,8 +378,36 @@ set_log_in_button_mode (GdmGreeterLoginWindow *login_window,
                         int                    mode)
 {
         GtkWidget *button;
+        GtkWidget *login_button;
+        GtkWidget *unlock_button;
+        char      *item;
+        gboolean   in_use;
+
+        in_use = FALSE;
+        item = gdm_chooser_widget_get_active_item (GDM_CHOOSER_WIDGET (login_window->priv->user_chooser));
+        if (item != NULL) {
+                gboolean res;
+
+                res = gdm_chooser_widget_lookup_item (GDM_CHOOSER_WIDGET (login_window->priv->user_chooser),
+                                                      item,
+                                                      NULL, /* image */
+                                                      NULL, /* name */
+                                                      NULL, /* comment */
+                                                      NULL, /* priority */
+                                                      &in_use,
+                                                      NULL); /* is separate */
+        }
+
+        unlock_button = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "unlock-button"));
+        login_button = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "log-in-button"));
 
-        button = GTK_WIDGET (gtk_builder_get_object (login_window->priv->builder, "log-in-button"));
+        if (in_use) {
+                gtk_widget_hide (login_button);
+                button = unlock_button;
+        } else {
+                gtk_widget_hide (unlock_button);
+                button = login_button;
+        }
         gtk_widget_grab_default (button);
 
         /* disconnect any signals */
diff --git a/gui/simple-greeter/gdm-greeter-login-window.ui b/gui/simple-greeter/gdm-greeter-login-window.ui
index 0bf02a9..9b1e5fc 100644
--- a/gui/simple-greeter/gdm-greeter-login-window.ui
+++ b/gui/simple-greeter/gdm-greeter-login-window.ui
@@ -236,49 +236,37 @@
                     <property name="layout_style">end</property>
                     <child>
                       <object class="GtkButton" id="cancel-button">
-                        <property name="label">gtk-cancel</property>
+                        <property name="label">Cancel</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_stock">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">4</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="unlock-button">
+                        <property name="label" translatable="yes">Unlock</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkButton" id="log-in-button">
+                        <property name="label" translatable="yes">Login</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="can_default">True</property>
                         <property name="has_default">True</property>
                         <property name="receives_default">False</property>
-                        <child>
-                          <object class="GtkHBox" id="hbox5">
-                            <property name="visible">True</property>
-                            <child>
-                              <object class="GtkImage" id="image1">
-                                <property name="visible">True</property>
-                                <property name="pixel_size">16</property>
-                              </object>
-                              <packing>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label1">
-                                <property name="visible">True</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Log In</property>
-                              </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>



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