changeset 34364:b02b6ad1b7fb

Remember the lastly selected file in file selector. Don't move the focus / selection from that file.
author ib
date Tue, 20 Dec 2011 16:34:38 +0000
parents 995cbc4b5884
children 0909b0da0d5b
files gui/ui/gtk/fileselect.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gui/ui/gtk/fileselect.c	Tue Dec 20 00:11:26 2011 +0000
+++ b/gui/ui/gtk/fileselect.c	Tue Dec 20 16:34:38 2011 +0000
@@ -59,6 +59,8 @@
 
 int             fsType    = 0;
 
+static gint     fsCurrFNameListSelected, fsLastFNameListSelected;
+
 char * fsVideoFilterNames[][2] =
          {
 	   { "ASF files (*.asf)",					"*.asf" },
@@ -243,7 +245,6 @@
  globfree( &gg );
 
  gtk_clist_set_column_width( GTK_CLIST( list ),0,17 );
- gtk_clist_select_row( GTK_CLIST( list ),0,1 );
  gtk_widget_show( list );
 }
 
@@ -359,6 +360,9 @@
  gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
 
  gtk_widget_grab_focus( fsFNameList );
+ ((GtkCList *)fsFNameList)->focus_row = fsLastFNameListSelected;
+ gtk_clist_select_row( GTK_CLIST( fsFNameList ),fsLastFNameListSelected,1 );
+ fsLastFNameListSelected = 0;
 
  gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
 
@@ -371,6 +375,7 @@
  gtk_widget_hide( fsFileSelect );
  gtk_widget_destroy( fsFileSelect );
  fsFileSelect=NULL;
+ fsLastFNameListSelected = fsCurrFNameListSelected;
 }
 
 static void fs_PersistantHistory( char * subject )
@@ -484,6 +489,7 @@
    fsSelectedFile=fsThatDir;
    CheckDir( fsFNameList );
    gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() );
+   gtk_widget_grab_focus( fsFNameList );
    return;
   }
 
@@ -534,6 +540,7 @@
 static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column,
                                        GdkEventButton *bevent, gpointer user_data)
 {
+ fsCurrFNameListSelected = row;
  gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
  g_free( fsSelectedFileUtf8 );
  fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
@@ -558,7 +565,6 @@
          break;
     case GDK_Return:
          gtk_button_released( GTK_BUTTON( fsOk ) );
-         gtk_widget_grab_focus( fsFNameList );
          break;
     case GDK_BackSpace:
          gtk_button_released( GTK_BUTTON( fsUp ) );