[gnome-control-center] cc-printers-panel: don't show two Add Printer buttons at once



commit a71c3ac3c329c8026dc9642241ebf5525c4f5ce3
Author: Eric Daigle <8319652+edaigle users noreply github com>
Date:   Wed Aug 10 16:03:30 2022 -0700

    cc-printers-panel: don't show two Add Printer buttons at once
    
    As described in #1976, the printers panel shows two Add Printer buttons when the
    printers list is empty. Adds a check that sets the Add Printer button in the toolbar
    to be invisible when the empty-state page is shown (and thus the other Add Printer
    button is visible), creating a less confusing UI.
    
    Closes #1976

 panels/printers/cc-printers-panel.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 4337633f1..1749358af 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -987,6 +987,7 @@ update_sensitivity (gpointer user_data)
   GtkWidget               *widget;
   gboolean                 local_server = TRUE;
   gboolean                 no_cups = FALSE;
+  gboolean                 empty_state = FALSE;
 
   self->is_authorized =
     self->permission &&
@@ -997,6 +998,8 @@ update_sensitivity (gpointer user_data)
   widget = (GtkWidget*) gtk_builder_get_object (self->builder, "main-vbox");
   if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (widget)), "no-cups-page") == 0)
     no_cups = TRUE;
+  else if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (widget)), "empty-state") == 0)
+    empty_state = TRUE;
 
   cups_server = cupsServer ();
   if (cups_server &&
@@ -1013,6 +1016,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, !empty_state);
   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");


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