rygel r131 - in trunk: . src



Author: zeeshanak
Date: Tue Oct 28 21:01:05 2008
New Revision: 131
URL: http://svn.gnome.org/viewvc/rygel?rev=131&view=rev

Log:
Replace random ID generation function by a GQuark-based (persistant) one.

Modified:
   trunk/ChangeLog
   trunk/src/gupnp-media-manager.vala

Modified: trunk/src/gupnp-media-manager.vala
==============================================================================
--- trunk/src/gupnp-media-manager.vala	(original)
+++ trunk/src/gupnp-media-manager.vala	Tue Oct 28 21:01:05 2008
@@ -328,20 +328,14 @@
 
         debug ("Loaded plugin: '%s'\n", module.name());
 
-        return register_media_provider (this.generate_id (),
+        return register_media_provider (this.generate_id_for_module (module),
                                         this.root_id,
                                         this.context);
     }
 
-    private string generate_id () {
-        string id = Random.next_int ().to_string ();
-
-        // See if generated ID is already in use
-        if (this.providers.lookup (id) != null) {
-            return generate_id ();
-        } else {
-            return id;
-        }
+    private string generate_id_for_module (Module module) {
+        uint32 id = (uint32) Quark.from_string (module.name ());
+        return id.to_string ();
     }
 
     private static bool is_dir (File file) {



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