[rygel] ui: Don't use signal autoconnection magic



commit 4c8ca61a969310484ae3cf79e65eee12eb8f3ee2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jun 4 14:42:23 2009 +0300

    ui: Don't use signal autoconnection magic
    
    Vala currently doesn't support automatic signal connection to handlers in
    multiple classes.
---
 data/rygel-preferences.ui              |    6 +-----
 src/ui/rygel-folder-pref-section.vala  |   21 ++++++++++++++-------
 src/ui/rygel-general-pref-section.vala |    5 ++---
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui
index e6b0e6a..aaf115b 100644
--- a/data/rygel-preferences.ui
+++ b/data/rygel-preferences.ui
@@ -64,7 +64,6 @@
                             <property name="receives_default">False</property>
                             <property name="use_underline">True</property>
                             <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="rygel_general_pref_section_on_trans_check_toggled"/>
                           </object>
                           <packing>
                             <property name="y_options"></property>
@@ -413,7 +412,6 @@
                                 <property name="receives_default">True</property>
                                 <property name="use_underline">True</property>
                                 <property name="use_stock">True</property>
-                                <signal name="clicked" handler="rygel_folder_pref_section_on_add_button_clicked"/>
                               </object>
                               <packing>
                                 <property name="position">0</property>
@@ -426,7 +424,6 @@
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="use_stock">True</property>
-                                <signal name="clicked" handler="rygel_folder_pref_section_on_remove_button_clicked"/>
                               </object>
                               <packing>
                                 <property name="position">1</property>
@@ -440,7 +437,6 @@
                                 <property name="receives_default">True</property>
                                 <property name="use_underline">True</property>
                                 <property name="use_stock">True</property>
-                                <signal name="clicked" handler="rygel_folder_pref_section_on_clear_button_clicked"/>
                               </object>
                               <packing>
                                 <property name="position">2</property>
@@ -542,9 +538,9 @@
     <property name="type_hint">dialog</property>
     <property name="transient_for">preferences-dialog</property>
     <property name="has_separator">False</property>
+    <property name="local_only">False</property>
     <property name="select_multiple">True</property>
     <property name="action">select-folder</property>
-    <property name="local_only">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
diff --git a/src/ui/rygel-folder-pref-section.vala b/src/ui/rygel-folder-pref-section.vala
index 344f212..9c4790f 100644
--- a/src/ui/rygel-folder-pref-section.vala
+++ b/src/ui/rygel-folder-pref-section.vala
@@ -29,6 +29,9 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection {
     const string FOLDERS_TEXTVIEW = FOLDERS_KEY + "-treeview";
     const string FOLDERS_LISTSTORE = FOLDERS_KEY + "-liststore";
     const string FOLDERS_DIALOG = FOLDERS_KEY + "-dialog";
+    const string ADD_BUTTON = "add-button";
+    const string REMOVE_BUTTON = "remove-button";
+    const string CLEAR_BUTTON = "clear-button";
 
     private TreeView treeview;
     private ListStore liststore;
@@ -60,7 +63,14 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection {
             this.liststore.set (iter, 0, folder, -1);
         }
 
-        builder.connect_signals (this);
+        var button = (Button) builder.get_object (ADD_BUTTON);
+        button.clicked += this.on_add_button_clicked;
+
+        button = (Button) builder.get_object (REMOVE_BUTTON);
+        button.clicked += this.on_remove_button_clicked;
+
+        button = (Button) builder.get_object (CLEAR_BUTTON);
+        button.clicked += this.on_clear_button_clicked;
     }
 
     public override void save () {
@@ -88,8 +98,7 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection {
         this.treeview.sensitive = enabled_check.active;
     }
 
-    [CCode (instance_pos = -1)]
-    public void on_add_button_clicked (Button button) {
+    private void on_add_button_clicked (Button button) {
         if (this.dialog.run () == ResponseType.OK) {
             TreeIter iter;
 
@@ -104,8 +113,7 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection {
         this.dialog.hide ();
     }
 
-    [CCode (instance_pos = -1)]
-    public void on_remove_button_clicked (Button button) {
+    private void on_remove_button_clicked (Button button) {
         var selection = this.treeview.get_selection ();
         var rows = selection.get_selected_rows (null);
 
@@ -126,8 +134,7 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection {
         }
     }
 
-    [CCode (instance_pos = -1)]
-    public void on_clear_button_clicked (Button button) {
+    private void on_clear_button_clicked (Button button) {
         this.liststore.clear ();
     }
 }
diff --git a/src/ui/rygel-general-pref-section.vala b/src/ui/rygel-general-pref-section.vala
index e9e65ab..7eccc43 100644
--- a/src/ui/rygel-general-pref-section.vala
+++ b/src/ui/rygel-general-pref-section.vala
@@ -66,7 +66,7 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
         this.mp2ts_check.active = this.config.mp2ts_transcoder;
         this.lpcm_check.active = this.config.lpcm_transcoder;
 
-        builder.connect_signals (this);
+        this.trans_check.toggled += this.on_trans_check_toggled;
     }
 
     public override void save () {
@@ -79,8 +79,7 @@ public class Rygel.GeneralPrefSection : PreferencesSection {
         this.config.lpcm_transcoder = this.lpcm_check.active;
     }
 
-    [CCode (instance_pos = -1)]
-    public void on_trans_check_toggled (CheckButton trans_check) {
+    private void on_trans_check_toggled (CheckButton trans_check) {
         this.mp3_check.sensitive =
         this.mp2ts_check.sensitive =
         this.lpcm_check.sensitive = trans_check.active;



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