[gnome-games/gnome-2-28] aisleriot: maemo5: Scroll the game type selector to the current game



commit b2361f320523ea228c0e002a13bd4a4115961bc8
Author: Christian Persch <chpe gnome org>
Date:   Fri Nov 27 18:32:58 2009 +0100

    aisleriot: maemo5: Scroll the game type selector to the current game
    
    Since there's no selection on maemo5 for the treeview in the pannable
    area, just use current_iter to scroll the treeview to the right place,
    instead of getting the selected iter (after having just set it above).

 aisleriot/window.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/aisleriot/window.c b/aisleriot/window.c
index f3f2941..8983973 100644
--- a/aisleriot/window.c
+++ b/aisleriot/window.c
@@ -276,7 +276,7 @@ select_game_cb (GtkAction *action,
   GtkTreeViewColumn *column;
   GtkCellRenderer *renderer;
   GtkWidget *hbox;
-  GtkTreeIter current_iter, selection_iter;
+  GtkTreeIter current_iter;
   gboolean current_iter_set = FALSE;
   const char *current_game_file;
   const char *games_dir;
@@ -408,13 +408,12 @@ select_game_cb (GtkAction *action,
    * and scroll to it.
    */
   if (current_iter_set) {
-    gtk_tree_selection_select_iter (selection, &current_iter);
-  }
-
-  if (gtk_tree_selection_get_selected (selection, NULL, &selection_iter)) {
     GtkTreePath *path;
 
-    path = gtk_tree_model_get_path (GTK_TREE_MODEL (list), &selection_iter);
+    gtk_tree_selection_select_iter (selection, &current_iter);
+
+    /* Scroll view to the current item */
+    path = gtk_tree_model_get_path (GTK_TREE_MODEL (list), &current_iter);
     gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (list_view), path, NULL,
                                   TRUE,
 				  0.5, 0.0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]