Mercurial > audlegacy
comparison src/audacious/main.c @ 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 | c9be7256db08 |
children | 8084f49a930a |
comparison
equal
deleted
inserted
replaced
4561:cc6255f8b568 | 4562:a6d0f9d6198a |
---|---|
312 (*argv)[0], error->message, (*argv)[0]); | 312 (*argv)[0], error->message, (*argv)[0]); |
313 exit(EXIT_FAILURE); | 313 exit(EXIT_FAILURE); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 static void | 317 static gboolean |
318 handle_cmd_line_options() | 318 handle_cmd_line_options() |
319 { | 319 { |
320 gchar **filenames = options.filenames; | 320 gchar **filenames = options.filenames; |
321 #ifdef USE_DBUS | 321 #ifdef USE_DBUS |
322 DBusGProxy *session = audacious_get_dbus_proxy(); | 322 DBusGProxy *session = audacious_get_dbus_proxy(); |
518 drct_main_win_toggle(TRUE); | 518 drct_main_win_toggle(TRUE); |
519 | 519 |
520 if (options.activate) | 520 if (options.activate) |
521 drct_activate(); | 521 drct_activate(); |
522 } /* !is_running */ | 522 } /* !is_running */ |
523 | |
524 #ifdef USE_DBUS | |
525 return is_running; | |
526 #else | |
527 return FALSE; | |
528 #endif | |
523 } | 529 } |
524 | 530 |
525 static void | 531 static void |
526 aud_setup_logger(void) | 532 aud_setup_logger(void) |
527 { | 533 { |
663 } | 669 } |
664 | 670 |
665 gint | 671 gint |
666 main(gint argc, gchar ** argv) | 672 main(gint argc, gchar ** argv) |
667 { | 673 { |
674 gboolean cmd_line_handled = FALSE; | |
675 | |
668 /* glib-2.13.0 requires g_thread_init() to be called before all | 676 /* glib-2.13.0 requires g_thread_init() to be called before all |
669 other GLib functions */ | 677 other GLib functions */ |
670 g_thread_init(NULL); | 678 g_thread_init(NULL); |
671 if (!g_thread_supported()) { | 679 if (!g_thread_supported()) { |
672 g_printerr(_("Sorry, threads aren't supported on your platform.\n")); | 680 g_printerr(_("Sorry, threads aren't supported on your platform.\n")); |
673 exit(EXIT_FAILURE); | 681 exit(EXIT_FAILURE); |
674 } | 682 } |
675 | 683 |
676 gdk_threads_init(); | 684 gdk_threads_init(); |
685 mowgli_init(); | |
677 | 686 |
678 /* Setup l10n early so we can print localized error messages */ | 687 /* Setup l10n early so we can print localized error messages */ |
679 gtk_set_locale(); | 688 gtk_set_locale(); |
680 bindtextdomain(PACKAGE_NAME, LOCALEDIR); | 689 bindtextdomain(PACKAGE_NAME, LOCALEDIR); |
681 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | 690 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); |
710 SAD_dither_init_rand((gint32)time(NULL)); | 719 SAD_dither_init_rand((gint32)time(NULL)); |
711 | 720 |
712 aud_config_load(); | 721 aud_config_load(); |
713 | 722 |
714 signal_handlers_init(); | 723 signal_handlers_init(); |
715 mowgli_init(); | 724 |
725 #ifdef USE_DBUS | |
726 /* If we are using DBUS, handle options here */ | |
727 cmd_line_handled = handle_cmd_line_options(); | |
728 #endif | |
716 | 729 |
717 if (options.headless == FALSE) | 730 if (options.headless == FALSE) |
718 { | 731 { |
719 ui_main_check_theme_engine(); | 732 ui_main_check_theme_engine(); |
720 | 733 |
729 ui_manager_create_menus(); | 742 ui_manager_create_menus(); |
730 } | 743 } |
731 | 744 |
732 plugin_system_init(); | 745 plugin_system_init(); |
733 playlist_system_init(); | 746 playlist_system_init(); |
734 handle_cmd_line_options(); | 747 |
748 if (!cmd_line_handled) | |
749 handle_cmd_line_options(); | |
735 | 750 |
736 #ifdef USE_DBUS | 751 #ifdef USE_DBUS |
737 init_dbus(); | 752 init_dbus(); |
738 #endif | 753 #endif |
739 | 754 |