[totem] screensaver: Remove lock-screensaver-on-audio preference



commit c80eeab99bf2b8ac75e909f6eb0b9fb768eb2ab8
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Jan 26 14:17:35 2014 +0100

    screensaver: Remove lock-screensaver-on-audio preference
    
    Totem isn't built to play audio files, so we'll always inhibit
    the screensaver when playing anything. If you're playing audio
    files, at least you know what you're in for.

 data/org.gnome.totem.gschema.xml.in.in      |    5 --
 data/preferences.ui                         |   56 ---------------------------
 data/totem.convert                          |    1 -
 src/plugins/screensaver/totem-screensaver.c |   51 +------------------------
 src/totem-preferences.c                     |   41 -------------------
 5 files changed, 1 insertions(+), 153 deletions(-)
---
diff --git a/data/org.gnome.totem.gschema.xml.in.in b/data/org.gnome.totem.gschema.xml.in.in
index 0542e65..72da8e7 100644
--- a/data/org.gnome.totem.gschema.xml.in.in
+++ b/data/org.gnome.totem.gschema.xml.in.in
@@ -1,11 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <schemalist>
        <schema id="org.gnome.totem" path="/org/gnome/Totem/" gettext-domain="@GETTEXT_PACKAGE@">
-               <key name="lock-screensaver-on-audio" type="b">
-                       <default>true</default>
-                       <_summary>Allow the screensaver to activate when playing audio</_summary>
-                       <_description>Allow the screensaver to activate when playing audio. Disable if you 
have monitor-powered speakers.</_description>
-               </key>
                <key name="show-visualizations" type="b">
                        <default>false</default>
                        <_summary>Show visual effects when no video is displayed</_summary>
diff --git a/data/preferences.ui b/data/preferences.ui
index baa89c9..c79ba76 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -578,62 +578,6 @@
                                  <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>
-                            <property name="spacing">4</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" comments="Translators: this is 
part of the sentence 'Disable screensaver when playing [] Video [] Video or Audio" context="Screensaver 
disable">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" comments="Translators: this is 
part of the sentence 'Disable screensaver when playing [] Video [] Video or Audio">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/data/totem.convert b/data/totem.convert
index 500e122..bf65e3b 100644
--- a/data/totem.convert
+++ b/data/totem.convert
@@ -1,5 +1,4 @@
 [org.gnome.totem]
-lock-screensaver-on-audio = /apps/totem/lock_screensaver_on_audio
 show-visualizations = /apps/totem/show_vfx
 visualization-name = /apps/totem/visual
 brightness = /apps/totem/brightness
diff --git a/src/plugins/screensaver/totem-screensaver.c b/src/plugins/screensaver/totem-screensaver.c
index c376f7b..c979b0c 100644
--- a/src/plugins/screensaver/totem-screensaver.c
+++ b/src/plugins/screensaver/totem-screensaver.c
@@ -49,11 +49,9 @@
 typedef struct {
        TotemObject *totem;
        BaconVideoWidget *bvw;
-       GSettings *settings;
 
        gboolean       inhibit_available;
        guint          handler_id_playing;
-       guint          handler_id_metadata;
        guint          inhibit_cookie;
 } TotemScreensaverPluginPrivate;
 
@@ -61,33 +59,11 @@ TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SCREENSAVER_PLUGIN,
                      TotemScreensaverPlugin,
                      totem_screensaver_plugin)
 
-static gboolean
-has_video (BaconVideoWidget *bvw)
-{
-       GValue value = { 0, };
-       gboolean ret;
-
-       bacon_video_widget_get_metadata (bvw, BVW_INFO_HAS_VIDEO, &value);
-       ret = g_value_get_boolean (&value);
-       g_value_unset (&value);
-
-       return ret;
-}
-
 static void
 totem_screensaver_update_from_state (TotemObject *totem,
                                     TotemScreensaverPlugin *pi)
 {
-       gboolean lock_screensaver_on_audio, has_video_frames;
-       BaconVideoWidget *bvw;
-
-       bvw = BACON_VIDEO_WIDGET (totem_object_get_video_widget ((Totem *)(totem)));
-
-       lock_screensaver_on_audio = g_settings_get_boolean (pi->priv->settings, "lock-screensaver-on-audio");
-       has_video_frames = has_video (bvw);
-
-       if ((totem_object_is_playing (totem) != FALSE && has_video_frames) ||
-           (totem_object_is_playing (totem) != FALSE && !lock_screensaver_on_audio)) {
+       if (totem_object_is_playing (totem) != FALSE) {
                if (pi->priv->inhibit_cookie == 0 &&
                    pi->priv->inhibit_available) {
                        GtkWindow *window;
@@ -118,18 +94,6 @@ property_notify_cb (TotemObject *totem,
 }
 
 static void
-got_metadata_cb (BaconVideoWidget *bvw, TotemScreensaverPlugin *pi)
-{
-       totem_screensaver_update_from_state (pi->priv->totem, pi);
-}
-
-static void
-lock_screensaver_on_audio_changed_cb (GSettings *settings, const gchar *key, TotemScreensaverPlugin *pi)
-{
-       totem_screensaver_update_from_state (pi->priv->totem, pi);
-}
-
-static void
 impl_activate (PeasActivatable *plugin)
 {
        TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
@@ -140,17 +104,10 @@ impl_activate (PeasActivatable *plugin)
        totem = g_object_get_data (G_OBJECT (plugin), "object");
        pi->priv->bvw = BACON_VIDEO_WIDGET (totem_object_get_video_widget (totem));
 
-       pi->priv->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
-       g_signal_connect (pi->priv->settings, "changed::lock-screensaver-on-audio", (GCallback) 
lock_screensaver_on_audio_changed_cb, plugin);
-
        pi->priv->handler_id_playing = g_signal_connect (G_OBJECT (totem),
                                                   "notify::playing",
                                                   G_CALLBACK (property_notify_cb),
                                                   pi);
-       pi->priv->handler_id_metadata = g_signal_connect (G_OBJECT (pi->priv->bvw),
-                                                   "got-metadata",
-                                                   G_CALLBACK (got_metadata_cb),
-                                                   pi);
 
        pi->priv->totem = g_object_ref (totem);
 
@@ -163,18 +120,12 @@ impl_deactivate   (PeasActivatable *plugin)
 {
        TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
 
-       g_object_unref (pi->priv->settings);
-
        if (pi->priv->handler_id_playing != 0) {
                TotemObject *totem;
                totem = g_object_get_data (G_OBJECT (plugin), "object");
                g_signal_handler_disconnect (G_OBJECT (totem), pi->priv->handler_id_playing);
                pi->priv->handler_id_playing = 0;
        }
-       if (pi->priv->handler_id_metadata != 0) {
-               g_signal_handler_disconnect (G_OBJECT (pi->priv->bvw), pi->priv->handler_id_metadata);
-               pi->priv->handler_id_metadata = 0;
-       }
 
        if (pi->priv->inhibit_cookie != 0) {
                gtk_application_uninhibit (GTK_APPLICATION (pi->priv->totem), pi->priv->inhibit_cookie);
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index a608fd8..8676dd0 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -50,7 +50,6 @@
 
 /* Callback functions for GtkBuilder */
 G_MODULE_EXPORT void checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
-G_MODULE_EXPORT void audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem);
 G_MODULE_EXPORT void visual_menu_changed (GtkComboBox *combobox, Totem *totem);
 G_MODULE_EXPORT void tpw_color_reset_clicked_cb (GtkButton *button, Totem *totem);
 G_MODULE_EXPORT void font_set_cb (GtkFontButton * fb, Totem * totem);
@@ -85,15 +84,6 @@ checkbutton2_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
        totem_prefs_set_show_visuals (totem, value);
 }
 
-void
-audio_screensaver_button_toggled_cb (GtkToggleButton *togglebutton, Totem *totem)
-{
-       gboolean value;
-
-       value = gtk_toggle_button_get_active (togglebutton);
-       g_settings_set_boolean (totem->settings, "lock-screensaver-on-audio", value);
-}
-
 static void
 show_vfx_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
 {
@@ -115,28 +105,6 @@ disable_kbd_shortcuts_changed_cb (GSettings *settings, const gchar *key, TotemOb
        totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts");
 }
 
-static void
-lock_screensaver_on_audio_changed_cb (GSettings *settings, const gchar *key, TotemObject *totem)
-{
-       GObject *item, *radio;
-       gboolean value;
-
-       item = POBJ ("tpw_audio_toggle_button");
-       g_signal_handlers_disconnect_by_func (item,
-                                             audio_screensaver_button_toggled_cb, totem);
-
-       value = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
-       if (value != FALSE) {
-               radio = POBJ ("tpw_audio_toggle_button");
-       } else {
-               radio = POBJ ("tpw_video_toggle_button");
-       }
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
-
-       g_signal_connect (item, "toggled",
-                         G_CALLBACK (audio_screensaver_button_toggled_cb), totem);
-}
-
 void
 visual_menu_changed (GtkComboBox *combobox, Totem *totem)
 {
@@ -352,15 +320,6 @@ totem_setup_preferences (Totem *totem)
         g_signal_connect (totem->prefs, "destroy",
                           G_CALLBACK (gtk_widget_destroyed), &totem->prefs);
 
-       /* Screensaver audio locking */
-       lock_screensaver_on_audio = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio");
-       if (lock_screensaver_on_audio != FALSE)
-               item = POBJ ("tpw_audio_toggle_button");
-       else
-               item = POBJ ("tpw_video_toggle_button");
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), TRUE);
-       g_signal_connect (totem->settings, "changed::lock-screensaver-on-audio", (GCallback) 
lock_screensaver_on_audio_changed_cb, totem);
-
        /* Disable deinterlacing */
        item = POBJ ("tpw_no_deinterlace_checkbutton");
        g_settings_bind (totem->settings, "disable-deinterlacing", item, "active", G_SETTINGS_BIND_DEFAULT);


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