[gnome-control-center/introduce-cc-permission-infobar] user-accounts: Use CcPermissionInfobar to lock/unlock the panel
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/introduce-cc-permission-infobar] user-accounts: Use CcPermissionInfobar to lock/unlock the panel
- Date: Thu, 19 Dec 2019 15:13:03 +0000 (UTC)
commit 60cd800ef3446f4a2c5a072e3e2e9571f0180aa0
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Dec 19 15:51:38 2019 +0100
user-accounts: Use CcPermissionInfobar to lock/unlock the panel
This moves the GtkLockButton out of the headerbar and starts to
consume the CcPermissionInfobar API to lock/unlock the panel.
See #771
panels/user-accounts/cc-user-panel.c | 14 +++++++-------
panels/user-accounts/cc-user-panel.ui | 36 +++++++++++++++--------------------
2 files changed, 22 insertions(+), 28 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index 75b6340bc..157e1d492 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -52,6 +52,7 @@
#include "user-utils.h"
#include "cc-common-language.h"
+#include "cc-permission-infobar.h"
#include "cc-util.h"
#define USER_ACCOUNTS_PERMISSION "org.gnome.controlcenter.user-accounts.administration"
@@ -76,18 +77,17 @@ struct _CcUserPanel {
GtkButton *fingerprint_button;
GtkLabel *fingerprint_label;
GtkEntry *full_name_entry;
- GtkStack *headerbar_button_stack;
GtkButton *language_button;
GtkLabel *language_button_label;
GtkLabel *language_label;
GtkButton *last_login_button;
GtkLabel *last_login_button_label;
GtkLabel *last_login_label;
- GtkLockButton *lock_button;
GtkBox *no_users_box;
GtkRevealer *notification_revealer;
GtkButton *password_button;
GtkLabel *password_button_label;
+ CcPermissionInfobar *permission_infobar;
GtkButton *remove_user_button;
GtkStack *stack;
GtkToggleButton *user_icon_button;
@@ -1192,7 +1192,7 @@ on_permission_changed (CcUserPanel *self)
is_authorized = g_permission_get_allowed (G_PERMISSION (self->permission));
self_selected = act_user_get_uid (user) == geteuid ();
- gtk_stack_set_visible_child (self->headerbar_button_stack, is_authorized ? GTK_WIDGET
(self->add_user_button) : GTK_WIDGET (self->lock_button));
+ gtk_widget_set_visible (GTK_WIDGET (self->add_user_button), is_authorized);
gtk_widget_set_sensitive (GTK_WIDGET (self->add_user_button), is_authorized);
if (is_authorized) {
@@ -1383,9 +1383,9 @@ cc_user_panel_constructed (GObject *object)
G_OBJECT_CLASS (cc_user_panel_parent_class)->constructed (object);
shell = cc_panel_get_shell (CC_PANEL (self));
- cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->headerbar_button_stack), GTK_POS_RIGHT);
+ cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->add_user_button), GTK_POS_RIGHT);
- gtk_lock_button_set_permission (self->lock_button, self->permission);
+ cc_permission_infobar_set_permission (self->permission_infobar, self->permission);
}
static void
@@ -1399,6 +1399,7 @@ cc_user_panel_init (CcUserPanel *self)
/* register types that the builder might need */
type = cc_user_image_get_type ();
type = cc_carousel_get_type ();
+ type = cc_permission_infobar_get_type ();
gtk_widget_init_template (GTK_WIDGET (self));
@@ -1466,18 +1467,17 @@ cc_user_panel_class_init (CcUserPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, fingerprint_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, fingerprint_label);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, full_name_entry);
- gtk_widget_class_bind_template_child (widget_class, CcUserPanel, headerbar_button_stack);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, language_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, language_button_label);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, language_label);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, last_login_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, last_login_button_label);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, last_login_label);
- gtk_widget_class_bind_template_child (widget_class, CcUserPanel, lock_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, no_users_box);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, notification_revealer);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, password_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, password_button_label);
+ gtk_widget_class_bind_template_child (widget_class, CcUserPanel, permission_infobar);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, remove_user_button);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, stack);
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, user_icon_button);
diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui
index baa1eead2..8aa64cd72 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -1,26 +1,14 @@
<interface>
- <object class="GtkStack" id="headerbar_button_stack">
+ <object class="GtkButton" id="add_user_button">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkLockButton" id="lock_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="add_user_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Add User…</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="add_user" object="CcUserPanel" swapped="yes"/>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- </child>
- </object>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Add User…</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="add_user" object="CcUserPanel" swapped="yes"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
<object class="GtkListStore" id="shortname-model">
<columns>
<!-- column-name gchararray -->
@@ -98,6 +86,12 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="border_width">0</property>
+ <child>
+ <object class="CcPermissionInfobar" id="permission_infobar">
+ <property name="visible">True</property>
+ </object>
+ </child>
+
<child>
<object class="CcCarousel" id="carousel">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]