[totem] Move deinterlacing to the preferences



commit 94418a2d7295de739200cc6657263076c0f2d80b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed May 5 15:57:26 2010 +0100

    Move deinterlacing to the preferences
    
    As deinterlacing is now automatic in playbin2 for interlaced streams,
    enable it by default, so that interlaced videos look nicer by default.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617283

 README                  |    2 -
 data/totem.1            |    2 -
 data/totem.schemas.in   |    6 ++--
 data/totem.ui           |   33 ++++++++++++++------
 src/totem-menu.c        |   12 -------
 src/totem-object.c      |   12 -------
 src/totem-preferences.c |   74 ++++++++++++++++++++++++++++-------------------
 7 files changed, 70 insertions(+), 71 deletions(-)
---
diff --git a/README b/README
index ec817fc..c0cfa2e 100644
--- a/README
+++ b/README
@@ -31,8 +31,6 @@ Controls
 
 Ctrl+H:
 	Hide/Show controls in windowed mode
-Ctrl+I:
-	Switch deinterlacing on and off
 P, Ctrl+Space:
 	Play/Pause
 Escape (in full screen mode):
diff --git a/data/totem.1 b/data/totem.1
index 6c24fba..b42992e 100644
--- a/data/totem.1
+++ b/data/totem.1
@@ -128,8 +128,6 @@ Global keybindings for
 .BR Totem :
 .P
 .ta \w'Down-arrow   'u	
-i	toggle interlacing on and off
-.br
 a	cycle between aspect ratios
 .br
 p	toggle between play and pause
diff --git a/data/totem.schemas.in b/data/totem.schemas.in
index 114fe37..50e2583 100644
--- a/data/totem.schemas.in
+++ b/data/totem.schemas.in
@@ -143,13 +143,13 @@
       </schema>
 
       <schema>
-        <key>/schemas/apps/totem/deinterlace</key>
-	<applyto>/apps/totem/deinterlace</applyto>
+        <key>/schemas/apps/totem/disable_deinterlacing</key>
+	<applyto>/apps/totem/disable_deinterlacing</applyto>
 	<owner>totem</owner>
 	<type>bool</type>
 	<default>FALSE</default>
 	<locale name="C">
-	  <short>Enable deinterlacing</short>
+	  <short>Whether to disable deinterlacing for interlaced movies</short>
 	</locale>
       </schema>
 
diff --git a/data/totem.ui b/data/totem.ui
index 2f31496..0d8ca82 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -276,15 +276,6 @@
             </object>
          </child>
          <child>
-            <object class="GtkToggleAction" id="deinterlace">
-               <property name="label" translatable="yes">_Deinterlace</property>
-               <property name="tooltip" translatable="yes">Deinterlace</property>
-               <property name="active">False</property>
-               <signal name="activate" handler="deinterlace_action_callback"/>
-            </object>
-            <accelerator key="I" modifiers="GDK_CONTROL_MASK"/>
-         </child>
-         <child>
             <object class="GtkToggleAction" id="show-controls">
                <property name="label" translatable="yes">Show _Controls</property>
                <property name="tooltip" translatable="yes">Show controls</property>
@@ -470,7 +461,6 @@
                <menuitem name="aspect-ratio-anamorphic" action="aspect-ratio-anamorphic"/>
                <menuitem name="aspect-ratio-dvb" action="aspect-ratio-dvb"/>
             </menu>
-            <menuitem name="deinterlace" action="deinterlace"/>
             <menuitem name="next-angle" action="next-angle"/>
 	    <menuitem name="show-controls" action="show-controls"/>
             <separator/>
@@ -1255,6 +1245,29 @@
 		      <property name="fill">False</property>
 		    </packing>
 		  </child>
+		  <child>
+			  <object class="GtkAlignment" id="alignment9">
+				  <property name="visible">True</property>
+				  <property name="left_padding">12</property>
+				  <child>
+					  <object class="GtkCheckButton" id="tpw_no_deinterlace_checkbutton">
+						  <property name="label" translatable="yes">Disable _deinterlacing of interlaced videos</property>
+						  <property name="visible">True</property>
+						  <property name="can_focus">False</property>
+						  <property name="receives_default">False</property>
+						  <property name="use_action_appearance">False</property>
+						  <property name="use_underline">True</property>
+						  <property name="draw_indicator">True</property>
+						  <signal name="toggled" handler="no_deinterlace_toggled_cb"/>
+					  </object>
+				  </child>
+			  </object>
+			  <packing>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				  <property name="position">3</property>
+			  </packing>
+		  </child>
 
 		</object>
 		<packing>
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 869545b..51bf97f 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -73,7 +73,6 @@ G_MODULE_EXPORT void about_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void plugins_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void repeat_mode_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void shuffle_mode_action_callback (GtkToggleAction *action, Totem *totem);
-G_MODULE_EXPORT void deinterlace_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void show_controls_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void show_sidebar_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void aspect_ratio_changed_callback (GtkRadioAction *action, GtkRadioAction *current, Totem *totem);
@@ -1259,17 +1258,6 @@ shuffle_mode_action_callback (GtkToggleAction *action, Totem *totem)
 }
 
 void
-deinterlace_action_callback (GtkToggleAction *action, Totem *totem)
-{
-	gboolean value;
-
-	value = gtk_toggle_action_get_active (action);
-	bacon_video_widget_set_deinterlacing (totem->bvw, value);
-	gconf_client_set_bool (totem->gc, GCONF_PREFIX"/deinterlace",
-			value, NULL);
-}
-
-void
 show_controls_action_callback (GtkToggleAction *action, Totem *totem)
 {
 	gboolean show;
diff --git a/src/totem-object.c b/src/totem-object.c
index 108e3d9..56fe2e3 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3550,18 +3550,6 @@ totem_action_handle_key_press (Totem *totem, GdkEventKey *event)
 	case GDK_H:
 		totem_action_toggle_controls (totem);
 		break;
-	case GDK_i:
-	case GDK_I: {
-			GtkToggleAction *action;
-			gboolean state;
-
-			action = GTK_TOGGLE_ACTION (gtk_action_group_get_action
-					(totem->main_action_group,
-					 "deinterlace"));
-			state = gtk_toggle_action_get_active (action);
-			gtk_toggle_action_set_active (action, !state);
-		}
-		break;
 	case GDK_M:
 	case GDK_m:
 		bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU);
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index b0a186b..9df214e 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -49,6 +49,7 @@ G_MODULE_EXPORT void checkbutton1_toggled_cb (GtkToggleButton *togglebutton, Tot
 G_MODULE_EXPORT void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void checkbutton3_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void checkbutton4_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
+G_MODULE_EXPORT void no_deinterlace_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void remember_position_checkbutton_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void connection_combobox_changed (GtkComboBox *combobox, Totem *totem);
 G_MODULE_EXPORT void visual_menu_changed (GtkComboBox *combobox, Totem *totem);
@@ -198,36 +199,53 @@ checkbutton4_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
 }
 
 void
-remember_position_checkbutton_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
+no_deinterlace_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
 {
 	gboolean value;
 
 	value = gtk_toggle_button_get_active (togglebutton);
 
+	bacon_video_widget_set_deinterlacing (totem->bvw, !value);
 	gconf_client_set_bool (totem->gc,
-			       GCONF_PREFIX"/remember_position",
+			       GCONF_PREFIX"/disable_deinterlacing",
 			       value, NULL);
-	totem->remember_position = value;
 }
 
 static void
-deinterlace_changed_cb (GConfClient *client, guint cnxn_id,
-		GConfEntry *entry, Totem *totem)
+no_deinterlace_changed_cb (GConfClient *client,
+			   guint cnxn_id,
+			   GConfEntry *entry,
+			   Totem *totem)
 {
-	GtkAction *action;
+	GObject *button;
+	gboolean value;
 
-	action = gtk_action_group_get_action (totem->main_action_group,
-			"deinterlace");
+	button = gtk_builder_get_object (totem->xml, "tpw_no_deinterlace_checkbutton");
 
-	g_signal_handlers_block_matched (G_OBJECT (action),
-			G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, totem);
+	g_signal_handlers_block_matched (button,
+					 G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, totem);
 
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-			gconf_client_get_bool (totem->gc,
-				GCONF_PREFIX"/deinterlace", NULL));
+	value = gconf_client_get_bool (totem->gc,
+				       GCONF_PREFIX"/disable_deinterlacing", NULL);
+
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), value);
+	bacon_video_widget_set_deinterlacing (totem->bvw, !value);
+
+	g_signal_handlers_unblock_matched (button,
+					   G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, totem);
+}
+
+void
+remember_position_checkbutton_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
+{
+	gboolean value;
+
+	value = gtk_toggle_button_get_active (togglebutton);
 
-	g_signal_handlers_unblock_matched (G_OBJECT (action),
-			G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, totem);
+	gconf_client_set_bool (totem->gc,
+			       GCONF_PREFIX"/remember_position",
+			       value, NULL);
+	totem->remember_position = value;
 }
 
 static void
@@ -503,8 +521,7 @@ void
 totem_setup_preferences (Totem *totem)
 {
 	GtkWidget *menu, *content_area;
-	GtkAction *action;
-	gboolean show_visuals, auto_resize, is_local, deinterlace, lock_screensaver_on_audio;
+	gboolean show_visuals, auto_resize, is_local, no_deinterlace, lock_screensaver_on_audio;
 	int connection_speed;
 	guint i, hidden;
 	char *visual, *font, *encoding;
@@ -587,6 +604,16 @@ totem_setup_preferences (Totem *totem)
 				 (GConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
 				 totem, NULL, NULL);
 
+	/* Disable deinterlacing */
+	item = gtk_builder_get_object (totem->xml, "tpw_no_deinterlace_checkbutton");
+	no_deinterlace = gconf_client_get_bool (totem->gc,
+						GCONF_PREFIX"/disable_deinterlacing", NULL);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), no_deinterlace);
+	bacon_video_widget_set_deinterlacing (totem->bvw, !no_deinterlace);
+	gconf_client_notify_add (totem->gc, GCONF_PREFIX"/disable_deinterlacing",
+				 (GConfClientNotifyFunc) no_deinterlace_changed_cb,
+				 totem, NULL, NULL);
+
 	/* Connection Speed */
 	connection_speed = bacon_video_widget_get_connection_speed (totem->bvw);
 	item = gtk_builder_get_object (totem->xml, "tpw_speed_combobox");
@@ -684,19 +711,6 @@ totem_setup_preferences (Totem *totem)
 	audio_out = bacon_video_widget_get_audio_out_type (totem->bvw);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (item), audio_out);
 
-	/* This one is for the deinterlacing menu, not really our dialog
-	 * but we do it anyway */
-	action = gtk_action_group_get_action (totem->main_action_group,
-			"deinterlace");
-	deinterlace = gconf_client_get_bool (totem->gc,
-			GCONF_PREFIX"/deinterlace", NULL);
-	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-			deinterlace);
-	bacon_video_widget_set_deinterlacing (totem->bvw, deinterlace);
-	gconf_client_notify_add (totem->gc, GCONF_PREFIX"/deinterlace",
-			(GConfClientNotifyFunc) deinterlace_changed_cb,
-			totem, NULL, NULL);
-
 	/* Subtitle font selection */
 	item = gtk_builder_get_object (totem->xml, "font_sel_button");
 	gtk_font_button_set_title (GTK_FONT_BUTTON (item),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]