# HG changeset patch # User ib # Date 1390478977 0 # Node ID 6b17e4932555354f213c690c4b2baf3458e8f34b # Parent baa7a9f7ce9ebf5d4dcd43ab1fb77b559408f202 Improve the dialog for font encodings. In case iconv is available, add only available encodings from the full list to avoid possible confusion. In any case (and especially if iconv isn't available) add UNICODE, since this is internally provided by MPlayer. diff -r baa7a9f7ce9e -r 6b17e4932555 gui/dialog/preferences.c --- a/gui/dialog/preferences.c Wed Jan 22 19:38:44 2014 +0000 +++ b/gui/dialog/preferences.c Thu Jan 23 12:09:37 2014 +0000 @@ -583,6 +583,7 @@ GtkWidget * hbox7; #endif #ifdef CONFIG_ICONV + iconv_t cd; GList * CBSubEncoding_items = NULL; #endif GtkWidget * vbox7; @@ -811,7 +812,7 @@ CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_DefaultEnc ); { int i, listed=(sub_cp == NULL); - iconv_t cd; + for ( i=0;lEncoding[i].name;i++ ) { cd=iconv_open( "UTF-8",lEncoding[i].name ); @@ -908,8 +909,21 @@ gtk_widget_show( CBFontEncoding ); gtk_table_attach( GTK_TABLE( table1 ),CBFontEncoding,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); { - int i; - for ( i=0;lEncoding[i].name;i++ ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment ); + int i, append; + for ( i=0;lEncoding[i].name;i++ ) + { + append=(strcasecmp( lEncoding[i].name,"UNICODE" ) == 0); +#ifdef CONFIG_ICONV + cd=iconv_open( "ucs-4",lEncoding[i].name ); + + if (cd != (iconv_t) -1) + { + iconv_close(cd); + append=True; + } +#endif + if ( append ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment ); + } } gtk_combo_set_popdown_strings( GTK_COMBO( CBFontEncoding ),CBFontEncoding_items ); g_list_free( CBFontEncoding_items );