[gnome-control-center/wip/oholy/no-users-fixes: 3/3] user-accounts: Move add user button tooltip in UI file



commit 79a0a33e34f1c2dfa5efe7cde834eeb5ea4eb7f1
Author: Ondrej Holy <oholy redhat com>
Date:   Tue May 5 09:16:25 2020 +0200

    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.

 panels/user-accounts/cc-user-panel.c  | 22 ----------------------
 panels/user-accounts/cc-user-panel.ui |  2 ++
 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"/>


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