[gitg/wip/commit: 1/2] Add stack switcher for main view without using icons



commit 562346281ca0825c5c45ec54a2429ddbe14ed50f
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Mar 7 16:59:24 2013 +0100

    Add stack switcher for main view without using icons

 gitg/gitg-ui-elements.vala       |    7 +++++--
 gitg/gitg-window.vala            |    7 ++++++-
 gitg/resources/ui/gitg-window.ui |    5 +++++
 3 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gitg/gitg-ui-elements.vala b/gitg/gitg-ui-elements.vala
index 961d5b4..edf71d8 100644
--- a/gitg/gitg-ui-elements.vala
+++ b/gitg/gitg-ui-elements.vala
@@ -27,6 +27,7 @@ public class UIElements<T>
        private List<GitgExt.UIElement> d_available_elements;
        private GitgExt.UIElement? d_current;
        private Gd.Stack d_stack;
+       private bool d_use_icons;
 
        public signal void activated(GitgExt.UIElement element);
 
@@ -149,7 +150,7 @@ public class UIElements<T>
                d_stack.add_with_properties(e.widget,
                                            "name", e.id,
                                            "title", e.display_name,
-                                           "symbolic-icon-name", e.icon);
+                                           "symbolic-icon-name", d_use_icons ? e.icon : null);
 
                int insert_position = 0;
                unowned List<GitgExt.UIElement> item = d_available_elements;
@@ -228,10 +229,12 @@ public class UIElements<T>
        }
 
        public UIElements(Peas.ExtensionSet extensions,
-                         Gd.Stack? stack = null)
+                         Gd.Stack? stack = null,
+                         bool use_icons = false)
        {
                d_extensions = extensions;
                d_stack = stack;
+               d_use_icons = use_icons;
 
                d_elements = new HashTable<string, GitgExt.UIElement>(str_hash, str_equal);
 
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index ad7280b..fdd85ce 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -37,6 +37,7 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
 
        private Gd.HeaderSimpleButton d_button_open_repository;
        private Gd.HeaderSimpleButton d_button_dash;
+       private Gd.StackSwitcher d_repository_view_switcher;
        private Gd.StackSwitcher d_commit_view_switcher;
 
        private Gd.Stack d_main_stack;
@@ -179,6 +180,9 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
                d_paned_panels = builder.get_object("paned_panels") as Gtk.Paned;
 
                d_stack_view = builder.get_object("stack_view") as Gd.Stack;
+               d_repository_view_switcher = builder.get_object("repository-view-switcher") as 
Gd.StackSwitcher;
+               d_repository_view_switcher.stack = d_stack_view;
+
                d_stack_panel = builder.get_object("stack_panel") as Gd.Stack;
                d_commit_view_switcher = builder.get_object("commit-view-switcher") as Gd.StackSwitcher;
                d_commit_view_switcher.stack = d_stack_panel;
@@ -315,7 +319,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
                                                                               typeof(GitgExt.Panel),
                                                                               "application",
                                                                               this),
-                                                        d_stack_panel);
+                                                        d_stack_panel,
+                                                        true);
 
                d_panels.activated.connect(on_panel_activated);
 
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index f900998..a470e46 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -18,6 +18,11 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="vexpand">False</property>
+            <child type="title">
+              <object class="GdStackSwitcher" id="repository-view-switcher">
+                <property name="visible">False</property>
+              </object>
+            </child>
             <child>
               <object class="GdHeaderSimpleButton" id="button_open_repository">
                 <property name="visible">False</property>


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