[Xfce4-commits] <parole:master> Replace checkboxes with switches in prefs dialog

Sean Davis noreply at xfce.org
Fri Oct 11 11:51:39 CEST 2013


Updating branch refs/heads/master
         to 446a49ab1eb5bee9c19133f94a3f449b2244b03c (commit)
       from 6063931151c10a172449e2c216d06e47c46eb7f0 (commit)

commit 446a49ab1eb5bee9c19133f94a3f449b2244b03c
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Mon Sep 2 21:31:27 2013 -0400

    Replace checkboxes with switches in prefs dialog

 data/interfaces/parole-settings.ui |  267 ++++++++++++++++++++++++++----------
 src/parole-conf-dialog.c           |  156 +++++++++++++++------
 2 files changed, 308 insertions(+), 115 deletions(-)

diff --git a/data/interfaces/parole-settings.ui b/data/interfaces/parole-settings.ui
index 48d14b7..fef6ad4 100644
--- a/data/interfaces/parole-settings.ui
+++ b/data/interfaces/parole-settings.ui
@@ -15,10 +15,10 @@
   </object>
   <object class="XfceTitledDialog" id="settings-dialog">
     <property name="can_focus">False</property>
+    <property name="border_width">5</property>
     <property name="title" translatable="yes">Parole Settings</property>
     <property name="modal">True</property>
     <property name="icon_name">parole</property>
-    <property name="border_width">5</property>
     <property name="type_hint">dialog</property>
     <property name="subtitle" translatable="yes">Configure your media player</property>
     <signal name="response" handler="parole_conf_dialog_response_cb" swapped="no"/>
@@ -62,9 +62,9 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_left">6</property>
-                <property name="margin_right">6</property>
+                <property name="margin_right">12</property>
                 <property name="margin_top">9</property>
-                <property name="margin_bottom">6</property>
+                <property name="margin_bottom">12</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <child>
@@ -79,14 +79,34 @@
                         <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="GtkCheckButton" id="reset-saver">
-                            <property name="label" translatable="yes">Disable screensaver while playing movies</property>
+                          <object class="GtkBox" id="box7">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="parole_conf_dialog_reset_saver_changed_cb" swapped="no"/>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="reset-saver-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Disable screensaver while playing movies</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSwitch" id="reset-saver">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -124,14 +144,34 @@
                             <property name="orientation">vertical</property>
                             <property name="spacing">4</property>
                             <child>
-                              <object class="GtkCheckButton" id="enable-vis">
-                                <property name="label" translatable="yes">Enable visualization when playing audio file</property>
+                              <object class="GtkBox" id="box8">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="xalign">0</property>
-                                <property name="draw_indicator">True</property>
-                                <signal name="toggled" handler="parole_conf_dialog_enable_vis_changed_cb" swapped="no"/>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">12</property>
+                                <child>
+                                  <object class="GtkLabel" id="enable-vis-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="label" translatable="yes">Enable visualization when playing audio file</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSwitch" id="enable-vis">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -213,14 +253,34 @@
                         <property name="can_focus">False</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="GtkCheckButton" id="multimedia-keys">
-                            <property name="label" translatable="yes">Enable keyboard multimedia keys</property>
+                          <object class="GtkBox" id="box9">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="xalign">0</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="multimedia_keys_toggled_cb" swapped="no"/>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="multimedia-keys-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Enable keyboard multimedia keys</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSwitch" id="multimedia-keys">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -428,82 +488,123 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="box5">
+              <object class="GtkGrid" id="grid3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_left">12</property>
                 <property name="margin_right">12</property>
                 <property name="margin_top">9</property>
                 <property name="margin_bottom">12</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">3</property>
+                <property name="row_spacing">3</property>
+                <property name="column_spacing">12</property>
                 <child>
-                  <object class="GtkCheckButton" id="replace-playlist">
-                    <property name="label" translatable="yes">Always replace playlist with opened files</property>
+                  <object class="GtkLabel" id="replace-playlist-label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
                     <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="replace_playlist_toggled_cb" swapped="no"/>
+                    <property name="label" translatable="yes">Always replace playlist with opened files</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="remove-duplicated">
-                    <property name="label" translatable="yes">Check and remove duplicate media entries</property>
+                  <object class="GtkLabel" id="remove-duplicated-label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
+                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="remove_duplicated_toggled_cb" swapped="no"/>
+                    <property name="label" translatable="yes">Check and remove duplicate media entries</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="start-playing-opened">
-                    <property name="label" translatable="yes">Start playing opened files</property>
+                  <object class="GtkLabel" id="start-playing-opened-label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
+                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="start_playing_opened_toggled_cb" swapped="no"/>
+                    <property name="label" translatable="yes">Start playing opened files</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="remember-playlist">
-                    <property name="label" translatable="yes">Remember playlist</property>
+                  <object class="GtkLabel" id="remember-playlist-label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
+                    <property name="can_focus">False</property>
                     <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="remember_playlist_toggled_cb" swapped="no"/>
+                    <property name="label" translatable="yes">Remember playlist</property>
                   </object>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="replace-playlist">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="remove-duplicated">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="start-playing-opened">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSwitch" id="remember-playlist">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child type="tab">
@@ -528,14 +629,35 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">4</property>
                 <child>
-                  <object class="GtkCheckButton" id="enable-subtitle">
-                    <property name="label" translatable="yes">Automatically show subtitles when playing movie file</property>
+                  <object class="GtkBox" id="box5">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="xalign">0</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="parole_conf_dialog_enable_subtitle_changed_cb" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="margin_bottom">6</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkLabel" id="enable-subtitle-label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Automatically show subtitles when playing movie file</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="enable-subtitle">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -583,10 +705,11 @@
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="hexpand">True</property>
-                        <property name="font">Sans 12</property>
+                        <property name="font"/>
                         <property name="preview_text"/>
                         <property name="show_preview_entry">False</property>
                         <property name="font_name">Sans Bold 20</property>
+                        <property name="use_font">True</property>
                         <signal name="font-set" handler="parole_conf_dialog_font_set_cb" swapped="no"/>
                       </object>
                       <packing>
diff --git a/src/parole-conf-dialog.c b/src/parole-conf-dialog.c
index 1c0dae8..3fa5212 100644
--- a/src/parole-conf-dialog.c
+++ b/src/parole-conf-dialog.c
@@ -46,12 +46,14 @@ void        parole_conf_dialog_response_cb          (GtkDialog *dialog,
                                                      ParoleConfDialog *self);
                               
 void        
-parole_conf_dialog_enable_vis_changed_cb            (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+parole_conf_dialog_enable_vis_changed_cb            (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
 
 void        
-parole_conf_dialog_reset_saver_changed_cb           (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+parole_conf_dialog_reset_saver_changed_cb           (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
 
 void        
 parole_conf_dialog_vis_plugin_changed_cb            (GtkComboBox *widget,
@@ -61,8 +63,9 @@ void        parole_conf_dialog_font_set_cb          (GtkFontButton *button,
                                                      ParoleConfDialog *self);
 
 void        
-parole_conf_dialog_enable_subtitle_changed_cb       (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+parole_conf_dialog_enable_subtitle_changed_cb       (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
     
 void        
 parole_conf_dialog_subtitle_encoding_changed_cb     (GtkComboBox *widget,
@@ -83,20 +86,25 @@ void        saturation_value_changed_cb             (GtkRange *range,
 void        reset_color_clicked_cb                  (GtkButton *button, 
                                                      ParoleConfDialog *self);
                                  
-void        replace_playlist_toggled_cb             (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+void        replace_playlist_toggled_cb             (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
                                  
-void        remove_duplicated_toggled_cb            (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+void        remove_duplicated_toggled_cb            (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
 
-void        start_playing_opened_toggled_cb         (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+void        start_playing_opened_toggled_cb         (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
 
-void        remember_playlist_toggled_cb            (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+void        remember_playlist_toggled_cb            (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
                                  
-void        multimedia_keys_toggled_cb              (GtkToggleButton *widget,
-                                                     ParoleConfDialog *self);
+void        multimedia_keys_toggled_cb              (GObject *object,
+                                                     GParamSpec *pspec,
+                                                     gpointer *data);
                                 
 /*
  * End of GtkBuilder callbacks
@@ -133,41 +141,61 @@ parole_conf_dialog_destroy (GtkWidget *widget, ParoleConfDialog *self)
 }
 
 /* Replace the playlist with newly opened files */
-void replace_playlist_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void replace_playlist_toggled_cb (GObject *object,
+                                  GParamSpec *pspec,
+                                  gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "replace-playlist", gtk_toggle_button_get_active (widget),
+                  "replace-playlist", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
         
 /* Remove duplicate entries from the playlist FIXME */                       
-void remove_duplicated_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void remove_duplicated_toggled_cb (GObject *object,
+                                   GParamSpec *pspec,
+                                   gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "remove-duplicated", gtk_toggle_button_get_active (widget),
+                  "remove-duplicated", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
 /* Automatically start playing opened files (vs. just adding them to the playlist) */
-void start_playing_opened_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void start_playing_opened_toggled_cb (GObject *object,
+                                      GParamSpec *pspec,
+                                      gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "play-opened-files", gtk_toggle_button_get_active (widget),
+                  "play-opened-files", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
 /* Remember whether the playlist was visible in the previous session */
-void remember_playlist_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void remember_playlist_toggled_cb (GObject *object,
+                                   GParamSpec *pspec,
+                                   gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "remember-playlist", gtk_toggle_button_get_active (widget),
+                  "remember-playlist", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
-void multimedia_keys_toggled_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void multimedia_keys_toggled_cb (GObject *object,
+                                 GParamSpec *pspec,
+                                 gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "multimedia-keys", gtk_toggle_button_get_active (widget),
+                  "multimedia-keys", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
@@ -201,11 +229,15 @@ void parole_conf_dialog_subtitle_encoding_changed_cb (GtkComboBox *widget, Parol
 }
 
 /* Enable visualisations */
-void parole_conf_dialog_enable_vis_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void parole_conf_dialog_enable_vis_changed_cb (GObject *object,
+                                               GParamSpec *pspec,
+                                               gpointer *data)
 {
     gboolean active;
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     
-    active = gtk_toggle_button_get_active (widget);
+    active = gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object)));
     
     g_object_set (G_OBJECT (self->priv->conf),
                   "vis-enabled", active,
@@ -274,10 +306,14 @@ void parole_conf_dialog_vis_plugin_changed_cb (GtkComboBox *widget,  ParoleConfD
     g_free (active);
 }
 
-void parole_conf_dialog_reset_saver_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void parole_conf_dialog_reset_saver_changed_cb (GObject *object,
+                                                GParamSpec *pspec,
+                                                gpointer *data)
 {
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "reset-saver", gtk_toggle_button_get_active (widget),
+                  "reset-saver", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
@@ -290,14 +326,14 @@ void parole_conf_dialog_font_set_cb (GtkFontButton *button, ParoleConfDialog *se
 }
 
 /* Enable subtitles by default */
-void parole_conf_dialog_enable_subtitle_changed_cb (GtkToggleButton *widget, ParoleConfDialog *self)
+void parole_conf_dialog_enable_subtitle_changed_cb (GObject *object,
+                                                    GParamSpec *pspec,
+                                                    gpointer *data)
 {
-    gboolean active;
-    
-    active = gtk_toggle_button_get_active (widget);
-    
+    ParoleConfDialog *self;
+    self = PAROLE_CONF_DIALOG(data);
     g_object_set (G_OBJECT (self->priv->conf),
-                  "enable-subtitle", active,
+                  "enable-subtitle", gtk_switch_get_active (GTK_SWITCH(GTK_WIDGET(object))),
                   NULL);
 }
 
@@ -401,7 +437,7 @@ parole_conf_dialog_set_defaults_playlist (ParoleConfDialog  *self, GtkBuilder *b
                   "replace-playlist", &option,
                   NULL);
           
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), option);
+    gtk_switch_set_active (GTK_SWITCH (widget), option);
     
      /**
      * Start playing opened files
@@ -412,7 +448,7 @@ parole_conf_dialog_set_defaults_playlist (ParoleConfDialog  *self, GtkBuilder *b
                   "play-opened-files", &option,
                   NULL);
           
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), option);
+    gtk_switch_set_active (GTK_SWITCH (widget), option);
     
      /**
      * Remove duplicated playlist entries
@@ -423,7 +459,7 @@ parole_conf_dialog_set_defaults_playlist (ParoleConfDialog  *self, GtkBuilder *b
                   "remove-duplicated", &option,
                   NULL);
           
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), option);
+    gtk_switch_set_active (GTK_SWITCH (widget), option);
 }
 
 /* Load the multimedia-button default settings */
@@ -442,7 +478,7 @@ parole_conf_dialog_set_defaults_general (ParoleConfDialog *self, GtkBuilder *bui
                   "multimedia-keys", &option,
                   NULL);
           
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), option);
+    gtk_switch_set_active (GTK_SWITCH (widget), option);
     
 }
 
@@ -467,8 +503,8 @@ parole_conf_dialog_set_defaults (ParoleConfDialog *self)
     gtk_widget_set_sensitive (self->priv->vis_combox, vis_enabled);
     gtk_widget_set_sensitive (self->priv->font_button, subtitle);
     
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->toggle_vis), vis_enabled);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->toggle_subtitle), subtitle);
+    gtk_switch_set_active (GTK_SWITCH (self->priv->toggle_vis), vis_enabled);
+    gtk_switch_set_active (GTK_SWITCH (self->priv->toggle_subtitle), subtitle);
     
     model = gtk_combo_box_get_model (GTK_COMBO_BOX (self->priv->vis_combox));
 
@@ -500,6 +536,8 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent)
     gboolean    with_display;
     gboolean    reset_saver;
     
+    GtkWidget *switch_widget;
+    
     builder = parole_builder_new_from_string (parole_settings_ui, parole_settings_ui_length);
     
     dialog = GTK_WIDGET (gtk_builder_get_object (builder, "settings-dialog"));
@@ -526,7 +564,7 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent)
                   "reset-saver", &reset_saver,
                   NULL);
     
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "reset-saver")),
+    gtk_switch_set_active (GTK_SWITCH (gtk_builder_get_object (builder, "reset-saver")),
                   reset_saver);
     
     with_display = parole_gst_get_is_xvimage_sink (PAROLE_GST (parole_gst_get ()));
@@ -566,6 +604,38 @@ void parole_conf_dialog_open (ParoleConfDialog *self, GtkWidget *parent)
     
     }
     
+    /* General/Video/Disable screensaver while playing movies */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "reset-saver"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(parole_conf_dialog_reset_saver_changed_cb), self);
+    
+    /* General/Audio/Enable visualization while playing audio file */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "enable-vis"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(parole_conf_dialog_enable_vis_changed_cb), self);
+    
+    /* General/Keyboard/Enable keyboard multimedia keys */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "multimedia-keys"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(multimedia_keys_toggled_cb), self);
+    
+    /* Playlist/Always replace playlist with opened files */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "replace-playlist"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(replace_playlist_toggled_cb), self);
+    
+    /* Playlist/Check and remove duplicate media entries */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "remove-duplicated"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(remove_duplicated_toggled_cb), self);
+    
+    /* Playlist/Start playing opened files */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "start-playing-opened"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(start_playing_opened_toggled_cb), self);
+    
+    /* Playlist/Remember playlist */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "remember-playlist"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(remember_playlist_toggled_cb), self);
+    
+    /* Subtitles/Automatically show subtitles when playing movie file */
+    switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "enable-subtitle"));
+    g_signal_connect(G_OBJECT(switch_widget), "notify::active", G_CALLBACK(parole_conf_dialog_enable_subtitle_changed_cb), self);
+    
     gtk_builder_connect_signals (builder, self);
     
     g_object_unref (builder);


More information about the Xfce4-commits mailing list