rygel r381 - trunk/src/plugins/dvb



Author: zeeshanak
Date: Thu Dec 25 12:00:53 2008
New Revision: 381
URL: http://svn.gnome.org/viewvc/rygel?rev=381&view=rev

Log:
Refactor DVBChannelGroup construction method.

Modified:
   trunk/src/plugins/dvb/rygel-dvb-channel-group.vala

Modified: trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	Thu Dec 25 12:00:53 2008
@@ -61,7 +61,29 @@
         this.channel_list = channel_list;
         this.streamer = streamer;
 
-        channels = new HashMap<string, DVBChannel> (str_hash, str_equal);
+        this.fetch_channels ();
+    }
+
+    public uint add_channels (DIDLLiteWriter didl_writer,
+                              uint           index,
+                              uint           requested_count,
+                              out uint       total_matches) throws GLib.Error {
+        foreach (var channel in channels.get_values ()) {
+            channel.serialize (didl_writer);
+        }
+
+        total_matches = channels.size;
+
+        return total_matches;
+    }
+
+    public DVBChannel find_channel (DIDLLiteWriter didl_writer,
+                                    string         id) {
+        return this.channels.get (id);
+    }
+
+    private void fetch_channels () {
+        this.channels = new HashMap<string, DVBChannel> (str_hash, str_equal);
 
         DBus.Connection connection;
         try {
@@ -92,23 +114,5 @@
 
         this.child_count = this.channels.size;
     }
-
-    public uint add_channels (DIDLLiteWriter didl_writer,
-                              uint           index,
-                              uint           requested_count,
-                              out uint       total_matches) throws GLib.Error {
-        foreach (var channel in channels.get_values ()) {
-            channel.serialize (didl_writer);
-        }
-
-        total_matches = channels.size;
-
-        return total_matches;
-    }
-
-    public DVBChannel find_channel (DIDLLiteWriter didl_writer,
-                                    string         id) {
-        return this.channels.get (id);
-    }
 }
 



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