core: *MediaServer* -> *RootDevice*
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Sun, 31 May 2009 18:56:59 +0000 (21:56 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Sun, 31 May 2009 18:56:59 +0000 (21:56 +0300)
Rygel won't just be a MediaServer anymore soon, hence the renaming.

configure.ac
src/rygel/Makefile.am
src/rygel/rygel-main.vala
src/rygel/rygel-root-device-factory.vala [moved from src/rygel/rygel-media-server-factory.vala with 95% similarity]
src/rygel/rygel-root-device.vala [moved from src/rygel/rygel-media-server.vala with 81% similarity]

index 7aafdfa..950084d 100644 (file)
@@ -4,7 +4,7 @@ AC_INIT([rygel],
        [http://live.gnome.org/Rygel])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE
-AC_CONFIG_SRCDIR([src/rygel/rygel-media-server.vala])
+AC_CONFIG_SRCDIR([src/rygel/rygel-root-device.vala])
 AM_CONFIG_HEADER([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_MAINTAINER_MODE
index 2e0154a..c71e06b 100644 (file)
@@ -29,8 +29,8 @@ bin_PROGRAMS = rygel
 
 BUILT_SOURCES = rygel-1.0.vapi \
                rygel.h \
-               rygel-media-server.c \
-               rygel-media-server-factory.c \
+               rygel-root-device.c \
+               rygel-root-device-factory.c \
                rygel-configuration.c \
                rygel-main.c \
                rygel-content-directory.c \
@@ -56,10 +56,10 @@ BUILT_SOURCES = rygel-1.0.vapi \
 $(BUILT_SOURCES) : rygel.stamp
 
 rygel_SOURCES = $(VAPI_SOURCE_FILES) \
-               rygel-media-server.c \
-               rygel-media-server.vala \
-               rygel-media-server-factory.c \
-               rygel-media-server-factory.vala \
+               rygel-root-device.c \
+               rygel-root-device.vala \
+               rygel-root-device-factory.c \
+               rygel-root-device-factory.vala \
                rygel-main.c \
                rygel-main.vala \
                rygel-content-directory.c \
index 70fbd08..3a87bf7 100644 (file)
  */
 
 using GUPnP;
-using GConf;
 using CStuff;
 using Gee;
 
 public class Rygel.Main : Object {
     private PluginLoader plugin_loader;
-    private MediaServerFactory ms_factory;
-    private ArrayList<MediaServer> media_servers;
+    private RootDeviceFactory device_factory;
+    private ArrayList<RootDevice> root_devices;
 
     private MainLoop main_loop;
 
@@ -38,9 +37,9 @@ public class Rygel.Main : Object {
     public Main () throws GLib.Error {
         Environment.set_application_name (_(BuildConfig.PACKAGE_NAME));
 
-        this.media_servers = new ArrayList<MediaServer> ();
+        this.root_devices = new ArrayList<RootDevice> ();
         this.plugin_loader = new PluginLoader ();
-        this.ms_factory = new MediaServerFactory ();
+        this.device_factory = new RootDeviceFactory ();
         this.main_loop = new GLib.MainLoop (null, false);
 
         this.exit_code = 0;
@@ -70,15 +69,15 @@ public class Rygel.Main : Object {
     private void on_plugin_loaded (PluginLoader plugin_loader,
                                    Plugin       plugin) {
         try {
-            var server = this.ms_factory.create_media_server (plugin);
+            var device = this.device_factory.create_root_device (plugin);
 
-            server.available = plugin.available;
+            device.available = plugin.available;
 
-            media_servers.add (server);
+            root_devices.add (device);
 
             plugin.notify["available"] += this.on_plugin_notify;
         } catch (GLib.Error error) {
-            warning ("Failed to create MediaServer for %s. Reason: %s\n",
+            warning ("Failed to create RootDevice for %s. Reason: %s\n",
                      plugin.name,
                      error.message);
         }
@@ -86,9 +85,9 @@ public class Rygel.Main : Object {
 
     private void on_plugin_notify (Plugin    plugin,
                                    ParamSpec spec) {
-        foreach (var server in this.media_servers) {
-            if (server.resource_factory == plugin) {
-                server.available = plugin.available;
+        foreach (var device in this.root_devices) {
+            if (device.resource_factory == plugin) {
+                device.available = plugin.available;
             }
         }
     }
similarity index 95%
rename from src/rygel/rygel-media-server-factory.vala
rename to src/rygel/rygel-root-device-factory.vala
index 9f7053d..f2c6032 100644 (file)
 
 using GUPnP;
 using CStuff;
-using Rygel;
 
-public errordomain MediaServerFactoryError {
+public errordomain RootDeviceFactoryError {
     XML_PARSE,
     PLUGIN_DISABLED
 }
 
 /**
- * Factory for MediaServer objects. Give it a plugin and it will create a
- * MediaServer device for that.
+ * Factory for RootDevice objects. Give it a plugin and it will create a
+ * Root device for that.
  */
-public class Rygel.MediaServerFactory {
+public class Rygel.RootDeviceFactory {
     public static const string DESC_DOC = "xml/description.xml";
     public static const string DESC_PREFIX = "Rygel";
 
     private Configuration config;
     private GUPnP.Context context;
 
-    public MediaServerFactory () throws GLib.Error {
+    public RootDeviceFactory () throws GLib.Error {
         this.config = Configuration.get_default ();
 
         /* Set up GUPnP context */
         this.context = create_upnp_context ();
     }
 
-    public MediaServer create_media_server (Plugin plugin) throws GLib.Error {
+    public RootDevice create_root_device (Plugin plugin) throws GLib.Error {
         if (!this.config.get_enabled (plugin.name)) {
-            throw new MediaServerFactoryError.PLUGIN_DISABLED (
+            throw new RootDeviceFactoryError.PLUGIN_DISABLED (
                             "Plugin disabled in user configuration.");
         }
 
@@ -68,7 +67,7 @@ public class Rygel.MediaServerFactory {
         /* Host our modified file */
         this.context.host_path (desc_path, "/" + modified_desc);
 
-        return new MediaServer (this.context,
+        return new RootDevice (this.context,
                                 plugin,
                                 doc,
                                 modified_desc);
@@ -89,7 +88,7 @@ public class Rygel.MediaServerFactory {
         if (doc == null) {
             string message = "Failed to parse %s".printf (path);
 
-            throw new MediaServerFactoryError.XML_PARSE (message);
+            throw new RootDeviceFactoryError.XML_PARSE (message);
         }
 
         /* Modify description to include Plugin-specific stuff */
similarity index 81%
rename from src/rygel/rygel-media-server.vala
rename to src/rygel/rygel-root-device.vala
index 7530694..6e904b7 100644 (file)
  */
 
 using GUPnP;
-using GConf;
 using CStuff;
 using Gee;
 
 /**
- * Represents a MediaServer device.
+ * Represents a Root device.
  */
-public class Rygel.MediaServer: RootDevice {
+public class Rygel.RootDevice: GUPnP.RootDevice {
     private ArrayList<ServiceInfo> services;   /* Services we implement */
 
-    public MediaServer (GUPnP.Context context,
-                        Plugin        plugin,
-                        Xml.Doc      *description_doc,
-                        string        relative_location) {
+    public RootDevice (GUPnP.Context context,
+                       Plugin        plugin,
+                       Xml.Doc      *description_doc,
+                       string        relative_location) {
         this.resource_factory = plugin;
         this.root_device = null;
         this.context = context;
@@ -57,7 +56,8 @@ public class Rygel.MediaServer: RootDevice {
         }
     }
 
-    private static void xml_doc_free (Xml.Doc* doc, MediaServer server) {
+    private static void xml_doc_free (Xml.Doc*         doc,
+                                      Rygel.RootDevice device) {
         delete doc;
     }
 }