[gitg/wip/simplify-arch] Put back activating the default view for an action



commit 240203d97cc206b8ee73df7255142b0d4f47764f
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Jul 1 09:53:28 2013 +0200

    Put back activating the default view for an action

 gitg/gitg-window.vala |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 8115aaa..f2e6a63 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -256,6 +256,11 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                }
 
                d_views.update();
+
+               if (d_repository != null)
+               {
+                       activate_default_view();
+               }
        }
 
        protected override bool window_state_event(Gdk.EventWindowState event)
@@ -523,6 +528,27 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                notify_property("current_view");
        }
 
+       private void activate_default_view()
+       {
+               GitgExt.View? def = null;
+
+               d_views.foreach((element) => {
+                               GitgExt.View view = (GitgExt.View)element;
+
+                               if (view.is_default_for(d_action != null ? d_action : ""))
+                               {
+                                       def = view;
+                               }
+
+                               return true;
+               });
+
+               if (def != null)
+               {
+                       d_views.current = def;
+               }
+       }
+
        private bool init(Cancellable? cancellable)
        {
                // Settings


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