summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2020-05-05 09:16:25 +0200
committerFelipe Borges <felipeborges@gnome.org>2020-05-05 09:25:41 +0000
commit502583fcc56496e8d3c06d6334e554583bc76b9a (patch)
treef147053ba6fd2a9ce6d9df7ccb32b33a0f429816
parent1a38a971ec93bb6a36d57bea963dbf89b02e0877 (diff)
downloadgnome-control-center-502583fcc56496e8d3c06d6334e554583bc76b9a.tar.gz
user-accounts: Move add user button tooltip in UI file
The add user button is shown only if the panel is unlocked, but tooltips are also set for the case when the panel is not unlocked. Let's move the tooltip text in the UI file directly and remove the obsolete codes.
-rw-r--r--panels/user-accounts/cc-user-panel.c22
-rw-r--r--panels/user-accounts/cc-user-panel.ui2
2 files changed, 2 insertions, 22 deletions
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index a2593cceb..1a9fd9bda 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -1231,24 +1231,6 @@ on_permission_changed (CcUserPanel *self)
is_authorized = g_permission_get_allowed (G_PERMISSION (self->permission));
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) {
- setup_tooltip_with_embedded_icon (GTK_WIDGET (self->add_user_button), _("Create a user account"), NULL, NULL);
- }
- else {
- gchar *names[3];
- GIcon *icon;
-
- names[0] = "changes-allow-symbolic";
- names[1] = "changes-allow";
- names[2] = NULL;
- icon = (GIcon *)g_themed_icon_new_from_names (names, -1);
- setup_tooltip_with_embedded_icon (GTK_WIDGET (self->add_user_button),
- _("To create a user account,\nclick the * icon first"),
- "*",
- icon);
- g_object_unref (icon);
- }
user = get_selected_user (self);
if (!user) {
@@ -1377,10 +1359,6 @@ setup_main_window (CcUserPanel *self)
names[1] = "changes-allow";
names[2] = NULL;
icon = (GIcon *)g_themed_icon_new_from_names (names, -1);
- setup_tooltip_with_embedded_icon (GTK_WIDGET (self->add_user_button),
- _("To create a user account,\nclick the * icon first"),
- "*",
- icon);
setup_tooltip_with_embedded_icon (GTK_WIDGET (self->remove_user_button),
_("To delete the selected user account,\nclick the * icon first"),
"*",
diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui
index 2352ca31a..07a2b3d5d 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -4,6 +4,8 @@
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Add User…</property>
<property name="use_underline">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip_text" translatable="yes">Create a user account</property>
<signal name="clicked" handler="add_user" object="CcUserPanel" swapped="yes"/>
<style>
<class name="suggested-action"/>