[gitg/wip/actions: 24/26] Scroll selection into view
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/actions: 24/26] Scroll selection into view
- Date: Sat, 12 Jul 2014 08:57:33 +0000 (UTC)
commit 1ef395dbfe5fc69899ea9e469cfb68f76f625186
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sat Jul 12 10:35:23 2014 +0200
Scroll selection into view
gitg/history/gitg-history.vala | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/gitg/history/gitg-history.vala b/gitg/history/gitg-history.vala
index 4474866..8051943 100644
--- a/gitg/history/gitg-history.vala
+++ b/gitg/history/gitg-history.vala
@@ -166,6 +166,37 @@ namespace GitgHistory
}
}
+ private void scroll_into_view()
+ {
+ if (d_main == null)
+ {
+ return;
+ }
+
+ var sel = d_main.commit_list_view.get_selection();
+
+ Gtk.TreeModel m;
+ var rows = sel.get_selected_rows(out m);
+
+ if (rows == null)
+ {
+ return;
+ }
+
+ var row = rows.data;
+
+ Gtk.TreePath startp;
+ Gtk.TreePath endp;
+
+ if (d_main.commit_list_view.get_visible_range(out startp, out endp))
+ {
+ if (row.compare(startp) < 0 || row.compare(endp) > 0)
+ {
+ d_main.commit_list_view.scroll_to_cell(row, null, true, 0, 0);
+ }
+ }
+ }
+
private void on_commit_model_finished(Gitg.CommitModel model)
{
if (d_insertsig != 0)
@@ -173,6 +204,8 @@ namespace GitgHistory
d_commit_list_model.disconnect(d_insertsig);
d_insertsig = 0;
}
+
+ scroll_into_view();
}
public bool available
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]