[rygel] rygel: Introduce -r/--replace option
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] rygel: Introduce -r/--replace option
- Date: Sat, 21 Jun 2014 17:46:07 +0000 (UTC)
commit 412a3a10f7c5f3e1879dacd26aad3923b081c270
Author: Jens Georg <mail jensge org>
Date: Sat Jun 21 19:26:31 2014 +0200
rygel: Introduce -r/--replace option
Also change default behavior: Previously, rygel would silently replace an
already running instance. Now it just exists. To return to old behavior, the
-r/--replace option was introduced.
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=731859
doc/man/rygel.xml | 22 ++++++++++++++++++++++
src/rygel/rygel-cmdline-config.vala | 13 +++++++++++--
src/rygel/rygel-dbus-service.vala | 15 ++-------------
3 files changed, 35 insertions(+), 15 deletions(-)
---
diff --git a/doc/man/rygel.xml b/doc/man/rygel.xml
index b9f8095..dcacb36 100644
--- a/doc/man/rygel.xml
+++ b/doc/man/rygel.xml
@@ -276,6 +276,28 @@ handling.</para>
<para>Use <replaceable>CONFIG_FILE</replaceable> instead of
<filename>${XDG_CONFIG_DIR}/rygel.conf</filename>.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>-s</option>
+ </term>
+ <term>
+ <option>--shutdown</option>
+ </term>
+ <listitem>
+ <para>Shutdown a currently running instance of &dhpackage;</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>-r</option>
+ </term>
+ <term>
+ <option>--replace</option>
+ </term>
+ <listitem>
+ <para>Replace the currently running instance of &dhpackage; with this instance. Short for
<userinput>rygel -s && rygel</userinput></para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1 id="files">
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index 904e9ea..9a22314 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -2,10 +2,12 @@
* Copyright (C) 2008,2009 Nokia Corporation.
* Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak gnome org>.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2014 Jens Georg <mail jensge org>
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
* Jens Georg <jensg openismus com>
+ * <mail jensge org>
*
* This file is part of Rygel.
*
@@ -55,6 +57,7 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
private static string config_file;
private static bool shutdown;
+ private static bool replace;
[CCode (array_length = false, array_null_terminated = true)]
[NoArrayLength]
@@ -102,6 +105,8 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
N_ ("Use configuration file instead of user configuration"), "FILE" },
{ "shutdown", 's', 0, OptionArg.NONE, ref shutdown,
N_ ("Shutdown remote Rygel reference"), null },
+ { "replace", 'r', 0, OptionArg.NONE, ref replace,
+ N_ ("Replace currently running instance of rygel"), null },
{ null }
};
@@ -136,7 +141,7 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
throw new CmdlineConfigError.VERSION_ONLY ("");
}
- if (shutdown) {
+ if (shutdown || replace) {
try {
print (_("Shutting down remote Rygel instance\n"));
DBusInterface rygel = Bus.get_proxy_sync
@@ -150,7 +155,11 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
error.message);
}
- throw new CmdlineConfigError.VERSION_ONLY ("");
+
+ // If user wanted to shut down, just exit.
+ if (shutdown) {
+ throw new CmdlineConfigError.VERSION_ONLY ("");
+ }
}
}
diff --git a/src/rygel/rygel-dbus-service.vala b/src/rygel/rygel-dbus-service.vala
index 6b53c83..ef294e9 100644
--- a/src/rygel/rygel-dbus-service.vala
+++ b/src/rygel/rygel-dbus-service.vala
@@ -78,19 +78,8 @@ internal class Rygel.DBusService : Object, DBusInterface {
return;
}
- // Cleanly shutdown other instance.
- try {
- 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);
-
- this.main.exit (-12);
- }
+ message (_("Another instance of rygel is already running. Not starting."));
+ this.main.exit (-15);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]