[gnome-builder] tree-builder: simplify directory checks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] tree-builder: simplify directory checks
- Date: Sat, 9 Dec 2017 10:16:25 +0000 (UTC)
commit 21df353821e76582871317e9330c686876903705
Author: Christian Hergert <chergert redhat com>
Date: Sat Dec 9 01:52:44 2017 -0800
tree-builder: simplify directory checks
This isn't needed anymore now that we changed how children are
built in libdazzle.
src/plugins/project-tree/gb-project-tree-builder.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/project-tree/gb-project-tree-builder.c
b/src/plugins/project-tree/gb-project-tree-builder.c
index b07575d..fcc5071 100644
--- a/src/plugins/project-tree/gb-project-tree-builder.c
+++ b/src/plugins/project-tree/gb-project-tree-builder.c
@@ -72,6 +72,7 @@ gb_project_tree_builder_add (GbProjectTreeBuilder *self,
const gchar *display_name;
const gchar *icon_name;
const gchar *expanded = NULL;
+ gboolean is_dir;
g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
g_assert (DZL_IS_TREE_NODE (parent));
@@ -103,7 +104,11 @@ gb_project_tree_builder_add (GbProjectTreeBuilder *self,
if (g_strcmp0 (icon_name, "folder-symbolic") == 0)
expanded = "folder-open-symbolic";
+ is_dir = g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY;
+
child = g_object_new (DZL_TYPE_TREE_NODE,
+ "children-possible", is_dir,
+ "reset-on-collapse", is_dir,
"icon-name", icon_name,
"expanded-icon-name", expanded,
"text", display_name,
@@ -115,16 +120,6 @@ gb_project_tree_builder_add (GbProjectTreeBuilder *self,
* be the first child of the parent.
*/
dzl_tree_node_insert_sorted (parent, child, compare_nodes_func, self);
-
- /*
- * Set directory settings for the node if it is a directory. We need to do
- * this after inserting the node so the settings take effect propertly.
- */
- if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
- {
- dzl_tree_node_set_children_possible (child, TRUE);
- dzl_tree_node_set_reset_on_collapse (child, TRUE);
- }
}
static DzlTreeNode *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]