rygel r311 - trunk/src/rygel



Author: zeeshanak
Date: Wed Nov 26 17:00:33 2008
New Revision: 311
URL: http://svn.gnome.org/viewvc/rygel?rev=311&view=rev

Log:
Add API to Main for exiting the app with an exit code.

Modified:
   trunk/src/rygel/rygel-main.vala

Modified: trunk/src/rygel/rygel-main.vala
==============================================================================
--- trunk/src/rygel/rygel-main.vala	(original)
+++ trunk/src/rygel/rygel-main.vala	Wed Nov 26 17:00:33 2008
@@ -34,19 +34,30 @@
 
     private MainLoop main_loop;
 
+    private int exit_code;
+
     public Main () throws GLib.Error {
         this.media_servers = new List<MediaServer> ();
         this.plugin_loader = new PluginLoader ();
         this.ms_factory = new MediaServerFactory ();
         this.main_loop = new GLib.MainLoop (null, false);
 
+        this.exit_code = 0;
+
         this.plugin_loader.plugin_available += this.on_plugin_loaded;
     }
 
-    public void run () {
+    public int run () {
         this.plugin_loader.load_plugins ();
 
         this.main_loop.run ();
+
+        return this.exit_code;
+    }
+
+    public void exit (int exit_code) {
+        this.exit_code = exit_code;
+        this.main_loop.quit ();
     }
 
     private void on_plugin_loaded (PluginLoader plugin_loader,
@@ -76,9 +87,9 @@
             return -1;
         }
 
-        main.run ();
+        int exit_code = main.run ();
 
-        return 0;
+        return exit_code;
     }
 }
 



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