summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2021-09-14 13:01:49 +0200
committerJens Georg <mail@jensge.org>2021-09-14 13:01:49 +0200
commite9018359c0114a4a7f1d1e44a5052ed20f79666a (patch)
tree5935e8fc37624bbfe3b4e76f464b5121776cb231
parent57e47f075e37a8ec8cc80c2f01b29387b2f94ef5 (diff)
downloadrygel-wip/gapplication.tar.gz
Rygel: Add back plugin timeoutwip/gapplication
-rw-r--r--src/rygel/application.vala33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/rygel/application.vala b/src/rygel/application.vala
index 94fd2fe6..1f30d2a8 100644
--- a/src/rygel/application.vala
+++ b/src/rygel/application.vala
@@ -2,6 +2,7 @@ using Gee;
using GUPnP;
public class Rygel.Application : GLib.Application {
+ // Default time to wait for plugins showing up
private static int PLUGIN_TIMEOUT = 5;
private PluginLoader plugin_loader;
@@ -89,10 +90,36 @@ public class Rygel.Application : GLib.Application {
this.context_manager = this.create_context_manager ();
this.plugin_loader.load_modules ();
this.activation_pending = false;
+
+ var timeout = PLUGIN_TIMEOUT;
+ try {
+ var config = MetaConfig.get_default ();
+ timeout = config.get_int ("plugin",
+ "TIMEOUT",
+ 0,
+ int.MAX);
+ } catch (Error error) {};
+
+ if (timeout == 0) {
+ debug ("Plugin timeout disabled...");
+
+ return;
+ }
+
+ Timeout.add_seconds (timeout, () => {
+ if (this.plugin_loader.list_plugins ().size == 0) {
+ warning (ngettext ("No plugins found in %d second; giving up…",
+ "No plugins found in %d seconds; giving up…",
+ PLUGIN_TIMEOUT),
+ PLUGIN_TIMEOUT);
+ this.release ();
+ }
+
+ return false;
+ });
}
public override void activate () {
- print ("Activate");
base.activate ();
if (this.context_manager == null || this.activation_pending) {
hold ();
@@ -114,13 +141,11 @@ public class Rygel.Application : GLib.Application {
}
public override void shutdown () {
- print ("SHUTDOWN\n");
this.root_devices = null;
base.shutdown ();
}
public override bool name_lost () {
- print ("NAME_LOSTT\n");
this.root_devices = null;
this.release ();
@@ -274,8 +299,6 @@ public class Rygel.Application : GLib.Application {
}
}
-
-
public static int main(string[] args) {
Environment.set_application_name (_(BuildConfig.PACKAGE_NAME));