[gitg/vala] Implemented filtering of history based on history navigation selection
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/vala] Implemented filtering of history based on history navigation selection
- Date: Fri, 6 Jul 2012 17:37:25 +0000 (UTC)
commit c79872a8c1e26e5e66059b48c824c899a566f177
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Fri Jul 6 18:50:16 2012 +0200
Implemented filtering of history based on history navigation selection
plugins/history/gitg-history-navigation.vala | 22 ++++++++++++++++++----
plugins/history/gitg-history.vala | 15 ++++++++++++++-
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/plugins/history/gitg-history-navigation.vala b/plugins/history/gitg-history-navigation.vala
index f477ce3..b5429d4 100644
--- a/plugins/history/gitg-history-navigation.vala
+++ b/plugins/history/gitg-history-navigation.vala
@@ -23,6 +23,8 @@ namespace GitgHistory
{
public GitgExt.Application? application { owned get; construct; }
+ public signal void ref_activated(Gitg.Ref r);
+
public Navigation(GitgExt.Application app)
{
Object(application: app);
@@ -99,15 +101,19 @@ namespace GitgHistory
foreach (var item in branches)
{
+ var it = item;
+
if (head != null && item.get_id().equal(head.get_id()))
{
model.append_default(item.parsed_name.shortname,
"object-select-symbolic",
- null);
+ (nc) => ref_activated(it));
}
else
{
- model.append(item.parsed_name.shortname, null, null);
+ model.append(item.parsed_name.shortname,
+ null,
+ (nc) => ref_activated(it));
}
}
@@ -122,7 +128,11 @@ namespace GitgHistory
foreach (var rref in remotes.lookup(rname))
{
- model.append(rref.parsed_name.remote_branch, null, null);
+ var it = rref;
+
+ model.append(rref.parsed_name.remote_branch,
+ null,
+ (nc) => ref_activated(it));
}
model.end_header();
@@ -135,7 +145,11 @@ namespace GitgHistory
foreach (var item in tags)
{
- model.append(item.parsed_name.shortname, null, null);
+ var it = item;
+
+ model.append(item.parsed_name.shortname,
+ null,
+ (nc) => ref_activated(it));
}
}
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index 850c1c9..10b0d2b 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -22,6 +22,9 @@ namespace GitgHistory
// Do this to pull in config.h before glib.h (for gettext...)
private const string version = Gitg.Config.VERSION;
+ /* The main history view. This view shows the equivalent of git log, but
+ * in a nice way with lanes, merges, ref labels etc.
+ */
public class View : Object, GitgExt.View
{
public GitgExt.Application? application { owned get; construct; }
@@ -39,6 +42,7 @@ namespace GitgHistory
construct
{
d_model = new GitgGtk.CommitModel(application.repository);
+
application.bind_property("repository", d_model, "repository", BindingFlags.DEFAULT);
}
@@ -75,8 +79,13 @@ namespace GitgHistory
{
owned get
{
+ // Create the sidebar navigation for the history. This navigation
+ // will show branches, remotes and tags which can be used to
+ // filter the history
var ret = new Navigation(application);
+ ret.ref_activated.connect(on_ref_activated);
+
return ret;
}
}
@@ -86,6 +95,11 @@ namespace GitgHistory
return application.repository != null && action == GitgExt.ViewAction.HISTORY;
}
+ private void on_ref_activated(Gitg.Ref r)
+ {
+ update_walker(r);
+ }
+
private void build_ui()
{
var ret = from_builder("view-history.ui", {"scrolled_window_commit_list", "commit_list_view"});
@@ -93,7 +107,6 @@ namespace GitgHistory
d_view = ret["commit_list_view"] as Gtk.TreeView;
d_view.model = d_model;
- update_walker(null);
d_main = ret["scrolled_window_commit_list"] as Gtk.Widget;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]