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
This commit is contained in:
Felipe Borges 2016-07-15 13:04:51 +02:00
parent 1039642d93
commit e36a3654a0
2 changed files with 15 additions and 56 deletions

View file

@ -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">
<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>
<child>
<object class="GtkButton" id="last-login-history-button">
<property name="label" translatable="yes">_Account Activity</property>
<object class="GtkButton" id="last-login-button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<style>
<class name="text-button"/>
</style>
<child>
<object class="GtkLabel" id="last-login-button-label">
<property name="visible">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">

View file

@ -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) {