[gnome-builder] tree: add show-icons menu item and action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-builder] tree: add show-icons menu item and action
- Date: Thu,  9 Apr 2015 00:10:21 +0000 (UTC)
commit 39b456ff2332e2c47f60e74f3d7013e7036b2486
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 8 15:33:40 2015 -0700
    tree: add show-icons menu item and action
 data/gtk/menus.ui                    |    4 ++++
 src/editor/gb-project-tree-actions.c |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index b80d2a0..de5f9bb 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -115,6 +115,10 @@
         <attribute name="label" translatable="yes">Display Options</attribute>
         <section>
           <item>
+            <attribute name="label" translatable="yes">Show Icons</attribute>
+            <attribute name="action">project-tree.show-icons</attribute>
+          </item>
+          <item>
             <attribute name="label" translatable="yes">Sort Directories First</attribute>
             <attribute name="action">project-tree.sort-directories-first</attribute>
           </item>
diff --git a/src/editor/gb-project-tree-actions.c b/src/editor/gb-project-tree-actions.c
index 723a930..fca9f0f 100644
--- a/src/editor/gb-project-tree-actions.c
+++ b/src/editor/gb-project-tree-actions.c
@@ -231,11 +231,25 @@ gb_project_tree_actions_open_containing_folder (GSimpleAction *action,
     }
 }
 
+static void
+gb_project_tree_actions_show_icons (GSimpleAction *action,
+                                    GVariant      *variant,
+                                    gpointer       user_data)
+{
+  GbEditorWorkspace *editor = user_data;
+
+  g_assert (GB_IS_EDITOR_WORKSPACE (editor));
+
+  gb_tree_set_show_icons (editor->project_tree, g_variant_get_boolean (variant));
+  g_simple_action_set_state (action, variant);
+}
+
 static GActionEntry GbProjectTreeActions[] = {
   { "open",                   gb_project_tree_actions_open },
   { "open-with-editor",       gb_project_tree_actions_open_with_editor },
   { "open-containing-folder", gb_project_tree_actions_open_containing_folder },
   { "refresh",                gb_project_tree_actions_refresh },
+  { "show-icons",             NULL, NULL, "false", gb_project_tree_actions_show_icons },
   { "collapse-all-nodes",     gb_project_tree_actions_collapse_all_nodes },
 };
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]