[MPlayer-cvslog] r34452 - trunk/gui/ui/gtk/fileselect.c

ib subversion at mplayerhq.hu
Tue Dec 20 17:34:39 CET 2011


Author: ib
Date: Tue Dec 20 17:34:38 2011
New Revision: 34452

Log:
Remember the lastly selected file in file selector.

Don't move the focus / selection from that file.

Modified:
   trunk/gui/ui/gtk/fileselect.c

Modified: trunk/gui/ui/gtk/fileselect.c
==============================================================================
--- trunk/gui/ui/gtk/fileselect.c	Tue Dec 20 01:11:26 2011	(r34451)
+++ trunk/gui/ui/gtk/fileselect.c	Tue Dec 20 17:34:38 2011	(r34452)
@@ -59,6 +59,8 @@ const gchar   * fsFilter = "*";
 
 int             fsType    = 0;
 
+static gint     fsCurrFNameListSelected, fsLastFNameListSelected;
+
 char * fsVideoFilterNames[][2] =
          {
 	   { "ASF files (*.asf)",					"*.asf" },
@@ -243,7 +245,6 @@ static void CheckDir( GtkWidget * list )
  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 @@ void ShowFileSelect( int type,int modal 
  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 @@ void HideFileSelect( void )
  gtk_widget_hide( fsFileSelect );
  gtk_widget_destroy( fsFileSelect );
  fsFileSelect=NULL;
+ fsLastFNameListSelected = fsCurrFNameListSelected;
 }
 
 static void fs_PersistantHistory( char * subject )
@@ -484,6 +489,7 @@ static void fs_Ok_released( GtkButton * 
    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_Cancel_released( GtkButto
 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 @@ static gboolean on_FileSelect_key_releas
          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 ) );


More information about the MPlayer-cvslog mailing list