[gnome-control-center] user-accounts: Drop "Account Activity" button



commit e36a3654a04c5961bc3d55eec0f3488b2731931a
Author: Felipe Borges <felipeborges gnome org>
Date:   Fri Jul 15 13:04:51 2016 +0200

    user-accounts: Drop "Account Activity" button
    
    Now the "Account Activity" dialog is launched by clicking in the
    "Last Login" option.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767065

 panels/user-accounts/data/user-accounts-dialog.ui |   39 +++++---------------
 panels/user-accounts/um-user-panel.c              |   32 +++--------------
 2 files changed, 15 insertions(+), 56 deletions(-)
---
diff --git a/panels/user-accounts/data/user-accounts-dialog.ui 
b/panels/user-accounts/data/user-accounts-dialog.ui
index bbc0189..d808f53 100644
--- a/panels/user-accounts/data/user-accounts-dialog.ui
+++ b/panels/user-accounts/data/user-accounts-dialog.ui
@@ -420,7 +420,7 @@
                             <property name="xalign">1</property>
                             <property name="label" translatable="yes">Last Login</property>
                             <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">last-login-value-label</property>
+                            <property name="mnemonic_widget">last-login-button</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
@@ -433,37 +433,18 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkGrid" id="last-login-grid">
+                          <object class="GtkButton" id="last-login-button">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkLabel" id="last-login-value-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="hexpand">True</property>
-                                <property name="xalign">0</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <style>
+                              <class name="text-button"/>
+                            </style>
                             <child>
-                              <object class="GtkButton" id="last-login-history-button">
-                                <property name="label" translatable="yes">_Account Activity</property>
+                              <object class="GtkLabel" id="last-login-button-label">
                                 <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="halign">GTK_ALIGN_START</property>
                               </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">1</property>
-                                <property name="height">1</property>
-                              </packing>
                             </child>
                           </object>
                           <packing>
@@ -534,7 +515,7 @@
       <widget name="account-type-box"/>
       <widget name="account-type-static"/>
       <widget name="autologin-box"/>
-      <widget name="last-login-grid"/>
+      <widget name="last-login-button"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup">
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index f9c322c..0408820 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -959,23 +959,22 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
         gtk_widget_set_visible (label, show);
 
         /* Last login: show when administrator or current user */
-        widget = get_widget (d, "last-login-value-label");
-        label = get_widget (d, "last-login-label");
+        widget = get_widget (d, "last-login-button");
+        label = get_widget (d, "last-login-button-label");
 
         current = act_user_manager_get_user_by_id (d->um, getuid ());
         show = act_user_get_uid (user) == getuid () ||
                act_user_get_account_type (current) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
         if (show) {
                 text = get_login_time_text (user);
-                gtk_label_set_text (GTK_LABEL (widget), text);
+                gtk_label_set_label (GTK_LABEL (label), text);
                 g_free (text);
         }
+        label = get_widget (d, "last-login-label");
         gtk_widget_set_visible (widget, show);
         gtk_widget_set_visible (label, show);
 
         enable = act_user_get_login_history (user) != NULL;
-        widget = get_widget (d, "last-login-history-button");
-        gtk_widget_set_visible (widget, show);
         gtk_widget_set_sensitive (widget, enable);
 
         if (d->permission != NULL)
@@ -1555,26 +1554,6 @@ match_user (GtkTreeModel *model,
 }
 
 static void
-update_padding (GtkWidget *button, GtkWidget *label)
-{
-        GtkStyleContext *context;
-        GtkStateFlags state;
-        GtkBorder padding, border;
-        gint offset;
-
-        context = gtk_widget_get_style_context (button);
-        state = gtk_style_context_get_state (context);
-
-        gtk_style_context_get_padding (context, state, &padding);
-        gtk_style_context_get_border (context, state, &border);
-
-        offset = padding.left + border.left;
-
-        gtk_widget_set_margin_start (label, offset);
-        gtk_widget_set_margin_end (label, offset);
-}
-
-static void
 setup_main_window (CcUserPanel *self)
 {
         CcUserPanelPrivate *d = self->priv;
@@ -1679,10 +1658,9 @@ setup_main_window (CcUserPanel *self)
         g_signal_connect (button, "clicked",
                           G_CALLBACK (change_fingerprint), d);
 
-        button = get_widget (d, "last-login-history-button");
+        button = get_widget (d, "last-login-button");
         g_signal_connect (button, "clicked",
                           G_CALLBACK (show_history), d);
-        g_signal_connect (button, "style-updated", G_CALLBACK (update_padding), get_widget (d, 
"last-login-value-label"));
 
         d->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL, 
&error);
         if (d->permission != NULL) {


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