[gitg] Add dash view to main window



commit 7f0e6f68da98fbf99b240de714d0f15e49c91979
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu Feb 28 20:53:05 2013 +0100

    Add dash view to main window

 gitg/Makefile.am                 |   10 ++-
 gitg/gitg-window.vala            |   29 ++++++++
 gitg/resources/ui/gitg-window.ui |  144 ++++++++++++++++++++++----------------
 3 files changed, 121 insertions(+), 62 deletions(-)
---
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 00c2ff1..b957eb2 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -17,18 +17,23 @@ AM_VALAFLAGS = \
        --pkg Ggit-1.0                                          \
        --pkg libgitg-1.0                                       \
        --pkg libgitg-ext-1.0                                   \
+       --pkg libgitg-gtk-1.0                                   \
        --pkg gtk+-3.0                                          \
        --pkg gio-2.0                                           \
        --pkg libpeas-1.0                                       \
        --pkg gobject-introspection-1.0                         \
        --pkg gee-1.0                                           \
        --pkg gd-1.0                                            \
+       --pkg webkit2gtk-3.0                                    \
        --girdir "$(top_builddir)/libgd"                        \
        --girdir "$(top_builddir)/libgitg"                      \
        --girdir "$(top_builddir)/libgitg-ext"                  \
+       --girdir "$(top_builddir)/libgitg-gtk"                  \
+       --vapidir "$(top_srcdir)/vapi"                          \
        --vapidir "$(top_builddir)/libgd"                       \
        --vapidir "$(top_builddir)/libgitg"                     \
-       --vapidir "$(top_builddir)/libgitg-ext"
+       --vapidir "$(top_builddir)/libgitg-ext"                 \
+       --vapidir "$(top_builddir)/libgitg-gtk"
 
 VALASOURCES =                                                  \
        gitg.vala                                               \
@@ -55,7 +60,8 @@ gitg_LDADD =                                                  \
        $(PACKAGE_LIBS)                                         \
        $(top_builddir)/libgd/libgd.la                          \
        $(top_builddir)/libgitg/libgitg-1.0.la                  \
-       $(top_builddir)/libgitg-ext/libgitg-ext-1.0.la
+       $(top_builddir)/libgitg-ext/libgitg-ext-1.0.la          \
+       $(top_builddir)/libgitg-gtk/libgitg-gtk-1.0.la
 
 gitg_LDFLAGS = -export-dynamic -no-undefined -export-symbols-regex "^[[^_]].*"
 
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 270f5e8..9a5c887 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -35,8 +35,13 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
        private Gd.HeaderBar d_header_bar;
        private Gtk.MenuButton d_config;
 
+       private Gd.HeaderSimpleButton d_button_dash;
        private Gd.StackSwitcher d_commit_view_switcher;
 
+       private Gd.Stack d_main_stack;
+
+       private GitgGtk.DashView d_dash_view;
+
        private Gtk.Paned d_paned_views;
        private Gtk.Paned d_paned_panels;
 
@@ -70,6 +75,19 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
 
        private void repository_changed()
        {
+               if (d_repository != null)
+               {
+                       d_main_stack.set_visible_child(d_paned_views);
+                       d_commit_view_switcher.show();
+                       d_button_dash.show();
+               }
+               else
+               {
+                       d_main_stack.set_visible_child(d_dash_view);
+                       d_commit_view_switcher.hide();
+                       d_button_dash.hide();
+               }
+
                d_views.update();
                activate_default_view();
        }
@@ -94,6 +112,17 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
        {
                // Extract widgets from the builder
                d_header_bar = builder.get_object("header-bar") as Gd.HeaderBar;
+               d_button_dash = builder.get_object("button_dash") as Gd.HeaderSimpleButton;
+               d_button_dash.clicked.connect((b) => {
+                       repository = null;
+               });
+
+               d_main_stack = builder.get_object("main_stack") as Gd.Stack;
+
+               d_dash_view = builder.get_object("dash_view") as GitgGtk.DashView;
+               d_dash_view.repository_activated.connect((r) => {
+                       repository = r;
+               });
 
                d_paned_views = builder.get_object("paned_views") as Gtk.Paned;
                d_paned_panels = builder.get_object("paned_panels") as Gtk.Paned;
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index 1af75bf..9b61e99 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -19,6 +19,16 @@
             <property name="can_focus">False</property>
             <property name="vexpand">False</property>
             <child>
+              <object class="GdHeaderSimpleButton" id="button_dash">
+                <property name="visible">False</property>
+                <property name="can_focus">False</property>
+                <property name="symbolic_icon_name">view-list-symbolic</property>
+              </object>
+              <packing>
+                <property name="pack_type">start</property>
+              </packing>
+            </child>
+            <child>
               <object class="GdHeaderToggleButton" id="search-button">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -30,7 +40,7 @@
             </child>
             <child>
               <object class="GdStackSwitcher" id="commit-view-switcher">
-                <property name="visible">True</property>
+                <property name="visible">False</property>
               </object>
               <packing>
                 <property name="pack_type">end</property>
@@ -115,103 +125,117 @@
           </packing>
         </child>
         <child>
-          <object class="GtkPaned" id="paned_views">
+          <object class="GdStack" id="main_stack">
             <property name="visible">True</property>
-            <property name="can_focus">True</property>
+            <property name="can_focus">False</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="position">200</property>
-            <property name="position_set">True</property>
             <child>
-              <object class="GtkEventBox" id="navigation_background">
+              <object class="GitgGtkDashView" id="dash_view">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <style>
-                  <class name="sidebar"/>
-                </style>
+                <property name="can_focus">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkPaned" id="paned_views">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="position">200</property>
+                <property name="position_set">True</property>
                 <child>
-                  <object class="GtkGrid" id="grid_navigation">
+                  <object class="GtkEventBox" id="navigation_background">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
+                    <style>
+                      <class name="sidebar"/>
+                    </style>
                     <child>
-                      <object class="GtkScrolledWindow" id="scrolled_window_navigation">
+                      <object class="GtkGrid" id="grid_navigation">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
-                        <property name="vexpand">True</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="name">scrolled_window_navigation</property>
                         <child>
-                          <object class="GitgExtNavigationTreeView" id="tree_view_navigation">
+                          <object class="GtkScrolledWindow" id="scrolled_window_navigation">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="headers_visible">False</property>
-                            <property name="name">tree_view_navigation</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="gitgextnavigationtreeView-selection"/>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="name">scrolled_window_navigation</property>
+                            <child>
+                              <object class="GitgExtNavigationTreeView" id="tree_view_navigation">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="headers_visible">False</property>
+                                <property name="name">tree_view_navigation</property>
+                                <child internal-child="selection">
+                                  <object class="GtkTreeSelection" id="gitgextnavigationtreeView-selection"/>
+                                </child>
+                              </object>
                             </child>
                           </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
-                      </packing>
                     </child>
                   </object>
+                  <packing>
+                    <property name="resize">False</property>
+                    <property name="shrink">True</property>
+                  </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="resize">False</property>
-                <property name="shrink">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkPaned" id="paned_panels">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="orientation">vertical</property>
-                <property name="position">300</property>
                 <child>
-                  <object class="GtkEventBox" id="frame_background">
+                  <object class="GtkPaned" id="paned_panels">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="orientation">vertical</property>
+                    <property name="position">300</property>
                     <child>
-                      <object class="GdStack" id="stack_view">
+                      <object class="GtkEventBox" id="frame_background">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <child>
-                          <placeholder/>
+                          <object class="GdStack" id="stack_view">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
                         </child>
                       </object>
+                      <packing>
+                        <property name="resize">True</property>
+                        <property name="shrink">True</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="resize">True</property>
-                    <property name="shrink">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GdStack" id="stack_panel">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
                     <child>
-                      <placeholder/>
+                      <object class="GdStack" id="stack_panel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="resize">False</property>
+                        <property name="shrink">True</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
-                    <property name="resize">False</property>
+                    <property name="resize">True</property>
                     <property name="shrink">True</property>
                   </packing>
                 </child>
               </object>
-              <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
-              </packing>
             </child>
           </object>
           <packing>


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