changeset 4562:a6d0f9d6198a

Made handling of commandline options to happen before plugin and playlist initialization when DBus support is enabled. This makes handling of remote control options such as 'audacious -e foo' much faster.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 21 May 2008 04:43:12 +0300
parents cc6255f8b568
children 8084f49a930a
files src/audacious/main.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/main.c	Mon May 19 18:11:41 2008 +0200
+++ b/src/audacious/main.c	Wed May 21 04:43:12 2008 +0300
@@ -314,7 +314,7 @@
         }
 }
 
-static void
+static gboolean
 handle_cmd_line_options()
 {
     gchar **filenames = options.filenames;
@@ -520,6 +520,12 @@
         if (options.activate)
             drct_activate();
     } /* !is_running */
+    
+#ifdef USE_DBUS
+    return is_running;
+#else
+    return FALSE;
+#endif
 }
 
 static void
@@ -665,6 +671,8 @@
 gint
 main(gint argc, gchar ** argv)
 {
+    gboolean cmd_line_handled = FALSE;
+    
     /* glib-2.13.0 requires g_thread_init() to be called before all
        other GLib functions */
     g_thread_init(NULL);
@@ -674,6 +682,7 @@
     }
 
     gdk_threads_init();
+    mowgli_init();
 
     /* Setup l10n early so we can print localized error messages */
     gtk_set_locale();
@@ -712,7 +721,11 @@
     aud_config_load();
 
     signal_handlers_init();
-    mowgli_init();
+
+#ifdef USE_DBUS
+    /* If we are using DBUS, handle options here */
+    cmd_line_handled = handle_cmd_line_options();
+#endif
 
     if (options.headless == FALSE)
     {
@@ -731,7 +744,9 @@
 
     plugin_system_init();
     playlist_system_init();
-    handle_cmd_line_options();
+
+    if (!cmd_line_handled)
+        handle_cmd_line_options();
 
 #ifdef USE_DBUS
     init_dbus();