[gnome-builder/wip/tree-menu] tree: rebuild the tree when sort ordering changes



commit 82276a1943020c81b75485857dd26bc082237f6f
Author: Christian Hergert <christian hergert me>
Date:   Sun Apr 5 21:26:22 2015 -0700

    tree: rebuild the tree when sort ordering changes

 src/tree/gb-project-tree-builder.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/tree/gb-project-tree-builder.c b/src/tree/gb-project-tree-builder.c
index 59fb8a3..2f0f8be 100644
--- a/src/tree/gb-project-tree-builder.c
+++ b/src/tree/gb-project-tree-builder.c
@@ -356,6 +356,20 @@ failure:
 }
 
 static void
+gb_project_tree_builder_rebuild (GSettings            *settings,
+                                 const gchar          *key,
+                                 GbProjectTreeBuilder *self)
+{
+  GtkWidget *tree;
+
+  g_assert (G_IS_SETTINGS (settings));
+  g_assert (GB_IS_PROJECT_TREE_BUILDER (self));
+
+  if ((tree = gb_tree_builder_get_tree (GB_TREE_BUILDER (self))))
+    gb_tree_rebuild (GB_TREE (tree));
+}
+
+static void
 gb_project_tree_builder_finalize (GObject *object)
 {
   GbProjectTreeBuilder *self = (GbProjectTreeBuilder *)object;
@@ -432,4 +446,9 @@ static void
 gb_project_tree_builder_init (GbProjectTreeBuilder *self)
 {
   self->file_chooser_settings = g_settings_new ("org.gtk.Settings.FileChooser");
+
+  g_signal_connect (self->file_chooser_settings,
+                    "changed::sort-directories-first",
+                    G_CALLBACK (gb_project_tree_builder_rebuild),
+                    self);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]