[rygel] rygel: Add option to shut down a remote instance



commit 37354ba541acbe8c86faf1c56fd4602584f32e7a
Author: Jens Georg <jensg openismus com>
Date:   Fri Jun 14 13:17:15 2013 +0200

    rygel: Add option to shut down a remote instance

 src/rygel/rygel-cmdline-config.vala |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index b7b5342..904e9ea 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -54,6 +54,8 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
 
     private static string config_file;
 
+    private static bool shutdown;
+
     [CCode (array_length = false, array_null_terminated = true)]
     [NoArrayLength]
     private static string[] disabled_plugins;
@@ -98,6 +100,8 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
           N_ ("Disable UPnP (streaming-only)"), null },
         { "config", 'c', 0, OptionArg.FILENAME, ref config_file,
           N_ ("Use configuration file instead of user configuration"), "FILE" },
+        { "shutdown", 's', 0, OptionArg.NONE, ref shutdown,
+          N_ ("Shutdown remote Rygel reference"), null },
         { null }
     };
 
@@ -131,6 +135,23 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
 
             throw new CmdlineConfigError.VERSION_ONLY ("");
         }
+
+        if (shutdown) {
+            try {
+                print (_("Shutting down remote Rygel instance\n"));
+                DBusInterface rygel = Bus.get_proxy_sync
+                                        (BusType.SESSION,
+                                         DBusInterface.SERVICE_NAME,
+                                         DBusInterface.OBJECT_PATH,
+                                         DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
+                rygel.shutdown ();
+            } catch (Error error) {
+                warning (_("Failed to shut-down other rygel instance: %s"),
+                         error.message);
+
+            }
+            throw new CmdlineConfigError.VERSION_ONLY ("");
+        }
     }
 
     public bool get_upnp_enabled () throws GLib.Error {


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