[gnome-control-center] printers: Move "Add Printer" dialog buttons to header bar
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Move "Add Printer" dialog buttons to header bar
- Date: Thu, 22 Sep 2016 09:37:21 +0000 (UTC)
commit 8f57e4dfc77e3a191ec34fea5bc549b11c7d4df7
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Sep 2 13:02:22 2016 +0200
printers: Move "Add Printer" dialog buttons to header bar
It also renames the "Authenticate" button to "Unlock".
This is a redesign based on the newest mockups available at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines
https://bugzilla.gnome.org/show_bug.cgi?id=760783
panels/printers/new-printer-dialog.ui | 113 +++++++++++++------------------
panels/printers/pp-new-printer-dialog.c | 12 ++--
2 files changed, 52 insertions(+), 73 deletions(-)
---
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index d8b96f2..bc8355e 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -32,94 +32,67 @@
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
+ <property name="use_header_bar">1</property>
+ <child internal-child="headerbar">
+ <object class="GtkHeaderBar">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">10</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action-area1">
+ <property name="show-close-button">False</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>
+ </child>
+ <child>
+ <object class="GtkStack" id="headerbar-topright-buttons">
<property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkButton" id="new-printer-cancel-button">
- <property name="label" translatable="yes">_Cancel</property>
+ <object class="GtkButton" id="new-printer-add-button">
+ <property name="label" translatable="yes">_Add</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="name">add-button</property>
</packing>
</child>
<child>
- <object class="GtkNotebook" id="notebook">
+ <object class="GtkButton" id="unlock-button">
+ <property name="label" translatable="yes" comments="Translators: This button opens
authentication dialog for selected server.">_Unlock</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_tabs">False</property>
- <property name="show_border">False</property>
- <child>
- <object class="GtkButton" id="new-printer-add-button">
- <property name="label" translatable="yes">_Add</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">page 1</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="authenticate-button">
- <property name="label" translatable="yes" comments="Translators: This button opens
authentication dialog for selected server.">A_uthenticate</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="position">1</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">page 2</property>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="name">unlock-button</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="pack-type">GTK_PACK_END</property>
</packing>
</child>
+ </object>
+ </child>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
@@ -282,4 +255,10 @@
<action-widget response="-5">new-printer-add-button</action-widget>
</action-widgets>
</object>
+ <object class="GtkSizeGroup">
+ <widgets>
+ <widget name="new-printer-cancel-button"/>
+ <widget name="headerbar-topright-buttons"/>
+ </widgets>
+ </object>
</interface>
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index cdedd7e..4484ec3 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -415,7 +415,7 @@ pp_new_printer_dialog_init (PpNewPrinterDialog *dialog)
g_signal_connect (widget, "activate", G_CALLBACK (search_entry_activated_cb), dialog);
g_signal_connect (widget, "search-changed", G_CALLBACK (search_entry_changed_cb), dialog);
- widget = WID ("authenticate-button");
+ widget = WID ("unlock-button");
g_signal_connect (widget, "clicked", G_CALLBACK (authenticate_samba_server), dialog);
/* Set junctions */
@@ -489,7 +489,7 @@ device_selection_changed_cb (GtkTreeSelection *selection,
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *widget;
- GtkWidget *notebook;
+ GtkWidget *stack;
gboolean authentication_needed;
gboolean selected;
@@ -506,15 +506,15 @@ device_selection_changed_cb (GtkTreeSelection *selection,
widget = WID ("new-printer-add-button");
gtk_widget_set_sensitive (widget, selected);
- widget = WID ("authenticate-button");
+ widget = WID ("unlock-button");
gtk_widget_set_sensitive (widget, authentication_needed);
- notebook = WID ("notebook");
+ stack = WID ("headerbar-topright-buttons");
if (authentication_needed)
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 1);
+ gtk_stack_set_visible_child_name (GTK_STACK (stack), "unlock-button");
else
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
+ gtk_stack_set_visible_child_name (GTK_STACK (stack), "add-button");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]