changeset 36607:6b17e4932555

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.
author ib
date Thu, 23 Jan 2014 12:09:37 +0000
parents baa7a9f7ce9e
children 28953f222517
files gui/dialog/preferences.c
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 );