[gnome-control-center] printers: Move options dialog spinner out of the action area
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Move options dialog spinner out of the action area
- Date: Mon, 29 May 2017 17:31:17 +0000 (UTC)
commit 50160be2c67cec38591c725a198af5a36f532ec9
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 27 23:51:40 2015 -0500
printers: Move options dialog spinner out of the action area
For an infinitesimal amount of time after opening the options dialog, a
spinner is displayed at the start of the action area while the dialog
loads asynchronously. Display the spinner in the center of the dialog
instead, using a GtkStack to switch between spinner mode and normal
mode. Test by removing the calls to printer_get_ppd_async(),
get_named_dest_async(), and get_ipp_attributes_async() from the bottom
of populate_options().
Why? (1) It looks better this way. (2) Need to stop using the action
area in order to switch to a header bar.
https://bugzilla.gnome.org/show_bug.cgi?id=755713
https://bugzilla.gnome.org/show_bug.cgi?id=779708
panels/printers/options-dialog.ui | 159 +++++++++++++++--------------------
panels/printers/pp-options-dialog.c | 14 ++--
2 files changed, 75 insertions(+), 98 deletions(-)
---
diff --git a/panels/printers/options-dialog.ui b/panels/printers/options-dialog.ui
index 665c5ee..f9ba3bb 100644
--- a/panels/printers/options-dialog.ui
+++ b/panels/printers/options-dialog.ui
@@ -13,77 +13,61 @@
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
- <object class="GtkBox" id="main-vbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">10</property>
+ <object class="GtkBox">
<child>
- <object class="GtkBox" id="box2">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolled-window1">
- <property name="width_request">120</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="options-categories-treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="homogeneous">True</property>
<child>
- <object class="GtkNotebook" id="options-notebook">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="tab_pos">left</property>
- <property name="show_tabs">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action-area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkBox" id="box3">
+ <object class="GtkBox" id="main-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
<child>
- <object class="GtkSpinner" id="options-spinner">
- <property name="width_request">24</property>
- <property name="height_request">24</property>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="no_show_all">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled-window1">
+ <property name="width_request">120</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="options-categories-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="options-notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tab_pos">left</property>
+ <property name="show_tabs">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
@@ -91,46 +75,41 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="progress-label">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">Loading options…</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">10</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <property name="secondary">True</property>
+ <property name="name">main-box</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="options-close-button">
- <property name="label" translatable="yes">_Close</property>
+ <object class="GtkSpinner" id="options-spinner">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="width_request">24</property>
+ <property name="height_request">24</property>
+ <property name="can_focus">False</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
+ <property name="name">progress-box</property>
</packing>
</child>
</object>
+ </child>
+ </object>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action-area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="options-close-button">
+ <property name="label" translatable="yes">Close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
diff --git a/panels/printers/pp-options-dialog.c b/panels/printers/pp-options-dialog.c
index 47ea2e3..d2def2e 100644
--- a/panels/printers/pp-options-dialog.c
+++ b/panels/printers/pp-options-dialog.c
@@ -508,12 +508,11 @@ populate_options_real (PpOptionsDialog *dialog)
widget = (GtkWidget*)
gtk_builder_get_object (dialog->builder, "options-spinner");
- gtk_widget_hide (widget);
gtk_spinner_stop (GTK_SPINNER (widget));
widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "progress-label");
- gtk_widget_hide (widget);
+ gtk_builder_get_object (dialog->builder, "stack");
+ gtk_stack_set_visible_child_name (GTK_STACK (widget), "main-box");
treeview = (GtkTreeView *)
gtk_builder_get_object (dialog->builder, "options-categories-treeview");
@@ -777,6 +776,10 @@ populate_options (PpOptionsDialog *dialog)
"orientation-requested-default",
NULL};
+ widget = (GtkWidget*)
+ gtk_builder_get_object (dialog->builder, "stack");
+ gtk_stack_set_visible_child_name (GTK_STACK (widget), "progress-box");
+
treeview = (GtkTreeView *)
gtk_builder_get_object (dialog->builder, "options-categories-treeview");
@@ -789,13 +792,8 @@ populate_options (PpOptionsDialog *dialog)
widget = (GtkWidget*)
gtk_builder_get_object (dialog->builder, "options-spinner");
- gtk_widget_show (widget);
gtk_spinner_start (GTK_SPINNER (widget));
- widget = (GtkWidget*)
- gtk_builder_get_object (dialog->builder, "progress-label");
- gtk_widget_show (widget);
-
printer_get_ppd_async (dialog->printer_name,
NULL,
0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]