[gnome-control-center/wip/feborges/new-addprinter-dialog: 6/7] printers: Allow dismissing authentication in "Add New Printer" dialog



commit 5ea1ffe99ff3bf9dd7f7eb1c2e6c29779f8f8423
Author: Felipe Borges <felipeborges gnome org>
Date:   Sat Nov 12 18:04:18 2016 +0100

    printers: Allow dismissing authentication in "Add New Printer" dialog
    
    Introduce a "go-back" button allowing to get back to the list of
    printers when the user is exposed to the authentication form in
    the "Add New Printer" dialog.
    
    This is a redesign based on the newest mockups available at
    https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines

 panels/printers/new-printer-dialog.ui   |   35 ++++++++++++++++++++++++++----
 panels/printers/pp-new-printer-dialog.c |   13 +++++++++++
 2 files changed, 43 insertions(+), 5 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index 3bfa6e4..633c5fc 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -37,12 +37,37 @@
         <property name="visible">True</property>
         <property name="show-close-button">False</property>
         <child>
-          <object class="GtkButton" id="new-printer-cancel-button">
-            <property name="label" translatable="yes">_Cancel</property>
+          <object class="GtkStack" id="headerbar-topleft-buttons">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
+            <child>
+              <object class="GtkButton" id="new-printer-cancel-button">
+                <property name="label" translatable="yes">_Cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="name">addprinter-page</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="go-back-button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">start</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="icon-name">go-previous-symbolic</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="name">authentication-page</property>
+              </packing>
+            </child>
           </object>
         </child>
         <child>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 1aae7ab..14a01a7 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -341,6 +341,9 @@ go_to_page (PpNewPrinterDialog *dialog,
 
   stack = GTK_STACK (WID ("dialog-stack"));
   gtk_stack_set_visible_child_name (stack, page);
+
+  stack = GTK_STACK (WID ("headerbar-topleft-buttons"));
+  gtk_stack_set_visible_child_name (stack, page);
 }
 
 static gchar *
@@ -434,6 +437,15 @@ auth_entries_changed (GtkEditable *editable,
 }
 
 static void
+on_go_back_button_clicked (GtkButton *button,
+                           gpointer   user_data)
+{
+  PpNewPrinterDialog *dialog = PP_NEW_PRINTER_DIALOG (user_data);
+
+  go_to_page (dialog, ADDPRINTER_PAGE);
+}
+
+static void
 authenticate_samba_server (GtkButton *button,
                            gpointer   user_data)
 {
@@ -530,6 +542,7 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
   /* Authentication form widgets */
   g_signal_connect (WID ("username-entry"), "changed", G_CALLBACK (auth_entries_changed), dialog);
   g_signal_connect (WID ("password-entry"), "changed", G_CALLBACK (auth_entries_changed), dialog);
+  g_signal_connect (WID ("go-back-button"), "clicked", G_CALLBACK (on_go_back_button_clicked), dialog);
 
   /* Set junctions */
   widget = WID ("scrolledwindow1");


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