core: Add Rygel to user's autostart list
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 8 Jun 2009 13:35:13 +0000 (16:35 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Fri, 12 Jun 2009 11:31:41 +0000 (14:31 +0300)
Add Rygel to user's autostart list if "Enable UPnP/DLNA" flag is set.

src/rygel/rygel-configuration.vala

index cb6e00b..dc4ea0e 100644 (file)
@@ -66,10 +66,24 @@ public class Rygel.Configuration : GLib.Object {
                 try {
                     uint32 res;
 
+                    // Start service first
                     this.dbus_obj.StartServiceByName (RYGEL_SERVICE,
                                                       (uint32) 0,
                                                       out res);
 
+                    // Then copy the desktop file to user's autostart dir
+                    var source_path = Path.build_filename (
+                                                    BuildConfig.DESKTOP_DIR,
+                                                    "rygel.desktop");
+                    var dest_path = Path.build_filename (
+                                        Environment.get_user_config_dir (),
+                                        "autostart",
+                                        "rygel.desktop");
+                    var source = File.new_for_path (source_path);
+                    var dest = File.new_for_path (dest_path);
+
+                    source.copy (dest, FileCopyFlags.OVERWRITE, null, null);
+
                     this.set_bool ("general", ENABLED_KEY, value);
                 } catch (DBus.Error err) {
                     warning ("Failed to start Rygel service: %s\n",