[accounts-dialog/lockbutton: 4/4] Some rearrangement



commit 8ce3957bf37a0e314b70a6db6a53416d13d0abd0
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 29 08:34:29 2010 -0500

    Some rearrangement
    
    Don't show the user list in the login options screen, and move the
    login options and unlock buttons around. Also make the fingerprint
    wizard look less foreign.

 data/account-fingerprint.ui  |   23 ++--
 data/user-accounts-dialog.ui |  338 ++++++++++++++++++++++++------------------
 src/main.c                   |  249 +++++--------------------------
 src/um-fingerprint-dialog.c  |   53 ++++++--
 src/um-fingerprint-dialog.h  |    4 +-
 src/um-login-options.c       |    6 +-
 6 files changed, 295 insertions(+), 378 deletions(-)
---
diff --git a/data/account-fingerprint.ui b/data/account-fingerprint.ui
index 7a272a1..5f666f5 100644
--- a/data/account-fingerprint.ui
+++ b/data/account-fingerprint.ui
@@ -116,12 +116,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkHBox" id="hbox77">
+              <object class="GtkHBox" id="radiobutton3-hbox">
                 <property name="visible">True</property>
+                <property name="spacing">6</property>
                 <child>
                   <object class="GtkRadioButton" id="radiobutton3">
-                    <property name="label" translatable="yes">Other finger: </property>
                     <property name="visible">True</property>
+                    <property name="label" translatable="yes">Other finger: </property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
@@ -131,7 +132,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
@@ -148,7 +148,7 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="position">1</property>
+                    <property name="fill">False</property>
                   </packing>
                 </child>
               </object>
@@ -163,9 +163,6 @@
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="title" translatable="yes">Select finger</property>
-      </packing>
     </child>
     <child>
       <object class="GtkVBox" id="page2">
@@ -238,9 +235,6 @@
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="title">Swipe finger on reader</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel" id="page3">
@@ -250,8 +244,15 @@
       </object>
       <packing>
         <property name="page_type">summary</property>
-        <property name="title" translatable="yes">Done!</property>
       </packing>
     </child>
   </object>
+  <object class="GtkSizeGroup" id="sizegroup">
+    <property name="mode">both</property>
+    <widgets>
+      <widget name="radiobutton1"/>
+      <widget name="radiobutton2"/>
+      <widget name="radiobutton3-hbox"/>
+    </widgets>
+  </object>
 </interface>
diff --git a/data/user-accounts-dialog.ui b/data/user-accounts-dialog.ui
index bc926ca..610ccec 100644
--- a/data/user-accounts-dialog.ui
+++ b/data/user-accounts-dialog.ui
@@ -38,6 +38,14 @@
       <column type="gchararray"/>
     </columns>
   </object>
+  <object class="GtkImage" id="plus">
+    <property name="pixel_size">12</property>
+    <property name="icon_name">list-add</property>
+  </object>
+  <object class="GtkImage" id="minus">
+    <property name="pixel_size">12</property>
+    <property name="icon_name">list-remove</property>
+  </object>
   <object class="GtkWindow" id="user-account-window">
     <property name="border_width">10</property>
     <property name="title" translatable="yes">Account Information</property>
@@ -47,16 +55,16 @@
         <property name="visible">True</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkHBox" id="hbox1">
+          <object class="GtkNotebook" id="top-level-notebook">
             <property name="visible">True</property>
-            <property name="spacing">10</property>
+            <property name="show_tabs">False</property>
+            <property name="show_border">False</property>
             <child>
-              <object class="GtkVBox" id="vbox3">
+              <object class="GtkHBox" id="hbox2">
                 <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">10</property>
+                <property name="spacing">12</property>
                 <child>
-                  <object class="GtkVBox" id="vbox34">
+                  <object class="GtkVBox" id="userlist-vbox">
                     <property name="visible">True</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">2</property>
@@ -82,28 +90,31 @@
                     <child>
                       <object class="GtkHBox" id="add-delete-buttonbox">
                         <property name="visible">True</property>
-                        <property name="homogeneous">True</property>
                         <child>
                           <object class="GtkButton" id="add-user-button">
-                            <property name="label" translatable="yes">_Add</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
-                            <property name="use_underline">True</property>
+                            <property name="tooltip_text" translatable="yes">Create a user</property>
+                            <property name="image">plus</property>
                           </object>
                           <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="delete-user-button">
-                            <property name="label" translatable="yes">_Remove</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
-                            <property name="use_underline">True</property>
+                            <property name="tooltip_text" translatable="yes">Delte the selected user</property>
+                            <property name="image">minus</property>
                           </object>
                           <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -114,43 +125,18 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkToggleButton" id="login-options-button">
-                        <property name="label" translatable="yes">_Login Options</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
                   </object>
                   <packing>
                     <property name="position">0</property>
                   </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkNotebook" id="top-level-notebook">
-                <property name="visible">True</property>
-                <property name="show_tabs">False</property>
-                <property name="show_border">False</property>
                 <child>
                   <object class="GtkVBox" id="main-user-vbox">
                     <property name="visible">True</property>
-                    <property name="border_width">10</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkHBox" id="hbox2">
+                      <object class="GtkHBox" id="hbox3">
                         <property name="visible">True</property>
                         <child>
                           <object class="GtkTable" id="table1">
@@ -175,6 +161,9 @@
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -184,7 +173,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="hbox3">
+                              <object class="GtkHBox" id="hbox4">
                                 <child>
                                   <object class="GtkButton" id="button10">
                                     <property name="label" translatable="yes">Open</property>
@@ -728,156 +717,221 @@
                         <property name="position">0</property>
                       </packing>
                     </child>
-                  </object>
-                </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
-                <child>
-                  <object class="GtkVBox" id="main-login-window-vbox">
-                    <property name="visible">True</property>
-                    <property name="border_width">10</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkHBox" id="hbox6">
+                      <object class="GtkAlignment" id="alignment1">
                         <property name="visible">True</property>
-                        <property name="spacing">6</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">1</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
                         <child>
-                          <object class="GtkLabel" id="dm-automatic-login-label">
+                          <object class="GtkToggleButton" id="login-options-button">
+                            <property name="label" translatable="yes">_Login Options</property>
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Automatic Login:</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkComboBox" id="dm-automatic-login-combobox">
-                            <property name="visible">True</property>
-                            <child>
-                              <object class="GtkCellRendererText" id="renderer1"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_underline">True</property>
                           </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="dm-show-user-list-checkbutton">
-                        <property name="label" translatable="yes">Show list of users</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkVBox" id="main-login-window-vbox">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkHBox" id="hbox6">
+                    <property name="visible">True</property>
+                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkCheckButton" id="dm-show-power-buttons-checkbutton">
-                        <property name="label" translatable="yes">Show Shutdown, Suspend, and Restart actions</property>
+                      <object class="GtkLabel" id="dm-automatic-login-label">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Automatic Login:</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="dm-show-password-hints-checkbutton">
-                        <property name="label" translatable="yes">Show password hints</property>
+                      <object class="GtkComboBox" id="dm-automatic-login-combobox">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="renderer1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">3</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="dm-show-user-list-checkbutton">
+                    <property name="label" translatable="yes">Show list of users</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="dm-show-power-buttons-checkbutton">
+                    <property name="label" translatable="yes">Show Shutdown, Suspend, and Restart actions</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="dm-show-password-hints-checkbutton">
+                    <property name="label" translatable="yes">Show password hints</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0</property>
+                    <property name="label" translatable="yes">A guest account will allow anyone to temporarily log in to this computer without a password.  For security, remote logins to this account are not allowed.
+
+&lt;b&gt;When the guest user logs out, all files and data associated with the account will be deleted.&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                    <property name="wrap">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="dm-allow-guest-login-checkbutton">
+                    <property name="label" translatable="yes">Allow guests to log in to this computer</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
                     <child>
-                      <object class="GtkLabel" id="label1">
+                      <object class="GtkAlignment" id="lockbutton-alignment">
                         <property name="visible">True</property>
                         <property name="xalign">0</property>
-                        <property name="yalign">0</property>
-                        <property name="label" translatable="yes">A guest account will allow anyone to temporarily log in to this computer without a password.  For security, remote logins to this account are not allowed.
-
-&lt;b&gt;When the guest user logs out, all files and data associated with the account will be deleted.&lt;/b&gt;</property>
-                        <property name="use_markup">True</property>
-                        <property name="wrap">True</property>
+                        <property name="yalign">1</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </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="GtkCheckButton" id="dm-allow-guest-login-checkbutton">
-                        <property name="label" translatable="yes">Allow guests to log in to this computer</property>
+                      <object class="GtkAlignment" id="alignment2">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="xalign">1</property>
+                        <property name="yalign">1</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
+                        <child>
+                          <object class="GtkToggleButton" id="user-list-button">
+                            <property name="label" translatable="yes">_Login Options</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_underline">True</property>
+                            <property name="active">True</property>
+                          </object>
+                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">5</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                   <packing>
-                    <property name="position">2</property>
+                    <property name="position">6</property>
                   </packing>
                 </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child type="tab">
-                  <placeholder/>
-                </child>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child type="tab">
+              <placeholder/>
+            </child>
           </object>
           <packing>
             <property name="position">0</property>
diff --git a/src/main.c b/src/main.c
index 925b1a8..4bc5016 100644
--- a/src/main.c
+++ b/src/main.c
@@ -582,195 +582,6 @@ show_user (UmUser *user, UserAccountDialog *d)
         }
 }
 
-static void
-update_data_change_buttons (GObject           *source,
-                            GAsyncResult      *res,
-                            UserAccountDialog *d)
-{
-        GError *error;
-        PolkitAuthorizationResult *result;
-        gboolean is_authorized;
-
-        error = NULL;
-        is_authorized = FALSE;
-        result = polkit_authority_check_authorization_finish (d->authority,
-                                                              res,
-                                                              &error);
-        if (error) {
-                g_warning ("polkit check failed: %s", error->message);
-                g_error_free (error);
-        }
-        else {
-                if (polkit_authorization_result_get_is_authorized (result) ||
-                    polkit_authorization_result_get_is_challenge (result)) {
-                        is_authorized = TRUE;
-                }
-
-                g_object_unref (result);
-        }
-
-        if (is_authorized) {
-                gtk_widget_show (get_widget (d, "user-icon-button"));
-                gtk_widget_hide (get_widget (d, "user-icon-nonbutton"));
-
-        }
-        else {
-                gtk_widget_hide (get_widget (d, "user-icon-button"));
-                gtk_widget_show (get_widget (d, "user-icon-nonbutton"));
-        }
-}
-
-static void
-update_account_type_change_buttons (GObject           *source,
-                                    GAsyncResult      *res,
-                                    UserAccountDialog *d)
-{
-        GError *error;
-        PolkitAuthorizationResult *result;
-        gboolean is_authorized;
-        gboolean can_change_password;
-        UmUser *user;
-
-        error = NULL;
-        is_authorized = FALSE;
-        result = polkit_authority_check_authorization_finish (d->authority,
-                                                              res,
-                                                              &error);
-        if (error) {
-                g_warning ("polkit check failed: %s", error->message);
-                g_error_free (error);
-        }
-        else {
-                if (polkit_authorization_result_get_is_authorized (result) ||
-                    polkit_authorization_result_get_is_challenge (result)) {
-                        is_authorized = TRUE;
-                }
-
-                g_object_unref (result);
-        }
-
-        user = get_selected_user (d);
-        if (um_user_get_uid (user) == geteuid ()) {
-                can_change_password = TRUE;
-        }
-        else {
-                can_change_password = is_authorized;
-        }
-}
-
-static void
-update_change_buttons (UserAccountDialog *d, UmUser *u)
-{
-        const char *action;
-        PolkitSubject *subject;
-
-        if (um_user_get_uid (u) == geteuid ()) {
-                action = "org.freedesktop.accounts.change-own-user-data";
-        }
-        else {
-                action = "org.freedesktop.accounts.user-administration";
-        }
-
-        subject = polkit_unix_process_new (getpid ());
-
-        polkit_authority_check_authorization (d->authority,
-                                              subject,
-                                              action,
-                                              NULL,
-                                              0,
-                                              NULL,
-                                              (GAsyncReadyCallback)update_data_change_buttons,
-                                              d);
-        polkit_authority_check_authorization (d->authority,
-                                              subject,
-                                              "org.freedesktop.accounts.user-administration",
-                                              NULL,
-                                              0,
-                                              NULL,
-                                              (GAsyncReadyCallback)update_account_type_change_buttons,
-                                              d);
-        g_object_unref (subject);
-}
-
-static void
-update_create_buttons_cb (GObject           *source,
-                          GAsyncResult      *res,
-                          UserAccountDialog *d)
-{
-        GError *error;
-        PolkitAuthorizationResult *result;
-        gboolean is_authorized;
-        UmUser *user;
-
-        error = NULL;
-        is_authorized = FALSE;
-        result = polkit_authority_check_authorization_finish (d->authority,
-                                                              res,
-                                                              &error);
-        if (error) {
-                g_warning ("polkit check failed: %s", error->message);
-                g_error_free (error);
-        }
-        else {
-                if (polkit_authorization_result_get_is_authorized (result) ||
-                    polkit_authorization_result_get_is_challenge (result)) {
-                        is_authorized = TRUE;
-                }
-
-                g_object_unref (result);
-        }
-
-
-        if (is_authorized) {
-                gtk_widget_show (get_widget (d, "add-delete-buttonbox"));
-
-                user = get_selected_user (d);
-
-                if (user && um_user_get_uid (user) == getuid ()) {
-                        gtk_widget_set_sensitive (get_widget (d, "delete-user-button"), FALSE);
-                }
-                else {
-                        gtk_widget_set_sensitive (get_widget (d, "delete-user-button"), TRUE);
-                }
-        }
-        else {
-                gtk_widget_hide (get_widget (d, "add-delete-buttonbox"));
-        }
-}
-
-static void
-update_create_buttons (UserAccountDialog *d)
-{
-        PolkitSubject *subject;
-
-        subject = polkit_unix_process_new (getpid ());
-
-        polkit_authority_check_authorization (d->authority,
-                                              subject,
-                                              "org.freedesktop.accounts.user-administration",
-                                              NULL,
-                                              0,
-                                              NULL,
-                                              (GAsyncReadyCallback)update_create_buttons_cb,
-                                              d);
-
-        g_object_unref (subject);
-}
-
-static void
-authorizations_changed (PolkitAuthority *authority,
-                        gpointer         data)
-{
-        UserAccountDialog *d = data;
-        UmUser *user;
-
-        update_create_buttons (d);
-        user = get_selected_user (d);
-        if (user) {
-                update_change_buttons (d, user);
-        }
-}
-
 static void lockbutton_changed (PolkitLockButton *button, gpointer data);
 
 static void
@@ -787,8 +598,6 @@ selected_user_changed (GtkTreeSelection *selection, UserAccountDialog *d)
 
                 widget = get_widget (d, "login-options-button");
                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
-                update_create_buttons (d);
-
                 lockbutton_changed (POLKIT_LOCK_BUTTON (d->lock_button), d);
 
                 g_object_unref (user);
@@ -1159,11 +968,24 @@ change_fingerprint (GtkButton *button, UserAccountDialog *d)
 
         user = get_selected_user (d);
         g_assert (g_strcmp0 (g_get_user_name (), um_user_get_user_name (user)) == 0);
-        g_object_unref (user);
 
         label = get_widget (d, "account-fingerprint-value-label");
         label2 = get_widget (d, "account-fingerprint-button-label");
-        fingerprint_button_clicked (GTK_WINDOW (d->main_window), label, label2);
+        fingerprint_button_clicked (GTK_WINDOW (d->main_window), label, label2, user);
+        g_object_unref (user);
+}
+
+static void toggle_login_options (GtkButton *button, UserAccountDialog *d);
+
+static void
+toggle_user_list (GtkButton *button, UserAccountDialog *d)
+{
+        GtkWidget *widget;
+        gboolean active;
+
+        active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+        widget = get_widget (d, "login-options-button");
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
 }
 
 static void
@@ -1177,7 +999,6 @@ toggle_login_options (GtkButton *button, UserAccountDialog *d)
         GtkTreeIter iter;
 
         active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-
         widget = get_widget (d, "top-level-notebook");
         list = get_widget (d, "list-treeview");
         selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
@@ -1203,6 +1024,11 @@ toggle_login_options (GtkButton *button, UserAccountDialog *d)
                         } while (gtk_tree_model_iter_next (model, &iter));
                 }
         }
+
+        widget = get_widget (d, "user-list-button");
+        g_signal_handlers_block_by_func (widget, toggle_user_list, d);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
+        g_signal_handlers_unblock_by_func (widget, toggle_user_list, d);
 }
 
 static gint
@@ -1297,6 +1123,7 @@ lockbutton_changed (PolkitLockButton *button,
 {
         UserAccountDialog *d = data;
         gboolean is_authorized;
+        gboolean self_selected;
         UmUser *user;
 
         user = get_selected_user (d);
@@ -1304,23 +1131,26 @@ lockbutton_changed (PolkitLockButton *button,
                 return;
         }
 
-        if (um_user_get_uid (user) == geteuid ()) {
-                gtk_widget_hide (GTK_WIDGET (button));
-                is_authorized = TRUE;
+        is_authorized = polkit_lock_button_get_is_authorized (button);
+        self_selected = um_user_get_uid (user) == geteuid ();
+
+        gtk_widget_set_sensitive (get_widget (d, "add-user-button"), is_authorized);
+        gtk_widget_set_sensitive (get_widget (d, "delete-user-button"), is_authorized && !self_selected);
+
+        if (is_authorized) {
+                if (gtk_notebook_get_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook"))) == 0) {
+
+                        gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 1);
+                }
         }
         else {
-                gtk_widget_show (GTK_WIDGET (button));
-                is_authorized = polkit_lock_button_get_is_authorized (button);
+                gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 0);
         }
 
-        if (is_authorized) {
+        if (is_authorized || self_selected) {
                 gtk_widget_show (get_widget (d, "user-icon-button"));
                 gtk_widget_hide (get_widget (d, "user-icon-nonbutton"));
 
-                if (gtk_notebook_get_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook"))) == 0) {
-                        gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 1);
-                }
-
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "full-name-notebook")), 1);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 1);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 1);
@@ -1336,7 +1166,6 @@ lockbutton_changed (PolkitLockButton *button,
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-email-notebook")), 0);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-language-notebook")), 0);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-location-notebook")), 0);
-                gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-type-notebook")), 0);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-password-notebook")), 0);
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (get_widget (d, "account-fingerprint-notebook")), 0);
         }
@@ -1443,9 +1272,10 @@ setup_main_window (UserAccountDialog *d)
         g_signal_connect (button, "clicked", G_CALLBACK (delete_user), d);
 
         button = get_widget (d, "login-options-button");
-        g_signal_connect (button, "clicked", G_CALLBACK (toggle_login_options), d);
+        g_signal_connect (button, "toggled", G_CALLBACK (toggle_login_options), d);
 
-        update_create_buttons (d);
+        button = get_widget (d, "user-list-button");
+        g_signal_connect (button, "toggled", G_CALLBACK (toggle_user_list), d);
 
         button = get_widget (d, "full-name-button");
         g_signal_connect (button, "clicked", G_CALLBACK (change_name), d);
@@ -1487,13 +1317,12 @@ setup_main_window (UserAccountDialog *d)
 
         button = polkit_lock_button_new ("org.freedesktop.accounts.user-administration");
         gtk_widget_show (button);
-        box = get_widget (d, "main-user-vbox");
+        box = get_widget (d, "userlist-vbox");
         gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
         g_signal_connect (button, "changed",
                           G_CALLBACK (lockbutton_changed), d);
         lockbutton_changed (POLKIT_LOCK_BUTTON (button), d);
         d->lock_button = button;
-
 }
 
 static void
@@ -1596,8 +1425,6 @@ main (int argc, char *argv[])
         }
 
         d->authority = polkit_authority_get ();
-        g_signal_connect (d->authority, "changed",
-                          G_CALLBACK (authorizations_changed), d);
 
         setup_main_window (d);
         d->login_options = um_login_options_new (d->builder);
diff --git a/src/um-fingerprint-dialog.c b/src/um-fingerprint-dialog.c
index e8996b7..0884a18 100644
--- a/src/um-fingerprint-dialog.c
+++ b/src/um-fingerprint-dialog.c
@@ -208,7 +208,8 @@ delete_fingerprints (void)
 static void
 delete_fingerprints_question (GtkWindow *parent,
                               GtkWidget *label1,
-                              GtkWidget *label2)
+                              GtkWidget *label2,
+                              UmUser    *user)
 {
         GtkWidget *question;
         GtkWidget *button;
@@ -484,9 +485,25 @@ assistant_prepare (GtkAssistant *ass, GtkWidget *page, EnrollData *data)
 }
 
 static void
+align_image (GtkWidget *child, gpointer data)
+{
+        if (GTK_IS_IMAGE (child)) {
+                gtk_misc_set_alignment (GTK_MISC (child), 0, 0.5);
+                gtk_misc_set_padding (GTK_MISC (child), 10, 10);
+        }
+
+        if (GTK_IS_LABEL (child)) {
+                gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
+                gtk_widget_modify_font (child, NULL);
+                gtk_misc_set_padding (GTK_MISC (child), 68, 10);
+        }
+}
+
+static void
 enroll_fingerprints (GtkWindow *parent,
                      GtkWidget *label1,
-                     GtkWidget *label2)
+                     GtkWidget *label2,
+                     UmUser    *user)
 {
         DBusGProxy *device, *p;
         GHashTable *props;
@@ -496,6 +513,8 @@ enroll_fingerprints (GtkWindow *parent,
         const char *filename;
         char *msg;
         GError *error = NULL;
+        GdkPixbuf *pixbuf;
+        gchar *title;
 
         device = NULL;
 
@@ -552,6 +571,11 @@ enroll_fingerprints (GtkWindow *parent,
         gtk_window_set_transient_for (GTK_WINDOW (ass), parent);
         gtk_window_set_modal (GTK_WINDOW (ass), TRUE);
         gtk_window_set_position (GTK_WINDOW (ass), GTK_WIN_POS_CENTER_ON_PARENT);
+
+        gtk_widget_realize (ass);
+        gtk_widget_modify_fg (ass, GTK_STATE_SELECTED, &ass->style->fg[GTK_STATE_NORMAL]);
+        gtk_widget_modify_bg (ass, GTK_STATE_SELECTED, &ass->style->bg[GTK_STATE_NORMAL]);
+
         g_signal_connect (G_OBJECT (ass), "cancel",
                           G_CALLBACK (assistant_cancelled), data);
         g_signal_connect (G_OBJECT (ass), "close",
@@ -586,12 +610,20 @@ enroll_fingerprints (GtkWindow *parent,
 
         gtk_assistant_set_page_complete (GTK_ASSISTANT (ass), WID("page1"), TRUE);
 
-        /* Page 2 */
-        if (data->is_swipe != FALSE)
-                gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page2"), _("Swipe finger on reader"));
-        else
-                gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page2"), _("Place finger on reader"));
+        pixbuf = um_user_render_icon (user, FALSE, 48);
+        title = g_strdup_printf (_("Enrolling fingerprints for\n<b><big>%s</big></b>"), um_user_get_real_name (user));
+
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (ass), WID("page1"), pixbuf);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page1"), title);
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (ass), WID("page2"), pixbuf);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page2"), title);
+        gtk_assistant_set_page_header_image (GTK_ASSISTANT (ass), WID("page3"), pixbuf);
+        gtk_assistant_set_page_title (GTK_ASSISTANT (ass), WID("page3"), title);
+        gtk_container_forall (GTK_CONTAINER (ass), align_image, NULL);
+        g_object_unref (pixbuf);
+        g_free (title);
 
+        /* Page 2 */
         g_object_set_data (G_OBJECT (WID("page2")), "name", "enroll");
 
         msg = g_strdup_printf (finger_str_to_msg (data->finger, data->is_swipe), data->name);
@@ -608,12 +640,13 @@ enroll_fingerprints (GtkWindow *parent,
 void
 fingerprint_button_clicked (GtkWindow *parent,
                             GtkWidget *label1,
-                            GtkWidget *label2)
+                            GtkWidget *label2,
+                            UmUser    *user)
 {
         if (is_disable != FALSE) {
-                delete_fingerprints_question (parent, label1, label2);
+                delete_fingerprints_question (parent, label1, label2, user);
         } else {
-                enroll_fingerprints (parent, label1, label2);
+                enroll_fingerprints (parent, label1, label2, user);
         }
 }
 
diff --git a/src/um-fingerprint-dialog.h b/src/um-fingerprint-dialog.h
index c50ff34..cca4b58 100644
--- a/src/um-fingerprint-dialog.h
+++ b/src/um-fingerprint-dialog.h
@@ -18,9 +18,11 @@
  */
 
 #include <gtk/gtk.h>
+#include "um-user.h"
 
 gboolean set_fingerprint_label (GtkWidget *label1,
                                 GtkWidget *label2);
 void fingerprint_button_clicked (GtkWindow *parent,
                                  GtkWidget *label1,
-                                 GtkWidget *label2);
+                                 GtkWidget *label2,
+                                 UmUser    *user);
diff --git a/src/um-login-options.c b/src/um-login-options.c
index 846ace7..fed89d6 100644
--- a/src/um-login-options.c
+++ b/src/um-login-options.c
@@ -387,12 +387,12 @@ um_login_options_new (GtkBuilder *builder)
 
         widget = polkit_lock_button_new ("org.freedesktop.accounts.set-login-option");
         gtk_widget_show (widget);
-        box = (GtkWidget *)gtk_builder_get_object (builder, "main-login-window-vbox");
-        gtk_box_pack_end (GTK_BOX (box), widget, FALSE, FALSE, 0);
+        box = (GtkWidget *)gtk_builder_get_object (builder, "lockbutton-alignment");
+        gtk_container_add (GTK_CONTAINER (box), widget);
         g_signal_connect (widget, "changed",
                           G_CALLBACK (lockbutton_changed), um);
         lockbutton_changed (POLKIT_LOCK_BUTTON (widget), um);
-	um->lock_button = widget;
+        um->lock_button = widget;
 
         error = NULL;
         um->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);



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