[MPlayer-cvslog] r36659 - trunk/gui/dialog/preferences.c

ib subversion at mplayerhq.hu
Mon Jan 20 17:45:13 CET 2014


Author: ib
Date: Mon Jan 20 17:45:13 2014
New Revision: 36659

Log:
Improve the dialog for subtitle encodings with iconv.

Allow a (preset) encoding that is not part of the list
of available encodings.

Insert this encoding into the selection list.

Modified:
   trunk/gui/dialog/preferences.c

Modified: trunk/gui/dialog/preferences.c
==============================================================================
--- trunk/gui/dialog/preferences.c	Mon Jan 20 15:21:58 2014	(r36658)
+++ trunk/gui/dialog/preferences.c	Mon Jan 20 17:45:13 2014	(r36659)
@@ -240,7 +240,11 @@ static void prEntry( GtkEditable * edita
         for ( i=0;lEncoding[i].name;i++ )
 	  if ( !gstrcmp( lEncoding[i].comment,comment ) ) break;
 	if ( lEncoding[i].comment ) mplayer( MPLAYER_SET_SUB_ENCODING,0,lEncoding[i].name );
-	 else mplayer( MPLAYER_SET_SUB_ENCODING,0,NULL );
+	else
+	{
+	 if ( strcmp( comment,MSGTR_PREFERENCES_DefaultEnc ) == 0 ) comment=NULL;
+	 mplayer( MPLAYER_SET_SUB_ENCODING,0,(char *)comment );
+	}
 	break;
 #endif
   }
@@ -790,7 +794,7 @@ static GtkWidget * CreatePreferences( vo
   gtk_box_pack_start( GTK_BOX( vbox10 ),CBSubEncoding,TRUE,FALSE,0 );
   CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_DefaultEnc );
   {
-   int i;
+   int i, listed=(sub_cp == NULL);
    iconv_t cd;
    for ( i=0;lEncoding[i].name;i++ )
    {
@@ -800,8 +804,12 @@ static GtkWidget * CreatePreferences( vo
     {
      iconv_close(cd);
      CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment );
+
+     if ( !listed )
+      if ( strcasecmp ( lEncoding[i].name, sub_cp ) == 0 ) listed=True;
     }
    }
+   if ( !listed ) CBSubEncoding_items=g_list_insert( CBSubEncoding_items,sub_cp,1 );
   }
   gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items );
   g_list_free( CBSubEncoding_items );
@@ -1234,6 +1242,7 @@ void ShowPreferences( void )
    for ( i=0;lEncoding[i].name;i++ )
     if ( !strcasecmp( sub_cp,lEncoding[i].name ) ) break;
    if ( lEncoding[i].name ) gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lEncoding[i].comment );
+   else gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),sub_cp );
   }
 #endif
 


More information about the MPlayer-cvslog mailing list