[gitg] Populate the navigation tree model internally
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Populate the navigation tree model internally
- Date: Mon, 27 May 2013 07:24:29 +0000 (UTC)
commit 47f6acdd33447bb2fe05f3e2fd699aeadc41717d
Author: Techlive Zheng <techlivezheng gmail com>
Date: Thu May 23 20:46:27 2013 +0800
Populate the navigation tree model internally
plugins/history/gitg-history-navigation.vala | 13 +++++++------
plugins/history/gitg-history.vala | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/plugins/history/gitg-history-navigation.vala b/plugins/history/gitg-history-navigation.vala
index 5d76951..eeb68d1 100644
--- a/plugins/history/gitg-history-navigation.vala
+++ b/plugins/history/gitg-history-navigation.vala
@@ -73,10 +73,11 @@ namespace GitgHistory
private SList<Gtk.TreeIter?> d_parents;
private uint d_sections;
private Activated[] d_callbacks;
+ private Gitg.Repository d_repository;
public signal void ref_activated(Gitg.Ref? r);
- construct
+ public Navigation(Gitg.Repository repo)
{
set_column_types({typeof(string),
typeof(string),
@@ -88,6 +89,8 @@ namespace GitgHistory
d_callbacks = new Activated[100];
d_callbacks.length = 0;
+ d_repository = repo;
+ populate(d_repository);
}
private static int sort_refs(Gitg.Ref a, Gitg.Ref b)
@@ -100,7 +103,7 @@ namespace GitgHistory
return a.parsed_name.remote_branch.ascii_casecmp(b.parsed_name.remote_branch);
}
- public void populate(Gitg.Repository repo)
+ private void populate(Gitg.Repository repo)
{
List<Gitg.Ref> branches = new List<Gitg.Ref>();
List<Gitg.Ref> tags = new List<Gitg.Ref>();
@@ -411,11 +414,8 @@ namespace GitgHistory
public class NavigationView : Gtk.TreeView
{
- construct
+ private void build_ui()
{
- var model = new Navigation();
- set_model(model);
-
var col = new Gtk.TreeViewColumn();
var padcell = new Gtk.CellRendererText();
@@ -486,6 +486,7 @@ namespace GitgHistory
public new Navigation model
{
get { return base.get_model() as Navigation; }
+ set { set_model(value); build_ui(); }
}
private bool select_first_in(Gtk.TreeIter? parent, bool seldef)
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index f970071..5794a62 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -182,7 +182,7 @@ namespace GitgHistory
d_main = ret["paned_views"] as Gtk.Paned;
d_navigation = ret["navigation_view"] as GitgHistory.NavigationView;
- d_navigation.model.populate(application.repository);
+ d_navigation.model = new Navigation(application.repository);
d_navigation.model.ref_activated.connect((r) => {
on_ref_activated(d_navigation.model, r);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]