[gnome-builder] project-tree: insert dummy empty node if no children were found
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] project-tree: insert dummy empty node if no children were found
- Date: Tue, 10 May 2016 08:28:17 +0000 (UTC)
commit 8df8ac43f044682e0faf7b4ff44359255d5071ea
Author: Christian Hergert <chergert redhat com>
Date: Tue May 10 11:26:31 2016 +0300
project-tree: insert dummy empty node if no children were found
This more closely mimics what gedit does in the project tree.
plugins/project-tree/gb-project-tree-builder.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plugins/project-tree/gb-project-tree-builder.c b/plugins/project-tree/gb-project-tree-builder.c
index 0cf4513..fdf633a 100644
--- a/plugins/project-tree/gb-project-tree-builder.c
+++ b/plugins/project-tree/gb-project-tree-builder.c
@@ -123,6 +123,7 @@ build_file (GbProjectTreeBuilder *self,
IdeVcs *vcs;
GFile *file;
IdeTree *tree;
+ gint count = 0;
gboolean show_ignored_files;
g_return_if_fail (GB_IS_PROJECT_TREE_BUILDER (self));
@@ -189,6 +190,24 @@ build_file (GbProjectTreeBuilder *self,
if (g_file_info_get_file_type (item_file_info) == G_FILE_TYPE_DIRECTORY)
ide_tree_node_set_children_possible (child, TRUE);
+
+ count++;
+ }
+
+ /*
+ * If we didn't add any children to this node, insert an empty node to
+ * notify the user that nothing was found.
+ */
+ if (count == 0)
+ {
+ IdeTreeNode *child;
+
+ child = g_object_new (IDE_TYPE_TREE_NODE,
+ "icon-name", NULL,
+ "text", _("Empty"),
+ "use-dim-label", TRUE,
+ NULL);
+ ide_tree_node_append (node, child);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]