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

ib subversion at mplayerhq.hu
Mon Jan 20 20:25:34 CET 2014


Author: ib
Date: Mon Jan 20 20:25:34 2014
New Revision: 36662

Log:
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.

Modified:
   trunk/gui/dialog/preferences.c

Modified: trunk/gui/dialog/preferences.c
==============================================================================
--- trunk/gui/dialog/preferences.c	Mon Jan 20 18:29:21 2014	(r36661)
+++ trunk/gui/dialog/preferences.c	Mon Jan 20 20:25:34 2014	(r36662)
@@ -245,6 +245,7 @@ static void prEntry( GtkEditable * edita
 	 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 prEntry( GtkEditable * edita
 
 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 @@ static GtkWidget * CreatePreferences( vo
   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 @@ static GtkWidget * CreatePreferences( vo
   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 @@ void ShowPreferences( void )
    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 */


More information about the MPlayer-cvslog mailing list