[totem] Make "Also disable the screensaver when playing audio" clearer



commit 4b2d22d9038b5b9eb7b400470746d0268d4d399d
Author: Bastien Nocera <hadess hadess net>
Date:   Wed May 5 16:28:03 2010 +0100

    Make "Also disable the screensaver when playing audio" clearer
    
    "Also disable the screensaver when playing audio" is mysterious,
    so make the use of the preference clearer using radio buttons,
    instead of a single checkbox button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=605370

 data/totem.ui           |   87 +++++++++++++++++++++++++++++-----------------
 src/totem-preferences.c |   35 ++++++++++++-------
 2 files changed, 77 insertions(+), 45 deletions(-)
---
diff --git a/data/totem.ui b/data/totem.ui
index 0d8ca82..c43be32 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -1214,38 +1214,6 @@
 		    </packing>
 	    </child>
 		  <child>
-		    <object class="GtkAlignment" id="alignment8">
-		      <property name="visible">True</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xscale">1</property>
-		      <property name="yscale">1</property>
-		      <property name="top_padding">0</property>
-		      <property name="bottom_padding">0</property>
-		      <property name="left_padding">12</property>
-		      <property name="right_padding">0</property>
-		      <child>
-                <object class="GtkCheckButton" id="tpw_screensaver_checkbutton">
-                  <property name="visible">True</property>
-                  <property name="can_focus">True</property>
-                  <property name="label" translatable="yes">Also disable the screensaver when playing _audio</property>
-                  <property name="use_underline">True</property>
-                  <property name="relief">GTK_RELIEF_NORMAL</property>
-                  <property name="focus_on_click">True</property>
-                  <property name="active">False</property>
-                  <property name="inconsistent">False</property>
-                  <property name="draw_indicator">True</property>
-                  <signal name="toggled" handler="checkbutton4_toggled_cb"/>
-                </object>
-		      </child>
-		    </object>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-		  <child>
 			  <object class="GtkAlignment" id="alignment9">
 				  <property name="visible">True</property>
 				  <property name="left_padding">12</property>
@@ -1268,6 +1236,61 @@
 				  <property name="position">3</property>
 			  </packing>
 		  </child>
+                    <child>
+                      <object class="GtkAlignment" id="alignment8">
+                        <property name="visible">True</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <object class="GtkHBox" id="hbox1">
+                            <property name="visible">True</property>
+                            <child>
+                              <object class="GtkLabel" id="label1">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Disable screensaver when playing </property>
+                              </object>
+                              <packing>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="tpw_video_toggle_button">
+                                <property name="label" translatable="yes">Video</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">tpw_audio_toggle_button</property>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="tpw_audio_toggle_button">
+                                <property name="label" translatable="yes">Video or Audio</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="active">True</property>
+				<property name="draw_indicator">True</property>
+				<signal name="toggled" handler="audio_screensaver_button_toggled_cb"/>
+                              </object>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </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-preferences.c b/src/totem-preferences.c
index 9df214e..50cc09e 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -48,7 +48,7 @@
 G_MODULE_EXPORT void checkbutton1_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 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 audio_screensaver_button_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);
@@ -187,15 +187,15 @@ checkbutton3_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
 }
 
 void
-checkbutton4_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
+audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
 {
 	gboolean value;
 
 	value = gtk_toggle_button_get_active (togglebutton);
 
 	gconf_client_set_bool (totem->gc,
-			       GCONF_PREFIX"/lock_screensaver_on_audio", 
-			       !value, NULL);
+			       GCONF_PREFIX"/lock_screensaver_on_audio",
+			       value, NULL);
 }
 
 void
@@ -316,18 +316,24 @@ static void
 lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
 				      GConfEntry *entry, Totem *totem)
 {
-	GObject *item;
+	GObject *item, *radio;
+	gboolean value;
 
-	item = gtk_builder_get_object (totem->xml, "tpw_screensaver_checkbutton");
+	item = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
 	g_signal_handlers_disconnect_by_func (item,
-					      checkbutton4_toggled_cb, totem);
+					      audio_screensaver_button_toggled_cb, totem);
 
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item),
-				      !gconf_client_get_bool (totem->gc,
-							      GCONF_PREFIX"/lock_screensaver_on_audio", NULL));
+	value = gconf_client_get_bool (totem->gc,
+				       GCONF_PREFIX"/lock_screensaver_on_audio", NULL);
+	if (value != FALSE) {
+		radio = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
+	} else {
+		radio = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
+	}
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
 
 	g_signal_connect (item, "toggled",
-			  G_CALLBACK (checkbutton4_toggled_cb), totem);
+			  G_CALLBACK (audio_screensaver_button_toggled_cb), totem);
 }
 
 static void
@@ -598,8 +604,11 @@ totem_setup_preferences (Totem *totem)
 	/* Screensaver audio locking */
 	lock_screensaver_on_audio = gconf_client_get_bool (totem->gc,
 							   GCONF_PREFIX"/lock_screensaver_on_audio", NULL);
-	item = gtk_builder_get_object (totem->xml, "tpw_screensaver_checkbutton");
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), !lock_screensaver_on_audio);
+	if (lock_screensaver_on_audio != FALSE)
+		item = gtk_builder_get_object (totem->xml, "tpw_audio_toggle_button");
+	else
+		item = gtk_builder_get_object (totem->xml, "tpw_video_toggle_button");
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), TRUE);
 	gconf_client_notify_add (totem->gc, GCONF_PREFIX"/lock_screensaver_on_audio",
 				 (GConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
 				 totem, NULL, NULL);



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