[baobab] Create the display name column only if needed
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Create the display name column only if needed
- Date: Fri, 12 Jun 2020 13:14:28 +0000 (UTC)
commit d24615e14f30f4f800af2c17aab612805ec291fb
Author: Stefano Facchini <stefano facchini gmail com>
Date: Tue Jun 9 12:18:52 2020 +0200
Create the display name column only if needed
For directories it doesn't change much because the 'elements' and 'state' columns
will always be set, but when we add files this should help saving some memory.
src/baobab-main-window.ui | 14 +++++++-------
src/baobab-scanner.vala | 11 ++++++++---
2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index cb19517..a5014a9 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -250,7 +250,7 @@
<property name="ypad">4</property>
</object>
<attributes>
- <attribute name="value">2</attribute>
+ <attribute name="value">1</attribute>
<attribute name="state">7</attribute>
</attributes>
</child>
@@ -258,7 +258,7 @@
<object class="BaobabCellRendererName" id="folder_column_text_renderer"/>
<attributes>
<attribute name="name">0</attribute>
- <attribute name="display_name">1</attribute>
+ <attribute name="display_name">5</attribute>
<attribute name="state">7</attribute>
</attributes>
</child>
@@ -270,15 +270,15 @@
<property name="sizing">grow-only</property>
<property name="title" translatable="yes">Size</property>
<property name="reorderable">True</property>
- <property name="sort_column_id">4</property>
+ <property name="sort_column_id">3</property>
<child>
<object class="BaobabCellRendererSize" id="size_column_size_renderer">
<property name="xalign">1.0</property>
<property name="show-allocated-size">True</property>
</object>
<attributes>
- <attribute name="size">3</attribute>
- <attribute name="alloc-size">4</attribute>
+ <attribute name="size">2</attribute>
+ <attribute name="alloc-size">3</attribute>
<attribute name="state">7</attribute>
</attributes>
</child>
@@ -308,13 +308,13 @@
<property name="sizing">grow-only</property>
<property name="title" translatable="yes">Modified</property>
<property name="reorderable">True</property>
- <property name="sort_column_id">5</property>
+ <property name="sort_column_id">4</property>
<child>
<object class="BaobabCellRendererTime" id="modified_column_time_renderer">
<property name="xalign">1.0</property>
</object>
<attributes>
- <attribute name="time">5</attribute>
+ <attribute name="time">4</attribute>
</attributes>
</child>
</object>
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index d24e70e..4c7badb 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -31,11 +31,11 @@ namespace Baobab {
public class Scanner : Gtk.TreeStore {
public enum Columns {
NAME,
- DISPLAY_NAME,
PERCENT,
SIZE,
ALLOC_SIZE,
TIME_MODIFIED,
+ DISPLAY_NAME,
ELEMENTS,
STATE,
COLUMNS
@@ -320,8 +320,13 @@ namespace Baobab {
set (results.iter,
Columns.STATE, State.SCANNING,
Columns.NAME, results.name,
- Columns.DISPLAY_NAME, results.display_name,
Columns.TIME_MODIFIED,results.time_modified);
+
+ if (results.display_name != null) {
+ set (results.iter,
+ Columns.DISPLAY_NAME, results.display_name);
+ }
+
results.iter_is_set = true;
}
@@ -455,11 +460,11 @@ namespace Baobab {
scan_error = null;
set_column_types (new Type[] {
typeof (string), // NAME
- typeof (string), // DISPLAY_NAME
typeof (double), // PERCENT
typeof (uint64), // SIZE
typeof (uint64), // ALLOC_SIZE
typeof (uint64), // TIME_MODIFIED
+ typeof (string), // DISPLAY_NAME
typeof (int), // ELEMENTS
typeof (State) // STATE
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]