[gnome-builder/wip/tree-menu] project-tree: implement collapse-all-nodes helper



commit 96430c72a540f722b94249a4333744e97a6992d3
Author: Christian Hergert <christian hergert me>
Date:   Sun Apr 5 01:08:32 2015 -0700

    project-tree: implement collapse-all-nodes helper
    
    Just a debug helper, not sure if we'll keep it long term.

 data/gtk/menus.ui                        |    8 ++++----
 src/editor/gb-editor-workspace-actions.c |   13 +++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index 6e5bec1..27dc579 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -113,14 +113,14 @@
     <section id="open-section">
       <item>
         <attribute name="label" translatable="yes">_Open</attribute>
-        <attribute name="action">tree.open</attribute>
+        <attribute name="action">project-tree.open</attribute>
       </item>
       <submenu>
         <attribute name="label" translatable="yes">Open _With</attribute>
         <section>
           <item>
             <attribute name="label" translatable="yes">Source Code Editor</attribute>
-            <attribute name="action">tree.open-with-editor</attribute>
+            <attribute name="action">project-tree.open-with-editor</attribute>
           </item>
         </section>
         <section id="open-by-mime-section">
@@ -130,7 +130,7 @@
     <section id="open-containing-section">
       <item>
         <attribute name="label" translatable="yes">_Open Containing Folder</attribute>
-        <attribute name="action">tree.open-containing-folder</attribute>
+        <attribute name="action">project-tree.open-containing-folder</attribute>
       </item>
     </section>
     <section id="display-options">
@@ -139,7 +139,7 @@
         <section>
           <item>
             <attribute name="label" translatable="yes">_Collapse All Nodes</attribute>
-            <attribute name="action">tree.collapse-all-nodes</attribute>
+            <attribute name="action">project-tree.collapse-all-nodes</attribute>
           </item>
           <item>
             <attribute name="label" translatable="yes">_Refresh</attribute>
diff --git a/src/editor/gb-editor-workspace-actions.c b/src/editor/gb-editor-workspace-actions.c
index 3719322..4608de3 100644
--- a/src/editor/gb-editor-workspace-actions.c
+++ b/src/editor/gb-editor-workspace-actions.c
@@ -94,6 +94,18 @@ gb_editor_workspace_tree_actions_refresh (GSimpleAction *action,
   /* TODO: Try to expand back to our current position */
 }
 
+static void
+gb_editor_workspace_tree_actions_collapse_all_nodes (GSimpleAction *action,
+                                                     GVariant      *variant,
+                                                     gpointer       user_data)
+{
+  GbEditorWorkspace *self = user_data;
+
+  g_assert (GB_IS_EDITOR_WORKSPACE (self));
+
+  gtk_tree_view_collapse_all (GTK_TREE_VIEW (self->project_tree));
+}
+
 static const GActionEntry GbEditorWorkspaceActions[] = {
   { "show-sidebar", NULL, NULL, "false", gb_editor_workspace_actions_show_sidebar },
   { "toggle-sidebar", gb_editor_workspace_actions_toggle_sidebar },
@@ -101,6 +113,7 @@ static const GActionEntry GbEditorWorkspaceActions[] = {
 
 static const GActionEntry GbEditorWorkspaceTreeActions[] = {
   { "refresh", gb_editor_workspace_tree_actions_refresh },
+  { "collapse-all-nodes", gb_editor_workspace_tree_actions_collapse_all_nodes },
 };
 
 void


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