annotate src/audacious/main.c @ 4664:46c02b5589c2

commited initial version of new UI, which can be tested via "audacious -H"
author mf0102 <0102@gmx.at>
date Sun, 29 Jun 2008 01:27:24 +0200
parents 8a783f826316
children 2079f04c19e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious development team.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
3 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
4 * Based on BMP:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
6 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
7 * Based on XMMS:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
9 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2973
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
13 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
18 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2973
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
3123
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
21 *
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
22 * The Audacious team does not consider modular code linking to
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
23 * Audacious or using our public API to be a derived work.
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
24 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
25
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
27 # include "config.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
28 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
29
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
30 #include "main.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
31
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
32 #include <glib.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
33 #include <glib/gi18n.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
34 #include <glib/gprintf.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
35 #include <gdk/gdk.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
36 #include <stdlib.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
37 #include <string.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
38 #include <getopt.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
39 #include <ctype.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
40 #include <time.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
41
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
42 #include <unistd.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
43 #include <errno.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
44 #include <sys/types.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
45 #include <sys/stat.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
46 #include <signal.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
47
4523
b3e4f5c31546 Conditional USE_SRC was changed to USE_SAMPLERATE earlier.
Matti Hamalainen <ccr@tnsp.org>
parents: 4517
diff changeset
48 #ifdef USE_SAMPLERATE
4267
a41fb6bc632a - src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4256
diff changeset
49 # include <samplerate.h>
a41fb6bc632a - src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4256
diff changeset
50 #endif
a41fb6bc632a - src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4256
diff changeset
51
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
52 #include "platform/smartinclude.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
53
2717
6884a2144a01 [svn] - make audacious build again
nenolod
parents: 2711
diff changeset
54 #include "configdb.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
55 #include "vfs.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
56
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents: 2682
diff changeset
57 #ifdef USE_DBUS
2711
c35913222440 [svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents: 2709
diff changeset
58 # include "dbus-service.h"
2785
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2736
diff changeset
59 # include "audctrl.h"
2694
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents: 2682
diff changeset
60 #endif
c2b82432c1b6 [svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents: 2682
diff changeset
61
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
62 #include "auddrct.h"
4347
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
63 #include "build_stamp.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
64 #include "dnd.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
65 #include "input.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
66 #include "logger.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
67 #include "output.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
68 #include "playback.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
69 #include "playlist.h"
4347
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
70 #include "pluginenum.h"
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
71 #include "signals.h"
4508
246244ead30e renamed skin.* to ui_skin.* and moved ui_skinned_widget_draw() to it
mf0102 <0102@gmx.at>
parents: 4504
diff changeset
72 #include "ui_skin.h"
4347
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
73 #include "ui_equalizer.h"
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
74 #include "ui_fileinfo.h"
4504
a47288ced5d5 - renamed some files to reflect their UI contents
mf0102 <0102@gmx.at>
parents: 4494
diff changeset
75 #include "ui_hints.h"
4347
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
76 #include "ui_main.h"
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
77 #include "ui_manager.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
78 #include "ui_playlist.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
79 #include "ui_preferences.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
80 #include "ui_skinselector.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
81 #include "util.h"
4347
f493c456c77f Still cleaning up stuff
mf0102 <0102@gmx.at>
parents: 4325
diff changeset
82
4234
b293ce14a01a partially works...
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
83 #include "libSAD.h"
4492
55262ebeba2d Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents: 4467
diff changeset
84 #ifdef USE_EGGSM
4315
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents: 4286
diff changeset
85 #include "eggsmclient.h"
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents: 4286
diff changeset
86 #include "eggdesktopfile.h"
4492
55262ebeba2d Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents: 4467
diff changeset
87 #endif
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
88
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
89 #include "icons-stock.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
90 #include "images/audacious_player.xpm"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
91
4664
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
92
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
93 #include "ui_new.h"
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
94
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
95
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
96
4517
6e412073cf28 cleaned up some more
mf0102 <0102@gmx.at>
parents: 4508
diff changeset
97 static const gchar *application_name = N_("Audacious");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
98
4350
8071e599916d renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents: 4347
diff changeset
99 struct _AudCmdLineOpt {
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
100 gchar **filenames;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
101 gint session;
3351
7a4fcf84a34f Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents: 3346
diff changeset
102 gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
103 gboolean enqueue, mainwin, remote, activate;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
104 gboolean load_skins;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
105 gboolean headless;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
106 gboolean no_log;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
107 gboolean enqueue_to_temp;
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
108 gboolean version;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
109 gchar *previous_session_id;
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
110 gboolean macpack;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
111 };
4350
8071e599916d renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents: 4347
diff changeset
112 typedef struct _AudCmdLineOpt AudCmdLineOpt;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
113
4517
6e412073cf28 cleaned up some more
mf0102 <0102@gmx.at>
parents: 4508
diff changeset
114 static AudCmdLineOpt options;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
115
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
116 gchar *aud_paths[BMP_PATH_COUNT] = {};
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
117
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
118 GCond *cond_scan;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
119 GMutex *mutex_scan;
3346
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3334
diff changeset
120 #ifdef USE_DBUS
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3334
diff changeset
121 MprisPlayer *mpris;
71d8d93f1bad Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents: 3334
diff changeset
122 #endif
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
123
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
124 static void
4542
26209b646930 Some cosmetic changes
mf0102 <0102@gmx.at>
parents: 4532
diff changeset
125 print_version(void)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
126 {
4450
413d80f7b011 remove the strange feature list feature, which was used for GConf only
mf0102 <0102@gmx.at>
parents: 4449
diff changeset
127 g_printf("%s %s [%s]\n", _(application_name), VERSION, svn_stamp);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
128 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
129
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
130 static void
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
131 aud_make_user_dir(void)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
132 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
133 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
134
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
135 make_directory(aud_paths[BMP_PATH_USER_DIR], mode755);
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
136 make_directory(aud_paths[BMP_PATH_USER_PLUGIN_DIR], mode755);
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
137 make_directory(aud_paths[BMP_PATH_USER_SKIN_DIR], mode755);
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
138 make_directory(aud_paths[BMP_PATH_SKIN_THUMB_DIR], mode755);
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
139 make_directory(aud_paths[BMP_PATH_PLAYLISTS_DIR], mode755);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
140 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
141
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
142 static void
4543
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
143 aud_free_paths(void)
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
144 {
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
145 int i;
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
146
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
147 for (i = 0; i < BMP_PATH_COUNT; i++)
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
148 {
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
149 g_free(aud_paths[i]);
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
150 aud_paths[i] = 0;
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
151 }
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
152 }
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
153
ed94ac6182df whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents: 4542
diff changeset
154 static void
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
155 aud_init_paths()
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
156 {
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
157 char *xdg_config_home;
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
158 char *xdg_data_home;
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
159 char *xdg_cache_home;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
160
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
161 xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
162 ? g_build_filename(g_get_home_dir(), ".config", NULL)
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
163 : g_strdup(getenv("XDG_CONFIG_HOME")));
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
164 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
165 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL)
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
166 : g_strdup(getenv("XDG_DATA_HOME")));
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
167 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
168 ? g_build_filename(g_get_home_dir(), ".cache", NULL)
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
169 : g_strdup(getenv("XDG_CACHE_HOME")));
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
170
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
171 aud_paths[BMP_PATH_USER_DIR] =
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
172 g_build_filename(xdg_config_home, "audacious", NULL);
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
173 aud_paths[BMP_PATH_USER_SKIN_DIR] =
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
174 g_build_filename(xdg_data_home, "audacious", "Skins", NULL);
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
175 aud_paths[BMP_PATH_USER_PLUGIN_DIR] =
2506
630910fd140f [svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents: 2475
diff changeset
176 g_build_filename(xdg_data_home, "audacious", "Plugins", NULL);
630910fd140f [svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents: 2475
diff changeset
177
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
178 aud_paths[BMP_PATH_SKIN_THUMB_DIR] =
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
179 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
180
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
181 aud_paths[BMP_PATH_PLAYLISTS_DIR] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
182 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "playlists", NULL);
3400
8764498b75ed Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3351
diff changeset
183
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
184 aud_paths[BMP_PATH_CONFIG_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
185 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "config", NULL);
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
186 #ifdef HAVE_XSPF_PLAYLIST
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
187 aud_paths[BMP_PATH_PLAYLIST_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
188 g_build_filename(aud_paths[BMP_PATH_USER_DIR],
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
189 "playlist.xspf", NULL);
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
190 #else
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
191 aud_paths[BMP_PATH_PLAYLIST_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
192 g_build_filename(aud_paths[BMP_PATH_USER_DIR],
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
193 "playlist.m3u", NULL);
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
194 #endif
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
195 aud_paths[BMP_PATH_ACCEL_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
196 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "accels", NULL);
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
197 aud_paths[BMP_PATH_LOG_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
198 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "log", NULL);
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
199
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
200 aud_paths[BMP_PATH_GTKRC_FILE] =
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
201 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "gtkrc", NULL);
2463
e32be86095aa [svn] - re-add support for gtkrc files
nenolod
parents: 2461
diff changeset
202
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
203 g_free(xdg_config_home);
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
204 g_free(xdg_data_home);
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
205 g_free(xdg_cache_home);
2317
49d285f6008b [svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents: 2313
diff changeset
206
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
207 g_atexit(aud_free_paths);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
208 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
209
4542
26209b646930 Some cosmetic changes
mf0102 <0102@gmx.at>
parents: 4532
diff changeset
210 static void
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
211 aud_set_default_icon(void)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
212 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
213 GdkPixbuf *icon;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
214
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
215 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
216 gtk_window_set_default_icon(icon);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
217 g_object_unref(icon);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
218 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
219
3525
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
220 #ifdef GDK_WINDOWING_QUARTZ
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
221 static void
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
222 set_dock_icon(void)
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
223 {
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
224 GdkPixbuf *icon, *pixbuf;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
225 CGColorSpaceRef colorspace;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
226 CGDataProviderRef data_provider;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
227 CGImageRef image;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
228 gpointer data;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
229 gint rowstride, pixbuf_width, pixbuf_height;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
230 gboolean has_alpha;
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
231
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
232 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
233 pixbuf = gdk_pixbuf_scale_simple(icon, 128, 128, GDK_INTERP_BILINEAR);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
234
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
235 data = gdk_pixbuf_get_pixels(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
236 pixbuf_width = gdk_pixbuf_get_width(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
237 pixbuf_height = gdk_pixbuf_get_height(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
238 rowstride = gdk_pixbuf_get_rowstride(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
239 has_alpha = gdk_pixbuf_get_has_alpha(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
240
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
241 /* create the colourspace for the CGImage. */
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
242 colorspace = CGColorSpaceCreateDeviceRGB();
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
243 data_provider = CGDataProviderCreateWithData(NULL, data,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
244 pixbuf_height * rowstride,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
245 NULL);
3525
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
246 image = CGImageCreate(pixbuf_width, pixbuf_height, 8,
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
247 has_alpha ? 32 : 24, rowstride, colorspace,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
248 has_alpha ? kCGImageAlphaLast : 0,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
249 data_provider, NULL, FALSE,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
250 kCGRenderingIntentDefault);
3525
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
251
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
252 /* release the colourspace and data provider, we have what we want. */
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
253 CGDataProviderRelease(data_provider);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
254 CGColorSpaceRelease(colorspace);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
255
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
256 /* set the dock tile images */
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
257 SetApplicationDockTileImage(image);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
258
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
259 #if 0
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
260 /* and release */
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
261 CGImageRelease(image);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
262 g_object_unref(icon);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
263 g_object_unref(pixbuf);
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
264 #endif
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
265 }
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
266 #endif
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
267
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
268 static GOptionEntry cmd_entries[] = {
2448
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
269 {"rew", 'r', 0, G_OPTION_ARG_NONE, &options.rew, N_("Skip backwards in playlist"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
270 {"play", 'p', 0, G_OPTION_ARG_NONE, &options.play, N_("Start playing current playlist"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
271 {"pause", 'u', 0, G_OPTION_ARG_NONE, &options.pause, N_("Pause current song"), NULL},
2475
5fcdef6e3754 [svn] - fix audacious -s, closes #778.
nenolod
parents: 2463
diff changeset
272 {"stop", 's', 0, G_OPTION_ARG_NONE, &options.stop, N_("Stop current song"), NULL},
2551
cea3528b2996 [svn] Fix --play-pause commandline option, by Alex "Monkey" Maclean in #gentoo-x86
chainsaw
parents: 2530
diff changeset
273 {"play-pause", 't', 0, G_OPTION_ARG_NONE, &options.play_pause, N_("Pause if playing, play otherwise"), NULL},
2448
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
274 {"fwd", 'f', 0, G_OPTION_ARG_NONE, &options.fwd, N_("Skip forward in playlist"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
275 {"show-jump-box", 'j', 0, G_OPTION_ARG_NONE, &options.show_jump_box, N_("Display Jump to File dialog"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
276 {"enqueue", 'e', 0, G_OPTION_ARG_NONE, &options.enqueue, N_("Don't clear the playlist"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
277 {"enqueue-to-temp", 'E', 0, G_OPTION_ARG_NONE, &options.enqueue_to_temp, N_("Add new files to a temporary playlist"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
278 {"show-main-window", 'm', 0, G_OPTION_ARG_NONE, &options.mainwin, N_("Display the main window"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
279 {"activate", 'a', 0, G_OPTION_ARG_NONE, &options.activate, N_("Display all open Audacious windows"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
280 {"headless", 'H', 0, G_OPTION_ARG_NONE, &options.headless, N_("Enable headless operation"), NULL},
ff135e2ba10e [svn] - mark some strings used by GOption as translatable
nenolod
parents: 2420
diff changeset
281 {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL},
4545
c9be7256db08 we don't show builtin features anymore
mf0102 <0102@gmx.at>
parents: 4544
diff changeset
282 {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version"), NULL},
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
283 #ifdef GDK_WINDOWING_QUARTZ
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
284 {"macpack", 'n', 0, G_OPTION_ARG_NONE, &options.macpack, N_("Used in macpacking"), NULL}, /* Make this hidden */
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
285 #endif
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
286 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, N_("FILE..."), NULL},
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
287 {NULL},
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
288 };
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
289
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
290 static gboolean
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
291 aud_start_playback(gpointer unused)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
292 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
293 drct_play();
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
294 return FALSE;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
295 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
296
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
297 static void
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
298 parse_cmd_line_options(gint *argc, gchar ***argv)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
299 {
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
300 GOptionContext *context;
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
301 GError *error = NULL;
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
302
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
303 memset(&options, '\0', sizeof(AudCmdLineOpt));
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
304 options.session = -1;
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
305
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
306 context = g_option_context_new(_("- play multimedia files"));
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
307 g_option_context_add_main_entries(context, cmd_entries, PACKAGE_NAME);
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
308 g_option_context_add_group(context, gtk_get_option_group(FALSE));
4492
55262ebeba2d Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents: 4467
diff changeset
309 #ifdef USE_EGGSM
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
310 g_option_context_add_group(context, egg_sm_client_get_option_group());
4492
55262ebeba2d Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents: 4467
diff changeset
311 #endif
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
312 if (!g_option_context_parse(context, argc, argv, &error))
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
313 /* checking for MacOS X -psn_0_* errors*/
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
314 if (error->message && !g_strrstr(error->message,"-psn_0_"))
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
315 {
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
316 g_printerr(_("%s: %s\nTry `%s --help' for more information.\n"),
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
317 (*argv)[0], error->message, (*argv)[0]);
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
318 exit(EXIT_FAILURE);
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
319 }
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
320 }
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
321
4575
92952061147d Fix the initialization after messing it up myself - commandline argument handling was happening twice.
Matti Hamalainen <ccr@tnsp.org>
parents: 4563
diff changeset
322 static void
4593
bc29f566be02 Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents: 4587
diff changeset
323 handle_cmd_line_options(gboolean skip)
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
324 {
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
325 gchar **filenames = options.filenames;
2785
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2736
diff changeset
326 #ifdef USE_DBUS
182aa34ae6c4 [svn] - implement some audacious-remote functions.
yaz
parents: 2736
diff changeset
327 DBusGProxy *session = audacious_get_dbus_proxy();
4661
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
328 gboolean is_running;
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
329
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
330 if (skip)
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
331 is_running = audacious_remote_is_running(session);
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
332 else
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
333 is_running = FALSE;
2727
14f9a629ba9c [svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents: 2717
diff changeset
334 #endif
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
335
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
336 if (options.version)
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
337 {
4542
26209b646930 Some cosmetic changes
mf0102 <0102@gmx.at>
parents: 4532
diff changeset
338 print_version();
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
339 exit(EXIT_SUCCESS);
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
340 }
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
341
2788
b2b920b165ad [svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents: 2786
diff changeset
342 #ifdef USE_DBUS
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
343 if (is_running)
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
344 {
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
345 if (filenames != NULL)
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
346 {
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
347 gint pos = 0;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
348 gint i = 0;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
349 GList *fns = NULL;
2512
3a1fc6f7c187 [svn] - unbreak relative path support. closes #791.
nenolod
parents: 2506
diff changeset
350
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
351 for (i = 0; filenames[i] != NULL; i++)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
352 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
353 gchar *filename;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
354 gchar *current_dir = g_get_current_dir();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
355
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
356 if (!strstr(filenames[i], "://"))
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
357 {
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
358 if (filenames[i][0] == '/')
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
359 filename = g_strdup_printf("file:///%s", filenames[i]);
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
360 else
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
361 filename = g_strdup_printf("file:///%s/%s", current_dir,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
362 filenames[i]);
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
363 }
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
364 else
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
365 filename = g_strdup(filenames[i]);
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
366
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
367 fns = g_list_prepend(fns, filename);
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
368
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
369 g_free(current_dir);
2411
ffbac11b3a77 [svn] - use GOption instead of getopt.
nenolod
parents: 2405
diff changeset
370 }
2512
3a1fc6f7c187 [svn] - unbreak relative path support. closes #791.
nenolod
parents: 2506
diff changeset
371
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
372 fns = g_list_reverse(fns);
2605
1ceaf00f9c6d [svn] - fix handling of multiple files on the command line.
nenolod
parents: 2574
diff changeset
373
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
374 if (options.load_skins)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
375 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
376 audacious_remote_set_skin(session, filenames[0]);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
377 skin_install_skin(filenames[0]);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
378 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
379 else
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
380 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
381 GList *i;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
382
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
383 if (options.enqueue_to_temp)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
384 audacious_remote_playlist_enqueue_to_temp(session, filenames[0]);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
385
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
386 if (options.enqueue && options.play)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
387 pos = audacious_remote_get_playlist_length(session);
2605
1ceaf00f9c6d [svn] - fix handling of multiple files on the command line.
nenolod
parents: 2574
diff changeset
388
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
389 if (!options.enqueue)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
390 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
391 audacious_remote_playlist_clear(session);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
392 audacious_remote_stop(session);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
393 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
394
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
395 for (i = fns; i != NULL; i = i->next)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
396 audacious_remote_playlist_add_url_string(session, i->data);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
397
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
398 if (options.enqueue && options.play &&
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
399 audacious_remote_get_playlist_length(session) > pos)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
400 audacious_remote_set_playlist_pos(session, pos);
2605
1ceaf00f9c6d [svn] - fix handling of multiple files on the command line.
nenolod
parents: 2574
diff changeset
401
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
402 if (!options.enqueue)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
403 audacious_remote_play(session);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
404 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
405
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
406 g_list_foreach(fns, (GFunc) g_free, NULL);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
407 g_list_free(fns);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
408
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
409 g_strfreev(filenames);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
410 } /* filename */
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
411
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
412 if (options.rew)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
413 audacious_remote_playlist_prev(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
414
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
415 if (options.play)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
416 audacious_remote_play(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
417
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
418 if (options.pause)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
419 audacious_remote_pause(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
420
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
421 if (options.stop)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
422 audacious_remote_stop(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
423
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
424 if (options.fwd)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
425 audacious_remote_playlist_next(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
426
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
427 if (options.play_pause)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
428 audacious_remote_play_pause(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
429
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
430 if (options.show_jump_box)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
431 audacious_remote_show_jtf_box(session);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
432
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
433 if (options.mainwin)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
434 audacious_remote_main_win_toggle(session, TRUE);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
435
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
436 if (options.activate)
2832
a6f541819bbc [svn] fixed bug #972
magma
parents: 2806
diff changeset
437 audacious_remote_activate(session);
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
438
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
439 exit(EXIT_SUCCESS);
4026
17bf734f8187 avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3978
diff changeset
440 } /* is_running */
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
441 else
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
442 #endif
4593
bc29f566be02 Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents: 4587
diff changeset
443 if (!skip) { /* !is_running */
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
444 if (filenames != NULL)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
445 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
446 gint pos = 0;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
447 gint i = 0;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
448 GList *fns = NULL;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
449
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
450 for (i = 0; filenames[i] != NULL; i++)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
451 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
452 gchar *filename;
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
453 gchar *current_dir = g_get_current_dir();
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
454
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
455 if (!strstr(filenames[i], "://"))
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
456 {
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
457 if (filenames[i][0] == '/')
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
458 filename = g_strdup_printf("file:///%s", filenames[i]);
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
459 else
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
460 filename = g_strdup_printf("file:///%s/%s", current_dir,
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
461 filenames[i]);
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
462 }
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
463 else
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
464 filename = g_strdup(filenames[i]);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
465
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
466 fns = g_list_prepend(fns, filename);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
467
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
468 g_free(current_dir);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
469 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
470
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
471 fns = g_list_reverse(fns);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
472
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
473 {
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
474 if (options.enqueue_to_temp)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
475 drct_pl_enqueue_to_temp(filenames[0]);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
476
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
477 if (options.enqueue && options.play)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
478 pos = drct_pl_get_length();
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
479
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
480 if (!options.enqueue)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
481 {
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
482 drct_pl_clear();
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
483 drct_stop();
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
484 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
485
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
486 drct_pl_add(fns);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
487
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
488 if (options.enqueue && options.play &&
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
489 drct_pl_get_length() > pos)
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
490 drct_pl_set_pos(pos);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
491
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
492 if (!options.enqueue)
3883
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
493 g_idle_add(aud_start_playback, NULL);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
494 }
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
495
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
496 g_list_foreach(fns, (GFunc) g_free, NULL);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
497 g_list_free(fns);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
498
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
499 g_strfreev(filenames);
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
500 } /* filename */
6aaf5476b765 commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents: 3753
diff changeset
501
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
502 if (options.rew)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
503 drct_pl_prev();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
504
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
505 if (options.play)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
506 drct_play();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
507
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
508 if (options.pause)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
509 drct_pause();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
510
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
511 if (options.stop)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
512 drct_stop();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
513
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
514 if (options.fwd)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
515 drct_pl_next();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
516
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
517 if (options.play_pause) {
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
518 if (drct_get_paused())
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
519 drct_play();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
520 else
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
521 drct_pause();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
522 }
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
523
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
524 if (options.show_jump_box)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
525 drct_jtf_show();
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
526
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
527 if (options.mainwin)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
528 drct_main_win_toggle(TRUE);
2845
a124656d4423 added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents: 2838
diff changeset
529
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
530 if (options.activate)
3753
22d71f986b86 export AudDRCT API.
William Pitcock <nenolod@atheme.org>
parents: 3686
diff changeset
531 drct_activate();
4026
17bf734f8187 avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3978
diff changeset
532 } /* !is_running */
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
533 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
534
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
535 static void
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
536 aud_setup_logger(void)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
537 {
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
538 if (!aud_logger_start(aud_paths[BMP_PATH_LOG_FILE]))
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
539 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
540
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
541 g_atexit(aud_logger_stop);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
542 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
543
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
544 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
545 run_load_skin_error_dialog(const gchar * skin_path)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
546 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
547 const gchar *markup =
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
548 N_("<b><big>Unable to load skin.</big></b>\n"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
549 "\n"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
550 "Check that skin at '%s' is usable and default skin is properly "
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
551 "installed at '%s'\n");
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
552
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
553 GtkWidget *dialog =
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
554 gtk_message_dialog_new_with_markup(NULL,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
555 GTK_DIALOG_MODAL,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
556 GTK_MESSAGE_ERROR,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
557 GTK_BUTTONS_CLOSE,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
558 _(markup),
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
559 skin_path,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
560 BMP_DEFAULT_SKIN_PATH);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
561 gtk_dialog_run(GTK_DIALOG(dialog));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
562 gtk_widget_destroy(dialog);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
563 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
564
2369
847213941224 [svn] - new headless event loop
nenolod
parents: 2364
diff changeset
565 static gboolean
847213941224 [svn] - new headless event loop
nenolod
parents: 2364
diff changeset
566 aud_headless_iteration(gpointer unused)
847213941224 [svn] - new headless event loop
nenolod
parents: 2364
diff changeset
567 {
2506
630910fd140f [svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents: 2475
diff changeset
568 free_vis_data();
630910fd140f [svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents: 2475
diff changeset
569 return TRUE;
2369
847213941224 [svn] - new headless event loop
nenolod
parents: 2364
diff changeset
570 }
847213941224 [svn] - new headless event loop
nenolod
parents: 2364
diff changeset
571
3480
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
572 static gboolean
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
573 load_extra_playlist(const gchar * path, const gchar * basename,
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
574 gpointer def)
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
575 {
4644
23e712435e3e Remove an unused variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 4635
diff changeset
576 Playlist *playlist = playlist_new();
23e712435e3e Remove an unused variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 4635
diff changeset
577
3480
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
578 if (!playlist) {
4635
ca64cd387021 Remove dead code.
Matti Hamalainen <ccr@tnsp.org>
parents: 4593
diff changeset
579 g_warning("Couldn't create new playlist for %s / %s\n", path, basename);
3480
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
580 return FALSE;
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
581 }
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
582
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
583 playlist_add_playlist(playlist);
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
584 playlist_load(playlist, path);
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
585
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
586 return FALSE; /* keep loading other playlists */
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
587 }
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
588
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
589 static void
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
590 resume_playback_on_startup()
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
591 {
4563
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
592 gint i;
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
593
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
594 if (!cfg.resume_playback_on_startup ||
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
595 cfg.resume_playback_on_startup_time == -1 ||
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
596 playlist_get_length(playlist_get_active()) <= 0)
8084f49a930a Silence some pointless warnings in resume_playback_on_startup() by not using g_return_if_fail().
Matti Hamalainen <ccr@tnsp.org>
parents: 4562
diff changeset
597 return;
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
598
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
599 while (gtk_events_pending()) gtk_main_iteration();
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
600
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
601 playback_initiate();
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
602
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
603 /* Busy wait; loop is fairly tight to minimize duration of
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
604 * "frozen" GUI. Feel free to tune. --chainsaw */
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
605 for (i = 0; i < 20; i++)
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
606 {
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
607 g_usleep(1000);
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
608 if (!ip_data.playing)
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
609 break;
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
610 }
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
611 playback_seek(cfg.resume_playback_on_startup_time / 1000);
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
612 }
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
613
4448
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
614 static void
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
615 playlist_system_init()
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
616 {
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
617 Playlist *playlist;
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
618
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
619 playlist_init();
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
620 playlist = playlist_get_active();
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
621 playlist_load(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE]);
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
622 playlist_set_position(playlist, cfg.playlist_position);
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
623
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
624 /* Load extra playlists */
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
625 if (!dir_foreach(aud_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist,
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
626 playlist, NULL))
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
627 g_warning("Could not load extra playlists\n");
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
628 }
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
629
4449
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
630 void
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
631 aud_quit(void)
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
632 {
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
633 GList *playlists = NULL, *playlists_top = NULL;
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
634
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
635 playlist_stop_get_info_thread();
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
636
4494
0f43f3a5eb12 Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents: 4492
diff changeset
637 aud_config_save();
0f43f3a5eb12 Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents: 4492
diff changeset
638
4449
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
639 if (options.headless == FALSE)
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
640 {
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
641 gtk_widget_hide(equalizerwin);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
642 gtk_widget_hide(playlistwin);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
643 gtk_widget_hide(mainwin);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
644
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
645 gtk_accel_map_save(aud_paths[BMP_PATH_ACCEL_FILE]);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
646 gtk_main_quit();
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
647
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
648 cleanup_skins();
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
649 }
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
650
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
651 plugin_system_cleanup();
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
652
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
653 /* free and clear each playlist */
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
654 playlists = playlist_get_playlists();
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
655 playlists_top = playlists;
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
656 while ( playlists != NULL )
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
657 {
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
658 playlist_clear((Playlist*)playlists->data);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
659 playlist_free((Playlist*)playlists->data);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
660 playlists = g_list_next(playlists);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
661 }
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
662 g_list_free( playlists_top );
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
663
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
664 g_cond_free(cond_scan);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
665 g_mutex_free(mutex_scan);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
666
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
667 exit(EXIT_SUCCESS);
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
668 }
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
669
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
670 gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
671 main(gint argc, gchar ** argv)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
672 {
2644
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
673 /* glib-2.13.0 requires g_thread_init() to be called before all
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
674 other GLib functions */
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
675 g_thread_init(NULL);
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
676 if (!g_thread_supported()) {
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
677 g_printerr(_("Sorry, threads aren't supported on your platform.\n"));
2644
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
678 exit(EXIT_FAILURE);
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
679 }
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
680
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
681 gdk_threads_init();
4562
a6d0f9d6198a Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents: 4545
diff changeset
682 mowgli_init();
2644
67082557b2c4 [svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents: 2605
diff changeset
683
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
684 /* Setup l10n early so we can print localized error messages */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
685 gtk_set_locale();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
686 bindtextdomain(PACKAGE_NAME, LOCALEDIR);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
687 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
2388
52bcc18eb8bb [svn] - attempt to bind the audacious-plugins domain
nenolod
parents: 2369
diff changeset
688 bindtextdomain(PACKAGE_NAME "-plugins", LOCALEDIR);
52bcc18eb8bb [svn] - attempt to bind the audacious-plugins domain
nenolod
parents: 2369
diff changeset
689 bind_textdomain_codeset(PACKAGE_NAME "-plugins", "UTF-8");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
690 textdomain(PACKAGE_NAME);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
691
4492
55262ebeba2d Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents: 4467
diff changeset
692 #if !defined(_WIN32) && defined(USE_EGGSM)
4315
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents: 4286
diff changeset
693 egg_set_desktop_file(AUDACIOUS_DESKTOP_FILE);
c942eaef7bc6 Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents: 4286
diff changeset
694 #endif
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
695 aud_init_paths();
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
696 aud_make_user_dir();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
697
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
698 cond_scan = g_cond_new();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
699 mutex_scan = g_mutex_new();
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
700 gtk_rc_add_default_file(aud_paths[BMP_PATH_GTKRC_FILE]);
2463
e32be86095aa [svn] - re-add support for gtkrc files
nenolod
parents: 2461
diff changeset
701
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
702 parse_cmd_line_options(&argc, &argv);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
703
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
704 if (options.no_log == FALSE)
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
705 aud_setup_logger();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
706
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
707 g_message("Initializing Gtk+");
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
708 if (!gtk_init_check(&argc, &argv) && options.headless == FALSE) {
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
709 /* GTK check failed, and no arguments passed to indicate
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
710 that user is intending to only remote control a running
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
711 session */
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
712 g_printerr(_("%s: Unable to open display, exiting.\n"), argv[0]);
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
713 exit(EXIT_FAILURE);
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
714 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
715
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
716 g_message("Setting up libSAD");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
717 g_random_set_seed(time(NULL));
4234
b293ce14a01a partially works...
Eugene Zagidullin <e.asphyx@gmail.com>
parents: 4232
diff changeset
718 SAD_dither_init_rand((gint32)time(NULL));
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
719
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
720 g_message("Loading configuration");
4412
180996fcf12a bmp_config_* -> aud_config_*
Matti Hamalainen <ccr@tnsp.org>
parents: 4411
diff changeset
721 aud_config_load();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
722
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
723 g_message("Initializing signal handlers");
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
724 signal_handlers_init();
4562
a6d0f9d6198a Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents: 4545
diff changeset
725
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
726 g_message("Handling commandline options, part #1");
4593
bc29f566be02 Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents: 4587
diff changeset
727 handle_cmd_line_options(TRUE);
3306
404ffedef3e1 added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents: 3296
diff changeset
728
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
729 if (options.headless == FALSE)
3306
404ffedef3e1 added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents: 3296
diff changeset
730 {
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
731 g_message("Non-headless operation setup");
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
732 ui_main_check_theme_engine();
3965
aea8b763b134 Work around the issues with broken Gtk-Qt-Engine and Modern skins with inline GTK.
William Pitcock <nenolod@atheme.org>
parents: 3959
diff changeset
733
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
734 /* register icons in stock
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
735 NOTE: should be called before UIManager */
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
736 register_aud_stock_icons();
3978
40db2fe8d073 - fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents: 3965
diff changeset
737
4356
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
738 /* UIManager
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
739 NOTE: this needs to be called before plugin init, cause
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
740 plugin init functions may want to add custom menu entries */
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
741 ui_manager_init();
87cb9d3402d4 rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents: 4355
diff changeset
742 ui_manager_create_menus();
3306
404ffedef3e1 added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents: 3296
diff changeset
743 }
404ffedef3e1 added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents: 3296
diff changeset
744
4661
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
745 #ifdef USE_DBUS
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
746 g_message("Initializing D-Bus");
4661
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
747 init_dbus();
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
748 #endif
e4e7999a21bc Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents: 4644
diff changeset
749
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
750 g_message("Initializing plugin subsystems...");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
751 plugin_system_init();
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
752
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
753 g_message("Setting up playlists");
4448
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
754 playlist_system_init();
4562
a6d0f9d6198a Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents: 4545
diff changeset
755
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
756 g_message("Handling commandline options, part #2");
4593
bc29f566be02 Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents: 4587
diff changeset
757 handle_cmd_line_options(FALSE);
bc29f566be02 Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents: 4587
diff changeset
758
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
759
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
760 g_message("Playlist scanner thread startup");
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
761 playlist_start_get_info_thread();
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
762
4448
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
763 output_set_volume((cfg.saved_volume & 0xff00) >> 8,
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
764 (cfg.saved_volume & 0x00ff));
3dd13b275b4e restructuring
mf0102 <0102@gmx.at>
parents: 4413
diff changeset
765
4355
3aeb45aeeaed fixed headless mode; minor cleanups
mf0102 <0102@gmx.at>
parents: 4352
diff changeset
766 if (options.headless == FALSE)
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
767 {
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
768 g_message("GUI and skin setup");
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
769 aud_set_default_icon();
3525
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
770 #ifdef GDK_WINDOWING_QUARTZ
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
771 set_dock_icon();
540e49d1d87c macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents: 3400
diff changeset
772 #endif
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
773
4413
de33c83aa06f Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents: 4412
diff changeset
774 gtk_accel_map_load(aud_paths[BMP_PATH_ACCEL_FILE]);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
775
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
776 if (!init_skins(cfg.skin)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
777 run_load_skin_error_dialog(cfg.skin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
778 exit(EXIT_FAILURE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
779 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
780
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
781 GDK_THREADS_ENTER();
3480
3f4ad59a5c02 Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents: 3443
diff changeset
782
4357
e22a8deaf7b5 more headless fixes
mf0102 <0102@gmx.at>
parents: 4356
diff changeset
783 /* this needs to be called after all 3 windows are created and
e22a8deaf7b5 more headless fixes
mf0102 <0102@gmx.at>
parents: 4356
diff changeset
784 * input plugins are setup'ed
e22a8deaf7b5 more headless fixes
mf0102 <0102@gmx.at>
parents: 4356
diff changeset
785 * but not if we're running headless --nenolod
e22a8deaf7b5 more headless fixes
mf0102 <0102@gmx.at>
parents: 4356
diff changeset
786 */
e22a8deaf7b5 more headless fixes
mf0102 <0102@gmx.at>
parents: 4356
diff changeset
787 mainwin_setup_menus();
4587
ab8bc8a89a52 remove ui_main_set_initial_volume, call volume set hook instead
Tomasz Mon <desowin@gmail.com>
parents: 4575
diff changeset
788
ab8bc8a89a52 remove ui_main_set_initial_volume, call volume set hook instead
Tomasz Mon <desowin@gmail.com>
parents: 4575
diff changeset
789 gint h_vol[2];
ab8bc8a89a52 remove ui_main_set_initial_volume, call volume set hook instead
Tomasz Mon <desowin@gmail.com>
parents: 4575
diff changeset
790 input_get_volume(&h_vol[0], &h_vol[1]);
ab8bc8a89a52 remove ui_main_set_initial_volume, call volume set hook instead
Tomasz Mon <desowin@gmail.com>
parents: 4575
diff changeset
791 hook_call("volume set", h_vol);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
792
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
793 /* FIXME: delayed, because it deals directly with the plugin
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
794 * interface to set menu items */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
795 create_prefs_window();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
796
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
797 create_fileinfo_window();
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
798
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
799
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
800 if (cfg.player_visible)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
801 mainwin_show(TRUE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
802 else if (!cfg.playlist_visible && !cfg.equalizer_visible)
2651
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2644
diff changeset
803 {
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2644
diff changeset
804 /* all of the windows are hidden... warn user about this */
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2644
diff changeset
805 mainwin_show_visibility_warning();
4d5e6a8717dd [svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents: 2644
diff changeset
806 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
807
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
808 if (cfg.equalizer_visible)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
809 equalizerwin_show(TRUE);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
810
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
811 if (cfg.playlist_visible)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
812 playlistwin_show();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
813
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
814 hint_set_always(cfg.always_on_top);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
815
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
816 resume_playback_on_startup();
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
817
4662
8a783f826316 Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents: 4661
diff changeset
818 g_message("Entering Gtk+ main loop!");
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
819 gtk_main();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
820
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
821 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
822 }
2364
85ddfad4f55e [svn] beautify and comment main.c
mf0102
parents: 2348
diff changeset
823 // if we are running headless
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
824 else
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
825 {
4664
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
826 /* temporarily headless operation is disabled in favour of
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
827 * testing the new UI */
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
828 ui_initialize();
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
829
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
830 #if 0
4366
1f900d7b737b print a note when headless operation is enabled
mf0102 <0102@gmx.at>
parents: 4365
diff changeset
831 g_print(_("Headless operation enabled\n"));
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
832 resume_playback_on_startup();
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
833
2506
630910fd140f [svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents: 2475
diff changeset
834 g_timeout_add(10, aud_headless_iteration, NULL);
4504
a47288ced5d5 - renamed some files to reflect their UI contents
mf0102 <0102@gmx.at>
parents: 4494
diff changeset
835 g_main_loop_run(g_main_loop_new(NULL, TRUE));
4664
46c02b5589c2 commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents: 4662
diff changeset
836 #endif
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
837 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
838
4449
19e3f3c5fe7f introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents: 4448
diff changeset
839 aud_quit();
4385
88d8f699359a moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents: 4374
diff changeset
840 return EXIT_SUCCESS;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
841 }