[baobab/reroot-view: 16/30] Delay showing the result page until the scan is completed
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/reroot-view: 16/30] Delay showing the result page until the scan is completed
- Date: Tue, 23 Jun 2020 10:39:23 +0000 (UTC)
commit de5d1cb5c93215934ed7e87ad8b7e34e2a0c64ec
Author: Stefano Facchini <stefano facchini gmail com>
Date: Thu Jun 18 17:57:33 2020 +0200
Delay showing the result page until the scan is completed
It seems that the combination GtkTreeView + GtkModelFilter chokes on directories
with many entries.
Show a simple "scanning page" instead.
data/ui/baobab-main-window.ui | 15 ++++++++++++++-
src/baobab-window.vala | 19 ++++++++++++++-----
2 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/baobab-main-window.ui b/data/ui/baobab-main-window.ui
index bc596ec..9a348f6 100644
--- a/data/ui/baobab-main-window.ui
+++ b/data/ui/baobab-main-window.ui
@@ -198,7 +198,6 @@
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="transition_type">slide-left-right</property>
<child>
<object class="GtkGrid" id="home_page">
<property name="can_focus">False</property>
@@ -220,6 +219,20 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkGrid" id="scanning_page">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <child>
+ <object class="GtkLabel" id="scanning_label">
+ <property name="visible">True</property>
+ <property name="label">Scanning…</property>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkGrid" id="result_page">
<property name="visible">True</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index e968d9d..9eef70e 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -110,6 +110,8 @@ namespace Baobab {
[GtkChild]
private Gtk.Widget home_page;
[GtkChild]
+ private Gtk.Widget scanning_page;
+ [GtkChild]
private Gtk.Widget result_page;
[GtkChild]
private Gtk.InfoBar infobar;
@@ -556,22 +558,29 @@ namespace Baobab {
void set_ui_state (Gtk.Widget child, bool busy) {
menu_button.visible = (child == home_page);
reload_button.visible = (child == result_page);
- back_button.visible = (child == result_page);
+ back_button.visible = (child == result_page) || (child == scanning_page);
set_busy (busy);
+ header_bar.custom_title = null;
if (child == home_page) {
var action = lookup_action ("reload") as SimpleAction;
action.set_enabled (false);
header_bar.title = _("Devices & Locations");
- header_bar.custom_title = null;
} else {
var action = lookup_action ("reload") as SimpleAction;
action.set_enabled (true);
header_bar.title = active_location.name;
- header_bar.custom_title = pathbar;
+ if (child == result_page) {
+ header_bar.custom_title = pathbar;
+ }
}
+ if (child == scanning_page || child == result_page) {
+ main_stack.transition_type = Gtk.StackTransitionType.CROSSFADE;
+ } else {
+ main_stack.transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT;
+ }
main_stack.visible_child = child;
}
@@ -622,6 +631,7 @@ namespace Baobab {
}
}
+ reroot_treeview (new Gtk.TreePath.first ());
set_chart_location (active_location);
set_ui_state (result_page, false);
@@ -656,10 +666,9 @@ namespace Baobab {
scan_completed_handler = scanner.completed.connect (scanner_completed);
clear_message ();
- set_ui_state (result_page, true);
+ set_ui_state (scanning_page, true);
scanner.scan (force);
- reroot_when_scanner_not_empty ();
}
public void scan_directory (File directory, ScanFlags flags=ScanFlags.NONE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]