[swell-foop] Scores dialog: autoscroll to new score
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [swell-foop] Scores dialog: autoscroll to new score
- Date: Tue, 19 Nov 2013 04:35:00 +0000 (UTC)
commit 5a6d42ee44671ddbe211421da8b2a829d092e80b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Nov 18 22:31:17 2013 -0600
Scores dialog: autoscroll to new score
By Isaac Lenton
https://bugzilla.gnome.org/show_bug.cgi?id=711736
src/swell-foop.vala | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/swell-foop.vala b/src/swell-foop.vala
index 7a83a46..49d7284 100644
--- a/src/swell-foop.vala
+++ b/src/swell-foop.vala
@@ -484,6 +484,7 @@ public class ScoreDialog : Gtk.Dialog
private Gtk.ListStore size_model;
private Gtk.ListStore score_model;
private Gtk.ComboBox size_combo;
+ private Gtk.TreeView scores;
public ScoreDialog (History history, HistoryEntry? selected_entry = null, bool show_quit = false)
{
@@ -532,7 +533,7 @@ public class ScoreDialog : Gtk.Dialog
score_model = new Gtk.ListStore (3, typeof (string), typeof (string), typeof (int));
- var scores = new Gtk.TreeView ();
+ scores = new Gtk.TreeView ();
renderer = new Gtk.CellRendererText ();
scores.insert_column_with_attributes (-1, _("Date"), renderer, "text", 0, "weight", 2);
renderer = new Gtk.CellRendererText ();
@@ -569,6 +570,20 @@ public class ScoreDialog : Gtk.Dialog
Gtk.TreeIter iter;
score_model.append (out iter);
score_model.set (iter, 0, date_label, 1, score_label, 2, weight);
+
+ if (entry == selected_entry)
+ {
+ var piter = iter;
+ if (score_model.iter_previous (ref piter))
+ {
+ var ppiter = piter;
+ if (score_model.iter_previous (ref ppiter))
+ piter = ppiter;
+ }
+ else
+ piter = iter;
+ scores.scroll_to_cell (score_model.get_path (piter), null, false, 0, 0);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]