[baobab/reroot-view: 33/35] Drop the "scanning" page and report progress in FolderDisplay
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/reroot-view: 33/35] Drop the "scanning" page and report progress in FolderDisplay
- Date: Sun, 28 Jun 2020 11:00:54 +0000 (UTC)
commit 8302003a053b8f523013dbefa9b14ee30eb4788b
Author: Stefano Facchini <stefano facchini gmail com>
Date: Fri Jun 26 15:10:13 2020 +0200
Drop the "scanning" page and report progress in FolderDisplay
We reduce a bit the amount of transitiong, and it looks better when rescanning.
data/baobab.css | 4 ----
data/ui/baobab-location-row.ui | 17 ++---------------
data/ui/baobab-main-window.ui | 32 +-------------------------------
src/baobab-folder-display.vala | 13 +++++++++++++
src/baobab-location.vala | 1 +
src/baobab-window.vala | 35 +++++------------------------------
6 files changed, 22 insertions(+), 80 deletions(-)
---
diff --git a/data/baobab.css b/data/baobab.css
index a72a5d7..d229b4b 100644
--- a/data/baobab.css
+++ b/data/baobab.css
@@ -68,10 +68,6 @@ window.background stack treeview:hover:not(:selected) {
background: @theme_bg_color;
}
-.scanning-label {
- font-size: 150%;
-}
-
pathbar button {
transition: 0;
margin: 0;
diff --git a/data/ui/baobab-location-row.ui b/data/ui/baobab-location-row.ui
index e74cf98..aae4932 100644
--- a/data/ui/baobab-location-row.ui
+++ b/data/ui/baobab-location-row.ui
@@ -6,7 +6,6 @@
<child>
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
<property name="column_spacing">12</property>
<property name="margin">6</property>
<child>
@@ -18,7 +17,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
@@ -35,8 +33,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -54,8 +50,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -68,8 +62,6 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -85,25 +77,20 @@
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLevelBar" id="usage_bar">
- <property name="visible">False</property>
<property name="can_focus">False</property>
- <property name="halign">fill</property>
<property name="valign">start</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
<property name="hexpand">True</property>
- <property name="margin-top">6</property>
- <property name="margin-bottom">6</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">3</property>
- <property name="height">1</property>
</packing>
</child>
</object>
diff --git a/data/ui/baobab-main-window.ui b/data/ui/baobab-main-window.ui
index b1d6b3f..09727f4 100644
--- a/data/ui/baobab-main-window.ui
+++ b/data/ui/baobab-main-window.ui
@@ -198,6 +198,7 @@
<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>
@@ -219,37 +220,6 @@
</child>
</object>
</child>
- <child>
- <object class="GtkGrid" id="scanning_page">
- <property name="visible">True</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
- <style>
- <class name="scanning-label"/>
- <class name="dim-label"/>
- </style>
- <child>
- <object class="GtkLabel" id="scanning_label_front">
- <property name="visible">True</property>
- <property name="label" translatable="yes">In progress,</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="scanning_progress_label">
- <property name="visible">True</property>
- <property name="width_chars">8</property>
- <property name="halign">end</property>
- <property name="xalign">1.0</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="scanning_label_back">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> scanned so far</property>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkGrid" id="result_page">
<property name="visible">True</property>
diff --git a/src/baobab-folder-display.vala b/src/baobab-folder-display.vala
index 651308b..974e43c 100644
--- a/src/baobab-folder-display.vala
+++ b/src/baobab-folder-display.vala
@@ -39,15 +39,28 @@ namespace Baobab {
public signal void activated ();
+ private ulong location_progress_handler;
+
Location location_;
public Location location {
set {
+ if (location_progress_handler > 0) {
+ SignalHandler.disconnect (location_, location_progress_handler);
+ location_progress_handler = 0;
+ }
+
location_ = value;
var list_store = (Gtk.ListStore) model;
list_store.clear ();
list_store.insert_with_values (null, -1,
Scanner.Columns.NAME, location.name);
+
+ location_progress_handler = location_.progress.connect (() => {
+ Gtk.TreeIter iter;
+ list_store.set (iter, Scanner.Columns.SIZE, location_.scanner.total_size);
+ });
+
}
get {
diff --git a/src/baobab-location.vala b/src/baobab-location.vala
index 5d04747..2c4dced 100644
--- a/src/baobab-location.vala
+++ b/src/baobab-location.vala
@@ -46,6 +46,7 @@ namespace Baobab {
public Scanner? scanner { get; private set; }
public signal void changed ();
+ public signal void progress ();
private bool querying_fs = false;
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index dfa3bf0..5603f0b 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -41,8 +41,6 @@ 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;
@@ -55,8 +53,6 @@ namespace Baobab {
[GtkChild]
private LocationList location_list;
[GtkChild]
- private Gtk.Label scanning_progress_label;
- [GtkChild]
private FolderDisplay folder_display;
[GtkChild]
private Gtk.TreeView treeview;
@@ -90,7 +86,6 @@ namespace Baobab {
private Location? active_location = null;
private ulong scan_completed_handler = 0;
private uint scanning_progress_id = 0;
- private uint scanning_page_timeout_id = 0;
static Gdk.Cursor busy_cursor;
@@ -266,11 +261,6 @@ namespace Baobab {
scan_completed_handler = 0;
}
- if (scanning_page_timeout_id > 0) {
- Source.remove (scanning_page_timeout_id);
- scanning_page_timeout_id = 0;
- }
-
active_location = null;
}
@@ -558,7 +548,7 @@ 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) || (child == scanning_page);
+ back_button.visible = (child == result_page);
set_busy (busy);
@@ -576,11 +566,6 @@ namespace Baobab {
}
}
- 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;
}
@@ -617,11 +602,6 @@ namespace Baobab {
scanning_progress_id = 0;
}
- if (scanning_page_timeout_id > 0) {
- Source.remove (scanning_page_timeout_id);
- scanning_page_timeout_id = 0;
- }
-
try {
scanner.finish();
} catch (IOError.CANCELLED e) {
@@ -666,22 +646,17 @@ namespace Baobab {
treeview.model = null;
- var scanner = active_location.scanner;
+ var scanner = location.scanner;
scan_completed_handler = scanner.completed.connect (scanner_completed);
clear_message ();
- scanning_page_timeout_id = Timeout.add (500, () => {
- scanning_page_timeout_id = 0;
- set_ui_state (scanning_page, true);
- return Source.REMOVE;
- });
-
- scanning_progress_id = Timeout.add (100, () => {
- scanning_progress_label.label = format_size (scanner.total_size);
+ scanning_progress_id = Timeout.add (500, () => {
+ location.progress ();
return Source.CONTINUE;
});
+ set_ui_state (result_page, true);
scanner.scan (force);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]