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.
This commit is contained in:
Ondrej Holy 2020-05-05 09:16:25 +02:00 committed by Felipe Borges
parent 1a38a971ec
commit 502583fcc5
2 changed files with 2 additions and 22 deletions

View file

@ -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"),
"*",

View file

@ -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"/>