changeset 36561:4e24aeb9ae64

Improve the dialog for subtitle encodings with iconv. Add only available encodings from the full list to avoid possible confusion.
author ib
date Mon, 20 Jan 2014 14:07:09 +0000
parents 67e2b2a5ce42
children 6df17a667447
files gui/dialog/preferences.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/preferences.c	Sun Jan 19 22:24:53 2014 +0000
+++ b/gui/dialog/preferences.c	Mon Jan 20 14:07:09 2014 +0000
@@ -58,6 +58,10 @@
 #include "libmpcodecs/vd.h"
 #include "libmpcodecs/ad.h"
 
+#ifdef CONFIG_ICONV
+#include <iconv.h>
+#endif
+
        GtkWidget * Preferences = NULL;
 static GtkWidget * AConfig;
 static GtkWidget * VConfig;
@@ -787,7 +791,17 @@
   CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None );
   {
    int i;
-   for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment );
+   iconv_t cd;
+   for ( i=0;lEncoding[i].name;i++ )
+   {
+    cd=iconv_open( lEncoding[i].name,"UTF-8" );
+
+    if (cd != (iconv_t) -1)
+    {
+     iconv_close(cd);
+     CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment );
+    }
+   }
   }
   gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items );
   g_list_free( CBSubEncoding_items );