# HG changeset patch # User William Pitcock # Date 1214720363 18000 # Node ID ec88df86deef85a75651211bf67381c699d51b62 # Parent fdcbbfdd428e099c457a9f31befb9a767101e7f0 Split out headless specific interface code (mostly). diff -r fdcbbfdd428e -r ec88df86deef src/audacious/Makefile --- a/src/audacious/Makefile Sun Jun 29 01:09:08 2008 -0500 +++ b/src/audacious/Makefile Sun Jun 29 01:19:23 2008 -0500 @@ -46,6 +46,7 @@ ui_fileinfo.c \ ui_fileinfopopup.c \ ui_fileopener.c \ + ui_headless.c \ ui_hints.c \ ui_jumptotrack.c \ ui_jumptotrack_cache.c \ diff -r fdcbbfdd428e -r ec88df86deef src/audacious/main.c --- a/src/audacious/main.c Sun Jun 29 01:09:08 2008 -0500 +++ b/src/audacious/main.c Sun Jun 29 01:19:23 2008 -0500 @@ -101,7 +101,6 @@ gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box; gboolean enqueue, mainwin, remote, activate; gboolean load_skins; - gboolean headless; gboolean no_log; gboolean enqueue_to_temp; gboolean version; @@ -277,7 +276,6 @@ {"enqueue-to-temp", 'E', 0, G_OPTION_ARG_NONE, &options.enqueue_to_temp, N_("Add new files to a temporary playlist"), NULL}, {"show-main-window", 'm', 0, G_OPTION_ARG_NONE, &options.mainwin, N_("Display the main window"), NULL}, {"activate", 'a', 0, G_OPTION_ARG_NONE, &options.activate, N_("Display all open Audacious windows"), NULL}, - {"headless", 'H', 0, G_OPTION_ARG_NONE, &options.headless, N_("Enable headless operation"), NULL}, {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL}, {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version"), NULL}, {"interface", 'i', 0, G_OPTION_ARG_STRING, &options.interface, N_("Interface to use"), NULL}, @@ -548,13 +546,6 @@ } static gboolean -aud_headless_iteration(gpointer unused) -{ - free_vis_data(); - return TRUE; -} - -static gboolean load_extra_playlist(const gchar * path, const gchar * basename, gpointer def) { @@ -596,6 +587,7 @@ aud_config_save(); +#if 0 if (options.headless == FALSE) { gtk_widget_hide(equalizerwin); @@ -607,6 +599,7 @@ cleanup_skins(); } +#endif plugin_system_cleanup(); @@ -630,6 +623,8 @@ gint main(gint argc, gchar ** argv) { + Interface *i; + /* glib-2.13.0 requires g_thread_init() to be called before all other GLib functions */ g_thread_init(NULL); @@ -665,7 +660,7 @@ aud_setup_logger(); g_message("Initializing Gtk+"); - if (!gtk_init_check(&argc, &argv) && options.headless == FALSE) { + if (!gtk_init_check(&argc, &argv)) { /* XXX */ /* GTK check failed, and no arguments passed to indicate that user is intending to only remote control a running session */ @@ -686,7 +681,7 @@ g_message("Handling commandline options, part #1"); handle_cmd_line_options(TRUE); - if (options.headless == FALSE) + if (g_ascii_strcasecmp(options.interface, "headless")) /* XXX */ { g_message("Non-headless operation setup"); ui_main_check_theme_engine(); @@ -729,23 +724,14 @@ g_message("Populating included interfaces"); ui_populate_default_interface(); ui_populate_legacy_interface(); - - { - /* temporarily headless operation is disabled in favour of testing the new UI */ - g_message("Selecting interface %s", options.interface); - Interface *i = interface_get(options.interface); - - g_message("Running interface %s@%p", options.interface, i); - interface_run(i); + ui_populate_headless_interface(); -#if 0 - g_print(_("Headless operation enabled\n")); - resume_playback_on_startup(); + /* temporarily headless operation is disabled in favour of testing the new UI */ + g_message("Selecting interface %s", options.interface); + i = interface_get(options.interface); - g_timeout_add(10, aud_headless_iteration, NULL); - g_main_loop_run(g_main_loop_new(NULL, TRUE)); -#endif - } + g_message("Running interface %s@%p", options.interface, i); + interface_run(i); aud_quit(); return EXIT_SUCCESS; diff -r fdcbbfdd428e -r ec88df86deef src/audacious/ui_headless.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_headless.c Sun Jun 29 01:19:23 2008 -0500 @@ -0,0 +1,51 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2008 Audacious development team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#include +#include + +#include "interface.h" +#include "playlist.h" +#include "input.h" + +static gboolean +aud_headless_iteration(gpointer unused) +{ + free_vis_data(); + return TRUE; +} + +static gboolean +_ui_initialize(void) +{ + g_timeout_add(10, aud_headless_iteration, NULL); + g_main_loop_run(g_main_loop_new(NULL, TRUE)); +} + +static Interface headless_interface = { + .id = "headless", + .desc = N_("Headless Interface"), + .init = _ui_initialize, +}; + +void +ui_populate_headless_interface(void) +{ + interface_register(&headless_interface); +} diff -r fdcbbfdd428e -r ec88df86deef src/audacious/ui_headless.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/ui_headless.h Sun Jun 29 01:19:23 2008 -0500 @@ -0,0 +1,27 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2008 Audacious development team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#include "interface.h" + +#ifndef UI_HEADLESS_H +#define UI_HEADLESS_H + +void ui_populate_headless_interface(); + +#endif