From e36a3654a04c5961bc3d55eec0f3488b2731931a Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Fri, 15 Jul 2016 13:04:51 +0200 Subject: [PATCH] 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 --- .../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 bbc0189b0..d808f5319 100644 --- a/panels/user-accounts/data/user-accounts-dialog.ui +++ b/panels/user-accounts/data/user-accounts-dialog.ui @@ -420,7 +420,7 @@ 1 Last Login True - last-login-value-label + last-login-button @@ -433,37 +433,18 @@ - + True - False + True + True + - + True - False - True - 0 + GTK_ALIGN_START - - 0 - 0 - 1 - 1 - - - - - _Account Activity - True - True - True - True - - - 1 - 0 - 1 - 1 - @@ -534,7 +515,7 @@ - + diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c index f9c322cd7..040882001 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) @@ -1554,26 +1553,6 @@ match_user (GtkTreeModel *model, return result; } -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) { @@ -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) {