ui: Remove autostart file first
authorJens Georg <mail@jensge.org>
Sat, 28 Apr 2012 16:48:37 +0000 (18:48 +0200)
committerJens Georg <mail@jensge.org>
Sat, 28 Apr 2012 16:56:45 +0000 (18:56 +0200)
Remove autostart file and disable option before trying to shut down a
running Rygel instance to prevent a shut-down failure leaving an
autostart file dangling around.

src/ui/rygel-writable-user-config.vala

index 39eeb36..5841740 100644 (file)
@@ -185,6 +185,13 @@ public class Rygel.WritableUserConfig : Rygel.UserConfig {
                 this.set_bool ("general", UPNP_ENABLED_KEY, true);
             } else {
                 // Stop service only if already running
+                // Then delete the symlink from user's autostart dir
+                try {
+                    dest.delete (null);
+                } catch (IOError.NOT_FOUND err) {}
+
+                this.set_bool ("general", UPNP_ENABLED_KEY, false);
+
                 if (this.is_upnp_enabled ()) {
                     // Create proxy to Rygel
                     DBusInterface rygel_proxy = Bus.get_proxy_sync
@@ -195,13 +202,6 @@ public class Rygel.WritableUserConfig : Rygel.UserConfig {
 
                     rygel_proxy.shutdown ();
                 }
-
-                // Then delete the symlink from user's autostart dir
-                try {
-                    dest.delete (null);
-                } catch (IOError.NOT_FOUND err) {}
-
-                this.set_bool ("general", UPNP_ENABLED_KEY, false);
             }
         } catch (GLib.Error err) {
             string message;