[baobab/reroot-view: 28/30] Make the result page split resizable
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/reroot-view: 28/30] Make the result page split resizable
- Date: Tue, 23 Jun 2020 10:40:24 +0000 (UTC)
commit 1c9c0dc80cb204aa53502c65ca216793dfc738cd
Author: Stefano Facchini <stefano facchini gmail com>
Date: Mon Jun 22 18:30:59 2020 +0200
Make the result page split resizable
data/baobab.css | 5 --
data/ui/baobab-main-window.ui | 183 ++++++++++++++++++++----------------------
src/baobab-window.vala | 14 +++-
3 files changed, 99 insertions(+), 103 deletions(-)
---
diff --git a/data/baobab.css b/data/baobab.css
index 44edd4a..be81a18 100644
--- a/data/baobab.css
+++ b/data/baobab.css
@@ -54,11 +54,6 @@
color: @theme_unfocused_text_color;
}
-window.background stack > grid > frame border,
-window.background stack > grid > scrolledwindow.frame {
- border-width: 0 1px 0 0;
-}
-
window.background stack treeview:hover:not(:selected) {
background: @theme_bg_color;
}
diff --git a/data/ui/baobab-main-window.ui b/data/ui/baobab-main-window.ui
index b1d6b3f..34da7e3 100644
--- a/data/ui/baobab-main-window.ui
+++ b/data/ui/baobab-main-window.ui
@@ -251,125 +251,120 @@
</object>
</child>
<child>
- <object class="GtkGrid" id="result_page">
+ <object class="GtkPaned" id="result_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="column_homogeneous">True</property>
<child>
- <object class="GtkFrame" id="folder_display_frame">
- <property name="visible">true</property>
+ <object class="GtkGrid" id="treeview_grid">
+ <property name="visible">True</property>
<child>
<object class="BaobabFolderDisplay" id="folder_display"/>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolled_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="hscrollbar-policy">never</property>
<child>
- <object class="GtkTreeView" id="treeview">
+ <object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">false</property>
- <property name="activate_on_single_click">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview_selection1"/>
- </child>
+ <property name="shadow_type">none</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="hscrollbar-policy">never</property>
<child>
- <object class="GtkTreeViewColumn" id="folder_column">
- <property name="title" translatable="yes">Folder</property>
- <property name="expand">True</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">0</property>
- <child>
- <object class="BaobabCellRendererProgress" id="usage_column_bar_renderer">
- <property name="xpad">4</property>
- <property name="ypad">4</property>
- </object>
- <attributes>
- <attribute name="value">1</attribute>
- <attribute name="state">6</attribute>
- </attributes>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">false</property>
+ <property name="activate_on_single_click">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview_selection1"/>
</child>
<child>
- <object class="BaobabCellRendererName" id="folder_column_text_renderer">
- <property name="ellipsize">end</property>
+ <object class="GtkTreeViewColumn" id="folder_column">
+ <property name="title" translatable="yes">Folder</property>
+ <property name="expand">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">0</property>
+ <child>
+ <object class="BaobabCellRendererProgress"
id="usage_column_bar_renderer">
+ <property name="xpad">4</property>
+ <property name="ypad">4</property>
+ </object>
+ <attributes>
+ <attribute name="value">1</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="BaobabCellRendererName" id="folder_column_text_renderer">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="name">0</attribute>
+ <attribute name="display_name">4</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="name">0</attribute>
- <attribute name="display_name">4</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="size_column">
- <property name="title" translatable="yes">Size</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">2</property>
<child>
- <object class="BaobabCellRendererSize" id="size_column_size_renderer">
- <property name="xalign">1.0</property>
+ <object class="GtkTreeViewColumn" id="size_column">
+ <property name="title" translatable="yes">Size</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">2</property>
+ <child>
+ <object class="BaobabCellRendererSize" id="size_column_size_renderer">
+ <property name="xalign">1.0</property>
+ </object>
+ <attributes>
+ <attribute name="size">2</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="size">2</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="contents_column">
- <property name="title" translatable="yes">Contents</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">5</property>
<child>
- <object class="BaobabCellRendererItems" id="contents_column_items_renderer">
- <property name="xalign">1.0</property>
+ <object class="GtkTreeViewColumn" id="contents_column">
+ <property name="title" translatable="yes">Contents</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">5</property>
+ <child>
+ <object class="BaobabCellRendererItems"
id="contents_column_items_renderer">
+ <property name="xalign">1.0</property>
+ </object>
+ <attributes>
+ <attribute name="items">5</attribute>
+ <attribute name="state">6</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="items">5</attribute>
- <attribute name="state">6</attribute>
- </attributes>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="time_modified_column">
- <property name="title" translatable="yes">Modified</property>
- <property name="reorderable">True</property>
- <property name="sort_column_id">3</property>
<child>
- <object class="BaobabCellRendererTime" id="modified_column_time_renderer">
- <property name="xalign">1.0</property>
+ <object class="GtkTreeViewColumn" id="time_modified_column">
+ <property name="title" translatable="yes">Modified</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">3</property>
+ <child>
+ <object class="BaobabCellRendererTime"
id="modified_column_time_renderer">
+ <property name="xalign">1.0</property>
+ </object>
+ <attributes>
+ <attribute name="time">3</attribute>
+ </attributes>
+ </child>
</object>
- <attributes>
- <attribute name="time">3</attribute>
- </attributes>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
</child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkGrid" id="chart_grid">
@@ -447,12 +442,6 @@
</packing>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">2</property>
- </packing>
</child>
</object>
</child>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 54d7686..b7aa5cb 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -89,6 +89,8 @@ namespace Baobab {
[GtkChild]
private Gtk.Spinner spinner;
+ double result_paned_position = 0.5;
+
private Location? active_location = null;
private ulong scan_completed_handler = 0;
private uint scanning_progress_id = 0;
@@ -170,14 +172,24 @@ namespace Baobab {
return false;
});
+ var result_paned = (Gtk.Paned) result_page;
+
configure_event.connect ((event) => {
+ get_size (out width, out height);
if (!(Gdk.WindowState.MAXIMIZED in get_window ().get_state ())) {
- get_size (out width, out height);
ui_settings.set ("window-size", "(ii)", width, height);
}
+
+ int position = (int) (width * result_paned_position);
+ result_paned.set_position (position);
+
return false;
});
+ result_paned.notify["position"].connect (() => {
+ result_paned_position = (double) result_paned.position / width;
+ });
+
destroy.connect (() => {
ui_settings.apply ();
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]