printers: Make the printer address always sensitive

This patch individually updates the sensitivity of the
PpDetailsDialog child widgets, so we can leave the printer
address label always sensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=778682
This commit is contained in:
Felipe Borges 2017-02-15 15:54:12 +01:00
parent 86f131a1cb
commit 6bfc60b779
2 changed files with 13 additions and 2 deletions

View file

@ -149,7 +149,7 @@
</child> </child>
<child> <child>
<object class="GtkButtonBox"> <object class="GtkButtonBox" id="driver_buttons">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">10</property> <property name="spacing">10</property>
<property name="halign">start</property> <property name="halign">start</property>

View file

@ -47,6 +47,7 @@ struct _PpDetailsDialog {
GtkLabel *printer_model_label; GtkLabel *printer_model_label;
GtkStack *printer_model_stack; GtkStack *printer_model_stack;
GtkWidget *search_for_drivers_button; GtkWidget *search_for_drivers_button;
GtkWidget *driver_buttons;
gchar *printer_name; gchar *printer_name;
gchar *printer_location; gchar *printer_location;
@ -348,6 +349,15 @@ select_ppd_manually (GtkButton *button,
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
static void
update_sensitivity (PpDetailsDialog *self,
gboolean sensitive)
{
gtk_widget_set_sensitive (GTK_WIDGET (self->printer_name_entry), sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (self->printer_location_entry), sensitive);
gtk_widget_set_sensitive (GTK_WIDGET (self->driver_buttons), sensitive);
}
static void static void
pp_details_dialog_init (PpDetailsDialog *self) pp_details_dialog_init (PpDetailsDialog *self)
{ {
@ -367,6 +377,7 @@ pp_details_dialog_class_init (PpDetailsDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, printer_model_label); gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, printer_model_label);
gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, printer_model_stack); gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, printer_model_stack);
gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, search_for_drivers_button); gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, search_for_drivers_button);
gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, driver_buttons);
gtk_widget_class_bind_template_callback (widget_class, printer_name_edit_cb); gtk_widget_class_bind_template_callback (widget_class, printer_name_edit_cb);
gtk_widget_class_bind_template_callback (widget_class, printer_name_changed); gtk_widget_class_bind_template_callback (widget_class, printer_name_changed);
@ -409,7 +420,7 @@ pp_details_dialog_new (GtkWindow *parent,
gtk_entry_set_text (GTK_ENTRY (self->printer_location_entry), printer_location); gtk_entry_set_text (GTK_ENTRY (self->printer_location_entry), printer_location);
gtk_label_set_text (GTK_LABEL (self->printer_model_label), printer_make_and_model); gtk_label_set_text (GTK_LABEL (self->printer_model_label), printer_make_and_model);
gtk_widget_set_sensitive (gtk_dialog_get_content_area (GTK_DIALOG (self)), sensitive); update_sensitivity (self, sensitive);
return self; return self;
} }