# HG changeset patch # User ib # Date 1390245934 0 # Node ID a1a82a21b30c9a595c774b5c86d679860c9c740f # Parent bec86410237f8fec9b50c501d6fbae0ba8d79fbf Improve the dialog for subtitle encodings with iconv. Disable the subtitle encodings combo box if no encoding is selected, but either option 'sub_utf8' or option 'sub_unicode' is active. Together with r36661 and r36660 this describes the somehow complicated relationship between the three subtitle options 'sub_cp', 'sub_utf8' and 'sub_unicode' and hopefully makes it intuitively comprehensible to the GUI user now. diff -r bec86410237f -r a1a82a21b30c gui/dialog/preferences.c --- a/gui/dialog/preferences.c Mon Jan 20 17:29:21 2014 +0000 +++ b/gui/dialog/preferences.c Mon Jan 20 19:25:34 2014 +0000 @@ -245,6 +245,7 @@ if ( strcmp( comment,MSGTR_PREFERENCES_DefaultEnc ) == 0 ) comment=NULL; mplayer( MPLAYER_SET_SUB_ENCODING,0,(char *)comment ); } + if ( !comment) gtk_widget_set_sensitive( CBSubEncoding,(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUtf8)) && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUnicode))) ); gtk_widget_set_sensitive( CBSubUtf8,(comment == NULL) ); gtk_widget_set_sensitive( CBSubUnicode,((comment == NULL) && !gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(CBSubUtf8) )) ); break; @@ -262,9 +263,13 @@ static void button_toggled( GtkToggleButton *button, gpointer user_data ) { + (void) button; (void) user_data; - gtk_widget_set_sensitive( CBSubUnicode,!gtk_toggle_button_get_active(button) ); +#ifdef CONFIG_ICONV + if ( !sub_cp ) gtk_widget_set_sensitive( CBSubEncoding,(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUtf8)) && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUnicode))) ); +#endif + gtk_widget_set_sensitive( CBSubUnicode,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUtf8)) ); } static void prButton( GtkButton * button, gpointer user_data ) @@ -1083,6 +1088,7 @@ gtk_signal_connect( GTK_OBJECT( BLoadFont ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLFont ); gtk_signal_connect( GTK_OBJECT( CBSubUtf8 ),"toggled",GTK_SIGNAL_FUNC( button_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBSubUnicode ),"toggled",GTK_SIGNAL_FUNC( button_toggled ),NULL ); #if 0 gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( on_CBNormalize_toggled ),NULL ); gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( on_CBSoftwareMixer_toggled ),NULL ); @@ -1097,7 +1103,6 @@ gtk_signal_connect( GTK_OBJECT( CBFlip ),"toggled",GTK_SIGNAL_FUNC( on_CBFlip_toggled ),NULL ); gtk_signal_connect( GTK_OBJECT( CBPostprocess ),"toggled",GTK_SIGNAL_FUNC( on_CBPostprocess_toggled ),NULL ); gtk_signal_connect( GTK_OBJECT( CBNoAutoSub ),"toggled",GTK_SIGNAL_FUNC( on_CBNoAutoSub_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBSubUnicode ),"toggled",GTK_SIGNAL_FUNC( on_CNSubUnicode_toggled ),NULL ); gtk_signal_connect( GTK_OBJECT( CBDumpMPSub ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpMPSub_toggled ),NULL ); gtk_signal_connect( GTK_OBJECT( CBDumpSrt ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpSrt_toggled ),NULL ); #endif @@ -1256,6 +1261,7 @@ gtk_widget_set_sensitive( CBSubUtf8,FALSE ); gtk_widget_set_sensitive( CBSubUnicode,FALSE ); } + else gtk_widget_set_sensitive( CBSubEncoding,(!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUtf8)) && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CBSubUnicode))) ); #endif /* 4th page */