[rhythmbox] entry-view: fix rb_entry_view_scroll_to_iter with gtk 3.14
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] entry-view: fix rb_entry_view_scroll_to_iter with gtk 3.14
- Date: Tue, 16 Sep 2014 12:43:44 +0000 (UTC)
commit 72b3e34ff8763ddb8a8642780ee843eda8c8aeaa
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Sep 16 22:36:46 2014 +1000
entry-view: fix rb_entry_view_scroll_to_iter with gtk 3.14
Since scrolling the tree view is now animated, the row visibility checks in
gtk_tree_view_set_cursor don't work when it's called immediately after
gtk_tree_view_scroll_to_cell - so it scrolls again, and picks a target point
that leaves the selected row at the top or bottom of the view rather than the
middle. Instead of gtk_tree_view_set_cursor, just select the row by
manipulating the GtkTreeSelection.
widgets/rb-entry-view.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index 75bff19..a9db4bc 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -2309,8 +2309,12 @@ rb_entry_view_scroll_to_iter (RBEntryView *view,
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view->priv->treeview), path,
gtk_tree_view_get_column (GTK_TREE_VIEW (view->priv->treeview), 0),
TRUE, 0.5, 0.0);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (view->priv->treeview), path,
- gtk_tree_view_get_column (GTK_TREE_VIEW (view->priv->treeview), 0), FALSE);
+
+ if ((gtk_tree_selection_count_selected_rows (view->priv->selection) != 1) ||
+ (gtk_tree_selection_path_is_selected (view->priv->selection, path) == FALSE)) {
+ gtk_tree_selection_unselect_all (view->priv->selection);
+ gtk_tree_selection_select_iter (view->priv->selection, iter);
+ }
gtk_tree_path_free (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]