[gnome-usage/tracker-powered-storage-view-wip: 87/103] storage: Make working row for navigation up in files hierarchy
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage/tracker-powered-storage-view-wip: 87/103] storage: Make working row for navigation up in files hierarchy
- Date: Tue, 2 Apr 2019 12:27:07 +0000 (UTC)
commit d74062776fe068bae2399d3a577118f07d442c37
Author: Petr Štětka <pstetka redhat com>
Date: Tue Jun 19 15:47:49 2018 +0200
storage: Make working row for navigation up in files hierarchy
data/interface/adwaita.css | 17 +++++++++++++++++
src/storage/storage-view-item.vala | 1 +
src/storage/storage-view-row.vala | 5 ++++-
src/storage/storage-view.vala | 13 ++++++++-----
4 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/data/interface/adwaita.css b/data/interface/adwaita.css
index c046b58..2092b9b 100644
--- a/data/interface/adwaita.css
+++ b/data/interface/adwaita.css
@@ -164,3 +164,20 @@ ColorRectangle.available-storage, StorageGraph.available-storage {
box.storage {
background-color: #ffffff;
}
+
+row.up-folder:not(:hover) {
+ background: @theme_base_color;
+}
+
+dzlstacklist list {
+ border-color: @borders;
+ border-left: none;
+ border-right: none;
+ border-bottom: none;
+}
+
+dzlstacklist list.stack-header {
+ padding-bottom: 1px;
+ margin: 0px;
+ border:none;
+}
\ No newline at end of file
diff --git a/src/storage/storage-view-item.vala b/src/storage/storage-view-item.vala
index 78cb172..7d165d8 100644
--- a/src/storage/storage-view-item.vala
+++ b/src/storage/storage-view-item.vala
@@ -28,6 +28,7 @@ public class Usage.StorageViewItem : GLib.Object {
public FileType type;
public UserDirectory? dir;
public string ontology;
+ public string? custom_type;
private string _style_class = null;
public string style_class {
diff --git a/src/storage/storage-view-row.vala b/src/storage/storage-view-row.vala
index 2e9170b..be0dd94 100644
--- a/src/storage/storage-view-row.vala
+++ b/src/storage/storage-view-row.vala
@@ -63,7 +63,10 @@ public class Usage.StorageViewRow : Gtk.ListBoxRow {
tag.get_style_context ().add_class (item.style_class);
- if (item.type == FileType.DIRECTORY)
+ if (item.type == FileType.DIRECTORY || item.custom_type != null)
tag.width_request = tag.height_request = 20;
+
+ if(item.custom_type == "up-folder")
+ get_style_context().add_class("up-folder");
}
}
diff --git a/src/storage/storage-view.vala b/src/storage/storage-view.vala
index c0af07e..75ed928 100644
--- a/src/storage/storage-view.vala
+++ b/src/storage/storage-view.vala
@@ -77,8 +77,10 @@ public class Usage.NewStorageView : Usage.View {
private void on_row_activated (Gtk.ListBoxRow row) {
var storage_row = row as StorageViewRow;
- if (storage_row.item.type == FileType.DIRECTORY) {
- present_dir.begin (storage_row.item.uri);
+ if(storage_row.item.custom_type == "up-folder") {
+ listbox.pop();
+ } else if (storage_row.item.type == FileType.DIRECTORY) {
+ present_dir.begin (storage_row.item.uri);
} else {
graph.queue_draw ();
}
@@ -118,9 +120,10 @@ public class Usage.NewStorageView : Usage.View {
var file = File.new_for_uri (uri);
var item = new StorageViewItem.from_file (file);
- var row = new StorageViewRow.from_item (item);
+ item.custom_type = "up-folder";
- listbox.push (row, model, create_file_row);
+ model.insert(0, item);
+ listbox.push (new Gtk.ListBoxRow(), model, create_file_row);
graph.model = model;
} catch (GLib.Error error) {
@@ -188,7 +191,7 @@ public class Usage.NewStorageView : Usage.View {
model.append (item);
}
- listbox.push (os_row, model, create_file_row);
+ listbox.push (new Gtk.ListBoxRow(), model, create_file_row);
graph.model = model;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]