[gnome-builder] tree: add "Sort Directories First" menu item



commit a3e1da6e7693d037f350e1cf4405f927d86d2eb0
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 8 01:03:57 2015 -0700

    tree: add "Sort Directories First" menu item

 data/gtk/menus.ui                        |    6 ++++++
 src/editor/gb-editor-workspace-actions.c |    9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 7b9d63b..b80d2a0 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -115,6 +115,12 @@
         <attribute name="label" translatable="yes">Display Options</attribute>
         <section>
           <item>
+            <attribute name="label" translatable="yes">Sort Directories First</attribute>
+            <attribute name="action">project-tree.sort-directories-first</attribute>
+          </item>
+        </section>
+        <section>
+          <item>
             <attribute name="label" translatable="yes">_Collapse All Nodes</attribute>
             <attribute name="action">project-tree.collapse-all-nodes</attribute>
           </item>
diff --git a/src/editor/gb-editor-workspace-actions.c b/src/editor/gb-editor-workspace-actions.c
index 4608de3..5a09dad 100644
--- a/src/editor/gb-editor-workspace-actions.c
+++ b/src/editor/gb-editor-workspace-actions.c
@@ -121,6 +121,8 @@ gb_editor_workspace_actions_init (GbEditorWorkspace *self)
 {
   g_autoptr(GSimpleActionGroup) group = NULL;
   g_autoptr(GSimpleActionGroup) tree_group = NULL;
+  g_autoptr(GSettings) settings = NULL;
+  g_autoptr(GAction) action = NULL;
 
   group = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (group), GbEditorWorkspaceActions,
@@ -128,7 +130,10 @@ gb_editor_workspace_actions_init (GbEditorWorkspace *self)
   gtk_widget_insert_action_group (GTK_WIDGET (self), "workspace", G_ACTION_GROUP (group));
 
   tree_group = g_simple_action_group_new ();
-  g_action_map_add_action_entries (G_ACTION_MAP (group), GbEditorWorkspaceTreeActions,
+  settings = g_settings_new ("org.gtk.Settings.FileChooser");
+  action = g_settings_create_action (settings, "sort-directories-first");
+  g_action_map_add_action (G_ACTION_MAP (tree_group), action);
+  g_action_map_add_action_entries (G_ACTION_MAP (tree_group), GbEditorWorkspaceTreeActions,
                                    G_N_ELEMENTS (GbEditorWorkspaceTreeActions), self);
-  gtk_widget_insert_action_group (GTK_WIDGET (self), "project-tree", G_ACTION_GROUP (group));
+  gtk_widget_insert_action_group (GTK_WIDGET (self), "project-tree", G_ACTION_GROUP (tree_group));
 }


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