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
This commit is contained in:
Felipe Borges 2016-09-02 13:02:22 +02:00
parent 96d541635d
commit 8f57e4dfc7
2 changed files with 67 additions and 88 deletions

View file

@ -32,94 +32,67 @@
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="use_header_bar">1</property>
<child internal-child="headerbar">
<object class="GtkHeaderBar">
<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>
<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>
<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>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="name">add-button</property>
</packing>
</child>
<child>
<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">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="name">unlock-button</property>
</packing>
</child>
</object>
<packing>
<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 internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action-area1">
<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>
<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="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<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>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</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>
</packing>
</child>
<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>

View file

@ -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");
}
}