printers: Make "Add…" button consistent with user accounts panel

The "Add..." toolbar button on the printers panel is currently hidden until the panel is unlocked.
This commit makes the button visible but insensitive when the panel is locked (becoming sensitive when unlocked),
as suggested in #1213. It also changes the text from "Add..." to "Add Printer..."
and updates the subtitle in the infobar to "Unlock to Add Printers and Change Settings."
These changes make the button's UI consistent with the Accounts panel's "Add User..." toolbar button.

Closes #1213
This commit is contained in:
Eric 2021-06-08 21:04:22 -04:00 committed by Felipe Borges
parent b61522b612
commit 1fc8b772a4
2 changed files with 5 additions and 3 deletions

View file

@ -995,7 +995,7 @@ update_sensitivity (gpointer user_data)
gtk_widget_set_visible (widget, !no_cups);
widget = (GtkWidget*) gtk_builder_get_object (self->builder, "printer-add-button");
gtk_widget_set_visible (widget, local_server && self->is_authorized && !no_cups && !self->new_printer_name);
gtk_widget_set_sensitive (widget, local_server && self->is_authorized && !no_cups && !self->new_printer_name);
widget = (GtkWidget*) gtk_builder_get_object (self->builder, "printer-add-button2");
gtk_widget_set_sensitive (widget, local_server && self->is_authorized && !no_cups && !self->new_printer_name);
@ -1273,6 +1273,8 @@ cc_printers_panel_init (CcPrintersPanel *self)
cc_permission_infobar_set_permission (self->permission_infobar,
self->permission);
cc_permission_infobar_set_title (self->permission_infobar,
_("Unlock to Add Printers and Change Settings"));
on_permission_changed (self);
}

View file

@ -7,9 +7,9 @@
<child>
<object class="GtkButton" id="printer-add-button">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="sensitive">False</property>
<property name="use_underline">True</property>
<property name="label" translatable="yes" comments="Translators: This button adds new printer.">Add…</property>
<property name="label" translatable="yes" comments="Translators: This button adds new printer.">Add Printer…</property>
<style>
<class name="suggested-action"/>
</style>