[gitg] Notify the navigation when repository changes



commit 01b8ee2cccf29883cdbbaf9e54230e8bd9a6d4c3
Author: Techlive Zheng <techlivezheng gmail com>
Date:   Thu May 23 21:55:17 2013 +0800

    Notify the navigation when repository changes

 plugins/history/gitg-history-navigation.vala |   17 +++++++++++++++++
 plugins/history/gitg-history.vala            |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/plugins/history/gitg-history-navigation.vala b/plugins/history/gitg-history-navigation.vala
index eeb68d1..5c86a2b 100644
--- a/plugins/history/gitg-history-navigation.vala
+++ b/plugins/history/gitg-history-navigation.vala
@@ -93,6 +93,17 @@ namespace GitgHistory
                        populate(d_repository);
                }
 
+               [Notify]
+               public Gitg.Repository repository
+               {
+                       get { return d_repository; }
+                       set
+                       {
+                               d_repository = value;
+                               reload();
+                       }
+               }
+
                private static int sort_refs(Gitg.Ref a, Gitg.Ref b)
                {
                        return a.parsed_name.shortname.ascii_casecmp(b.parsed_name.shortname);
@@ -399,6 +410,12 @@ namespace GitgHistory
                        d_callbacks.length = 0;
                }
 
+               public void reload()
+               {
+                       clear();
+                       populate(d_repository);
+               }
+
                public void activate(Gtk.TreeIter iter, int numclick)
                {
                        uint oid;
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index 5794a62..c8b77b8 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -186,6 +186,9 @@ namespace GitgHistory
                        d_navigation.model.ref_activated.connect((r) => {
                                on_ref_activated(d_navigation.model, r);
                        });
+
+                       application.bind_property("repository", d_navigation.model, "repository", 
BindingFlags.DEFAULT);
+
                        d_navigation.set_show_expanders(d_navigation.model.show_expanders);
                        if (d_navigation.model.show_expanders)
                        {


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