[gitg/vala] Update history to implement GitgExt.UIElement and GitgExt.ObjectSelection
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/vala] Update history to implement GitgExt.UIElement and GitgExt.ObjectSelection
- Date: Tue, 17 Jul 2012 07:57:46 +0000 (UTC)
commit c97ab747951cd673bce990e9599fb7c3af5ee442
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date: Tue Jul 17 09:54:00 2012 +0200
Update history to implement GitgExt.UIElement and GitgExt.ObjectSelection
plugins/history/gitg-history.vala | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/plugins/history/gitg-history.vala b/plugins/history/gitg-history.vala
index c840b5b..99099df 100644
--- a/plugins/history/gitg-history.vala
+++ b/plugins/history/gitg-history.vala
@@ -25,9 +25,9 @@ namespace GitgHistory
/* 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 class View : Object, GitgExt.UIElement, GitgExt.View, GitgExt.ObjectSelection
{
- public GitgExt.Application? application { owned get; construct; }
+ public GitgExt.Application? application { owned get; construct set; }
private Gtk.TreeView d_view;
private GitgGtk.CommitModel? d_model;
@@ -39,6 +39,17 @@ namespace GitgHistory
owned get { return "/org/gnome/gitg/Views/History"; }
}
+ public void foreach_selected(GitgExt.ForeachObjectSelectionFunc func)
+ {
+ bool breakit = false;
+ d_view.get_selection().selected_foreach((model, path, iter) => {
+ if (!breakit)
+ {
+ breakit = !func(d_model.commit_from_iter(iter));
+ }
+ });
+ }
+
construct
{
d_model = new GitgGtk.CommitModel(application.repository);
@@ -107,6 +118,10 @@ namespace GitgHistory
d_view = ret["commit_list_view"] as Gtk.TreeView;
d_view.model = d_model;
+ d_view.get_selection().changed.connect((sel) => {
+ selection_changed();
+ });
+
d_main = ret["scrolled_window_commit_list"] as Gtk.Widget;
}
@@ -173,6 +188,11 @@ namespace GitgHistory
return ret;
}
+
+ public bool is_enabled()
+ {
+ return true;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]