Changeset 2047

Show
Ignore:
Timestamp:
02/19/10 02:30:06 (5 months ago)
Author:
tpgww
Message:

scroll to show start of selection

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/e2p_selmatch.c

    r2046 r2047  
    2828#include "e2_fileview.h" 
    2929#include "e2_filelist.h" 
     30 
     31static void _e2p_selsame_reselect (GtkTreePath *tp, GtkTreeSelection *sel) 
     32{ 
     33        gtk_tree_selection_select_path (sel, tp); 
     34        gtk_tree_path_free (tp); 
     35} 
    3036 
    3137/** 
     
    190196                } while (gtk_tree_model_iter_next (models, &iters)); 
    191197 
     198                g_hash_table_destroy (selitems); 
     199 
     200                //ensure some part of selection is visible 
     201                selpaths = gtk_tree_selection_get_selected_rows (sel, NULL); 
     202                if (selpaths != NULL) 
     203                { 
     204                        printd (DEBUG, "scroll to show selection"); 
     205                        GtkTreePath *tpath = gtk_tree_path_copy ((GtkTreePath *)selpaths->data); 
     206                        //this kills other selections 
     207                        gtk_tree_view_set_cursor (GTK_TREE_VIEW (selview->treeview), tpath, NULL, FALSE); 
     208                        //so back again, and cleanup 
     209                        g_list_foreach (selpaths, (GFunc)_e2p_selsame_reselect, sel); 
     210                        g_list_free (selpaths); 
     211                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (selview->treeview), tpath, 
     212                                        NULL, TRUE, 0.382, 0.0); 
     213                        gtk_tree_path_free (tpath); 
     214                } 
     215 
    192216                e2_filelist_enable_refresh (); 
    193                 g_hash_table_destroy (selitems); 
    194217 
    195218                return TRUE;