Mercurial > audlegacy
annotate src/audacious/main.c @ 4517:6e412073cf28
cleaned up some more
author | mf0102 <0102@gmx.at> |
---|---|
date | Wed, 23 Apr 2008 22:20:35 +0200 |
parents | 246244ead30e |
children | b3e4f5c31546 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team. | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
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 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
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 | 24 */ |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
30 #include "main.h" | |
31 | |
32 #include <glib.h> | |
33 #include <glib/gi18n.h> | |
34 #include <glib/gprintf.h> | |
35 #include <gdk/gdk.h> | |
36 #include <stdlib.h> | |
37 #include <string.h> | |
38 #include <getopt.h> | |
39 #include <ctype.h> | |
40 #include <time.h> | |
41 | |
42 #include <unistd.h> | |
43 #include <errno.h> | |
44 #include <sys/types.h> | |
45 #include <sys/stat.h> | |
46 #include <signal.h> | |
47 | |
4267
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
48 #ifdef USE_SRC |
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 | 52 #include "platform/smartinclude.h" |
53 | |
2717 | 54 #include "configdb.h" |
2313 | 55 #include "vfs.h" |
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 | 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 | 63 #include "build_stamp.h" |
2313 | 64 #include "dnd.h" |
65 #include "input.h" | |
66 #include "logger.h" | |
67 #include "output.h" | |
68 #include "playback.h" | |
69 #include "playlist.h" | |
4347 | 70 #include "pluginenum.h" |
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 | 73 #include "ui_equalizer.h" |
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 | 76 #include "ui_main.h" |
77 #include "ui_manager.h" | |
2313 | 78 #include "ui_playlist.h" |
79 #include "ui_preferences.h" | |
80 #include "ui_skinselector.h" | |
81 #include "util.h" | |
4347 | 82 |
4234 | 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 | 88 |
89 #include "icons-stock.h" | |
90 #include "images/audacious_player.xpm" | |
91 | |
4517 | 92 gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ |
93 static const gchar *application_name = N_("Audacious"); | |
2313 | 94 |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
95 struct _AudCmdLineOpt { |
2411 | 96 gchar **filenames; |
2313 | 97 gint session; |
3351
7a4fcf84a34f
Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents:
3346
diff
changeset
|
98 gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box; |
2313 | 99 gboolean enqueue, mainwin, remote, activate; |
100 gboolean load_skins; | |
101 gboolean headless; | |
102 gboolean no_log; | |
103 gboolean enqueue_to_temp; | |
2411 | 104 gboolean version; |
2313 | 105 gchar *previous_session_id; |
4355 | 106 gboolean macpack; |
2313 | 107 }; |
108 | |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
109 typedef struct _AudCmdLineOpt AudCmdLineOpt; |
2313 | 110 |
4517 | 111 static AudCmdLineOpt options; |
2313 | 112 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
113 const gchar *aud_titlestring_presets[] = { |
3296
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
114 "${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
115 "${?artist:${artist} - }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
116 "${?artist:${artist} - }${?album:${album} - }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
117 "${?artist:${artist} - }${?album:${album} - }${?track-number:${track-number}. }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
118 "${?artist:${artist} }${?album:[ ${album} ] }${?artist:- }${?track-number:${track-number}. }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
119 "${?album:${album} - }${title}" |
2313 | 120 }; |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
121 const guint n_titlestring_presets = G_N_ELEMENTS(aud_titlestring_presets); |
2313 | 122 |
123 const gchar *chardet_detector_presets[] = { | |
4043
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
124 N_("None"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
125 N_("Japanese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
126 N_("Taiwanese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
127 N_("Chinese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
128 N_("Korean"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
129 N_("Russian"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
130 N_("Greek"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
131 N_("Hebrew"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
132 N_("Turkish"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
133 N_("Arabic"), |
2313 | 134 #ifdef HAVE_UDET |
4043
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
135 N_("Universal") |
2313 | 136 #endif |
137 }; | |
4517 | 138 const guint n_chardet_detector_presets = G_N_ELEMENTS(chardet_detector_presets); |
2313 | 139 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
140 gchar *aud_paths[BMP_PATH_COUNT] = {}; |
2313 | 141 |
142 GCond *cond_scan; | |
143 GMutex *mutex_scan; | |
3346
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
144 #ifdef USE_DBUS |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
145 MprisPlayer *mpris; |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
146 #endif |
2313 | 147 |
148 static void | |
149 dump_version(void) | |
150 { | |
4450
413d80f7b011
remove the strange feature list feature, which was used for GConf only
mf0102 <0102@gmx.at>
parents:
4449
diff
changeset
|
151 g_printf("%s %s [%s]\n", _(application_name), VERSION, svn_stamp); |
2313 | 152 } |
153 | |
154 const gchar * | |
3334
ea806daf3ef0
rename xmms_get_gentitle_format() to get_gentitle_format().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3317
diff
changeset
|
155 get_gentitle_format(void) |
2313 | 156 { |
157 guint titlestring_preset = cfg.titlestring_preset; | |
158 | |
159 if (titlestring_preset < n_titlestring_presets) | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
160 return aud_titlestring_presets[titlestring_preset]; |
2313 | 161 |
162 return cfg.gentitle_format; | |
163 } | |
164 | |
165 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
166 aud_make_user_dir(void) |
2313 | 167 { |
168 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
169 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 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
|
174 make_directory(aud_paths[BMP_PATH_PLAYLISTS_DIR], mode755); |
2313 | 175 } |
176 | |
177 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
178 aud_free_paths(void) |
2313 | 179 { |
180 int i; | |
181 | |
182 for (i = 0; i < BMP_PATH_COUNT; i++) | |
183 { | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
184 g_free(aud_paths[i]); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
185 aud_paths[i] = 0; |
2313 | 186 } |
187 } | |
188 | |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
189 static void |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
190 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
|
191 { |
2364 | 192 char *xdg_config_home; |
193 char *xdg_data_home; | |
194 char *xdg_cache_home; | |
2313 | 195 |
2364 | 196 xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL |
197 ? g_build_filename(g_get_home_dir(), ".config", NULL) | |
198 : g_strdup(getenv("XDG_CONFIG_HOME"))); | |
199 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL | |
200 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) | |
201 : g_strdup(getenv("XDG_DATA_HOME"))); | |
202 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL | |
203 ? g_build_filename(g_get_home_dir(), ".cache", NULL) | |
204 : g_strdup(getenv("XDG_CACHE_HOME"))); | |
2313 | 205 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
206 aud_paths[BMP_PATH_USER_DIR] = |
2364 | 207 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
|
208 aud_paths[BMP_PATH_USER_SKIN_DIR] = |
2364 | 209 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
|
210 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
|
211 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
|
212 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
213 aud_paths[BMP_PATH_SKIN_THUMB_DIR] = |
2364 | 214 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); |
2313 | 215 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
216 aud_paths[BMP_PATH_PLAYLISTS_DIR] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
217 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
|
218 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
219 aud_paths[BMP_PATH_CONFIG_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
220 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
|
221 #ifdef HAVE_XSPF_PLAYLIST |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
222 aud_paths[BMP_PATH_PLAYLIST_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
223 g_build_filename(aud_paths[BMP_PATH_USER_DIR], |
2364 | 224 "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
|
225 #else |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
226 aud_paths[BMP_PATH_PLAYLIST_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
227 g_build_filename(aud_paths[BMP_PATH_USER_DIR], |
2364 | 228 "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
|
229 #endif |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
230 aud_paths[BMP_PATH_ACCEL_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
231 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
|
232 aud_paths[BMP_PATH_LOG_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
233 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
|
234 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
235 aud_paths[BMP_PATH_GTKRC_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
236 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "gtkrc", NULL); |
2463 | 237 |
2364 | 238 g_free(xdg_config_home); |
239 g_free(xdg_data_home); | |
240 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
|
241 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
242 g_atexit(aud_free_paths); |
2313 | 243 } |
244 | |
245 | |
246 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
247 aud_set_default_icon(void) |
2313 | 248 { |
249 GdkPixbuf *icon; | |
250 | |
251 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); | |
252 gtk_window_set_default_icon(icon); | |
253 g_object_unref(icon); | |
254 } | |
255 | |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
256 #ifdef GDK_WINDOWING_QUARTZ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
257 static void |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
258 set_dock_icon(void) |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
259 { |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
260 GdkPixbuf *icon, *pixbuf; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
261 CGColorSpaceRef colorspace; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
262 CGDataProviderRef data_provider; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
263 CGImageRef image; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
264 gpointer data; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
265 gint rowstride, pixbuf_width, pixbuf_height; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
266 gboolean has_alpha; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
267 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
268 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
|
269 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
|
270 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
271 data = gdk_pixbuf_get_pixels(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
272 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
|
273 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
|
274 rowstride = gdk_pixbuf_get_rowstride(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
275 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
|
276 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
277 /* create the colourspace for the CGImage. */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
278 colorspace = CGColorSpaceCreateDeviceRGB(); |
4355 | 279 data_provider = CGDataProviderCreateWithData(NULL, data, |
280 pixbuf_height * rowstride, | |
281 NULL); | |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
282 image = CGImageCreate(pixbuf_width, pixbuf_height, 8, |
4355 | 283 has_alpha ? 32 : 24, rowstride, colorspace, |
284 has_alpha ? kCGImageAlphaLast : 0, | |
285 data_provider, NULL, FALSE, | |
286 kCGRenderingIntentDefault); | |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
287 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
288 /* 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
|
289 CGDataProviderRelease(data_provider); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
290 CGColorSpaceRelease(colorspace); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
291 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
292 /* set the dock tile images */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
293 SetApplicationDockTileImage(image); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
294 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
295 #if 0 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
296 /* and release */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
297 CGImageRelease(image); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
298 g_object_unref(icon); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
299 g_object_unref(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
300 #endif |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
301 } |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
302 #endif |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
303 |
2411 | 304 static GOptionEntry cmd_entries[] = { |
2448
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
305 {"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
|
306 {"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
|
307 {"pause", 'u', 0, G_OPTION_ARG_NONE, &options.pause, N_("Pause current song"), NULL}, |
2475 | 308 {"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
|
309 {"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
|
310 {"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
|
311 {"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
|
312 {"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
|
313 {"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
|
314 {"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
|
315 {"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
|
316 {"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
|
317 {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
318 {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version and builtin features"), NULL}, |
4355 | 319 #ifdef GDK_WINDOWING_QUARTZ |
320 {"macpack", 'n', 0, G_OPTION_ARG_NONE, &options.macpack, N_("Used in macpacking"), NULL}, /* Make this hidden */ | |
321 #endif | |
2411 | 322 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, N_("FILE..."), NULL}, |
323 {NULL}, | |
324 }; | |
2313 | 325 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
326 static gboolean |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
327 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
|
328 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
329 drct_play(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
330 return FALSE; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
331 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
332 |
2313 | 333 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
|
334 parse_cmd_line_options(gint *argc, gchar ***argv) |
2313 | 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 GOptionContext *context; |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
337 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
|
338 |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
339 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
|
340 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
|
341 |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 #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
|
346 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
|
347 #endif |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
348 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
|
349 /* 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
|
350 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
|
351 { |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
352 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
|
353 (*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
|
354 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
|
355 } |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
356 } |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
357 |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
358 static void |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
359 handle_cmd_line_options() |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
360 { |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
361 gchar **filenames = options.filenames; |
2785 | 362 #ifdef USE_DBUS |
363 DBusGProxy *session = audacious_get_dbus_proxy(); | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
364 gboolean is_running = audacious_remote_is_running(session); |
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
365 #endif |
2313 | 366 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
367 if (options.version) |
2411 | 368 { |
369 dump_version(); | |
370 exit(EXIT_SUCCESS); | |
371 } | |
372 | |
2788
b2b920b165ad
[svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents:
2786
diff
changeset
|
373 #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
|
374 if (is_running) |
2411 | 375 { |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
376 if (filenames != NULL) |
2411 | 377 { |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
378 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
|
379 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
|
380 GList *fns = NULL; |
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
381 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
382 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
|
383 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
384 gchar *filename; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
385 gchar *current_dir = g_get_current_dir(); |
2313 | 386 |
4355 | 387 if (!strstr(filenames[i], "://")) |
388 { | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
389 if (filenames[i][0] == '/') |
4355 | 390 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
|
391 else |
4355 | 392 filename = g_strdup_printf("file:///%s/%s", current_dir, |
393 filenames[i]); | |
394 } | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
395 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
396 filename = g_strdup(filenames[i]); |
2411 | 397 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
398 fns = g_list_prepend(fns, filename); |
2411 | 399 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
400 g_free(current_dir); |
2411 | 401 } |
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
402 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
403 fns = g_list_reverse(fns); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
404 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
405 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
|
406 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
407 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
|
408 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
|
409 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
410 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
411 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
412 GList *i; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
413 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
414 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
|
415 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
|
416 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
417 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
|
418 pos = audacious_remote_get_playlist_length(session); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
419 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
420 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
|
421 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
422 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
|
423 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
|
424 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
425 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
426 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
|
427 audacious_remote_playlist_add_url_string(session, i->data); |
2313 | 428 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
429 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
|
430 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
|
431 audacious_remote_set_playlist_pos(session, pos); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
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.enqueue) |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
434 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
|
435 } |
2313 | 436 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
437 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
|
438 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
|
439 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
440 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
|
441 } /* filename */ |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
442 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
443 if (options.rew) |
2832 | 444 audacious_remote_playlist_prev(session); |
2313 | 445 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
446 if (options.play) |
2832 | 447 audacious_remote_play(session); |
2313 | 448 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
449 if (options.pause) |
2832 | 450 audacious_remote_pause(session); |
2313 | 451 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
452 if (options.stop) |
2832 | 453 audacious_remote_stop(session); |
2313 | 454 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
455 if (options.fwd) |
2832 | 456 audacious_remote_playlist_next(session); |
2313 | 457 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
458 if (options.play_pause) |
2832 | 459 audacious_remote_play_pause(session); |
2313 | 460 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
461 if (options.show_jump_box) |
2832 | 462 audacious_remote_show_jtf_box(session); |
2313 | 463 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
464 if (options.mainwin) |
2832 | 465 audacious_remote_main_win_toggle(session, TRUE); |
2313 | 466 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
467 if (options.activate) |
2832 | 468 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
|
469 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
470 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
|
471 } /* 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
|
472 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
473 #endif |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
474 { /* !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
|
475 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
|
476 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
477 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
|
478 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
|
479 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
|
480 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
481 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
|
482 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
483 gchar *filename; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
484 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
|
485 |
4355 | 486 if (!strstr(filenames[i], "://")) |
487 { | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
488 if (filenames[i][0] == '/') |
4355 | 489 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
|
490 else |
4355 | 491 filename = g_strdup_printf("file:///%s/%s", current_dir, |
492 filenames[i]); | |
493 } | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
494 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
495 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
|
496 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
497 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
|
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_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
|
500 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
501 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
502 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
|
503 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
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.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
|
506 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
|
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.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
|
509 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
|
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.enqueue) |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
512 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
513 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
|
514 drct_stop(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
515 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
516 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
517 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
|
518 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
519 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
|
520 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
|
521 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
|
522 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
523 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
|
524 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
|
525 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
526 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
527 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
|
528 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
|
529 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
530 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
|
531 } /* filename */ |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
532 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
533 if (options.rew) |
3753 | 534 drct_pl_prev(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
535 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
536 if (options.play) |
3753 | 537 drct_play(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
538 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
539 if (options.pause) |
3753 | 540 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
541 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
542 if (options.stop) |
3753 | 543 drct_stop(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
544 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
545 if (options.fwd) |
3753 | 546 drct_pl_next(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
547 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
548 if (options.play_pause) { |
3753 | 549 if (drct_get_paused()) |
550 drct_play(); | |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
551 else |
3753 | 552 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
553 } |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
554 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
555 if (options.show_jump_box) |
3753 | 556 drct_jtf_show(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
557 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
558 if (options.mainwin) |
3753 | 559 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
|
560 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
561 if (options.activate) |
3753 | 562 drct_activate(); |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
563 } /* !is_running */ |
2313 | 564 } |
565 | |
566 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
567 aud_setup_logger(void) |
2313 | 568 { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
569 if (!aud_logger_start(aud_paths[BMP_PATH_LOG_FILE])) |
2313 | 570 return; |
571 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
572 g_atexit(aud_logger_stop); |
2313 | 573 } |
574 | |
575 static void | |
576 run_load_skin_error_dialog(const gchar * skin_path) | |
577 { | |
578 const gchar *markup = | |
579 N_("<b><big>Unable to load skin.</big></b>\n" | |
580 "\n" | |
581 "Check that skin at '%s' is usable and default skin is properly " | |
582 "installed at '%s'\n"); | |
583 | |
584 GtkWidget *dialog = | |
585 gtk_message_dialog_new_with_markup(NULL, | |
586 GTK_DIALOG_MODAL, | |
587 GTK_MESSAGE_ERROR, | |
588 GTK_BUTTONS_CLOSE, | |
589 _(markup), | |
590 skin_path, | |
591 BMP_DEFAULT_SKIN_PATH); | |
592 gtk_dialog_run(GTK_DIALOG(dialog)); | |
593 gtk_widget_destroy(dialog); | |
594 } | |
595 | |
2369 | 596 static gboolean |
597 aud_headless_iteration(gpointer unused) | |
598 { | |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
599 free_vis_data(); |
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
600 return TRUE; |
2369 | 601 } |
602 | |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
603 static gboolean |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
604 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
|
605 gpointer def) |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
606 { |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
607 const gchar *title; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
608 Playlist *playlist; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
609 Playlist *deflist; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
610 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
611 deflist = (Playlist *)def; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
612 playlist = playlist_new(); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
613 if (!playlist) { |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
614 g_warning("Couldn't create new playlist\n"); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
615 return FALSE; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
616 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
617 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
618 playlist_add_playlist(playlist); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
619 playlist_load(playlist, path); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
620 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
621 title = playlist_get_current_name(playlist); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
622 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
623 return FALSE; /* keep loading other playlists */ |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
624 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
625 |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
626 static void |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
627 resume_playback_on_startup() |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
628 { |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
629 g_return_if_fail(cfg.resume_playback_on_startup); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
630 g_return_if_fail(cfg.resume_playback_on_startup_time != -1); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
631 g_return_if_fail(playlist_get_length(playlist_get_active()) > 0); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
632 |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
633 int i; |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
634 |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
635 while (gtk_events_pending()) gtk_main_iteration(); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
636 |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
637 playback_initiate(); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
638 |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
639 /* 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
|
640 * "frozen" GUI. Feel free to tune. --chainsaw */ |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
641 for (i = 0; i < 20; i++) |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
642 { |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
643 g_usleep(1000); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
644 if (!ip_data.playing) |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
645 break; |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
646 } |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
647 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
|
648 } |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
649 |
4448 | 650 static void |
651 playlist_system_init() | |
652 { | |
653 Playlist *playlist; | |
654 | |
655 playlist_init(); | |
656 playlist = playlist_get_active(); | |
657 playlist_load(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE]); | |
658 playlist_set_position(playlist, cfg.playlist_position); | |
659 | |
660 /* Load extra playlists */ | |
661 if (!dir_foreach(aud_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist, | |
662 playlist, NULL)) | |
663 g_warning("Could not load extra playlists\n"); | |
664 } | |
665 | |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
666 void |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
667 aud_quit(void) |
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 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
|
670 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
671 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
|
672 |
4494
0f43f3a5eb12
Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents:
4492
diff
changeset
|
673 aud_config_save(); |
0f43f3a5eb12
Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents:
4492
diff
changeset
|
674 |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
675 if (options.headless == FALSE) |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
676 { |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
677 gtk_widget_hide(equalizerwin); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
678 gtk_widget_hide(playlistwin); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
679 gtk_widget_hide(mainwin); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
680 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
681 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
|
682 gtk_main_quit(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
683 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
684 cleanup_skins(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
685 } |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
686 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
687 plugin_system_cleanup(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
688 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
689 /* 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
|
690 playlists = playlist_get_playlists(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
691 playlists_top = playlists; |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
692 while ( playlists != NULL ) |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
693 { |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
694 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
|
695 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
|
696 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
|
697 } |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
698 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
|
699 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
700 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
|
701 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
|
702 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
703 exit(EXIT_SUCCESS); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
704 } |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
705 |
2313 | 706 gint |
707 main(gint argc, gchar ** argv) | |
708 { | |
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
709 /* 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
|
710 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
|
711 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
|
712 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
|
713 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
|
714 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
|
715 } |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
716 |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
717 gdk_threads_init(); |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
718 |
2313 | 719 /* Setup l10n early so we can print localized error messages */ |
720 gtk_set_locale(); | |
721 bindtextdomain(PACKAGE_NAME, LOCALEDIR); | |
722 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | |
2388
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
723 bindtextdomain(PACKAGE_NAME "-plugins", LOCALEDIR); |
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
724 bind_textdomain_codeset(PACKAGE_NAME "-plugins", "UTF-8"); |
2313 | 725 textdomain(PACKAGE_NAME); |
726 | |
4492
55262ebeba2d
Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents:
4467
diff
changeset
|
727 #if !defined(_WIN32) && defined(USE_EGGSM) |
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
728 egg_set_desktop_file(AUDACIOUS_DESKTOP_FILE); |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
729 #endif |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
730 aud_init_paths(); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
731 aud_make_user_dir(); |
2313 | 732 |
733 cond_scan = g_cond_new(); | |
734 mutex_scan = g_mutex_new(); | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
735 gtk_rc_add_default_file(aud_paths[BMP_PATH_GTKRC_FILE]); |
2463 | 736 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
737 parse_cmd_line_options(&argc, &argv); |
2313 | 738 |
739 if (options.no_log == FALSE) | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
740 aud_setup_logger(); |
2313 | 741 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
742 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
|
743 /* 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
|
744 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
|
745 session */ |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
746 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
|
747 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
|
748 } |
2313 | 749 |
750 g_random_set_seed(time(NULL)); | |
4234 | 751 SAD_dither_init_rand((gint32)time(NULL)); |
2313 | 752 |
4412
180996fcf12a
bmp_config_* -> aud_config_*
Matti Hamalainen <ccr@tnsp.org>
parents:
4411
diff
changeset
|
753 aud_config_load(); |
2313 | 754 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
755 signal_handlers_init(); |
2856
c4d07471f647
Added a mowgli_init() call
Cristi Magherusan <majeru@gentoo.ro>
parents:
2846
diff
changeset
|
756 mowgli_init(); |
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
|
757 |
4355 | 758 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
|
759 { |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
760 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
|
761 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
762 /* 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
|
763 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
|
764 register_aud_stock_icons(); |
3978
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
765 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
766 /* UIManager |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
767 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
|
768 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
|
769 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
|
770 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
|
771 } |
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
|
772 |
2313 | 773 plugin_system_init(); |
4448 | 774 playlist_system_init(); |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
775 handle_cmd_line_options(); |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
776 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
777 #ifdef USE_DBUS |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
778 init_dbus(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
779 #endif |
2313 | 780 |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
781 playlist_start_get_info_thread(); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
782 |
4448 | 783 output_set_volume((cfg.saved_volume & 0xff00) >> 8, |
784 (cfg.saved_volume & 0x00ff)); | |
785 | |
4355 | 786 if (options.headless == FALSE) |
2313 | 787 { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
788 aud_set_default_icon(); |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
789 #ifdef GDK_WINDOWING_QUARTZ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
790 set_dock_icon(); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
791 #endif |
2313 | 792 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
793 gtk_accel_map_load(aud_paths[BMP_PATH_ACCEL_FILE]); |
2313 | 794 |
795 if (!init_skins(cfg.skin)) { | |
796 run_load_skin_error_dialog(cfg.skin); | |
797 exit(EXIT_FAILURE); | |
798 } | |
799 | |
800 GDK_THREADS_ENTER(); | |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
801 |
4357 | 802 /* this needs to be called after all 3 windows are created and |
803 * input plugins are setup'ed | |
804 * but not if we're running headless --nenolod | |
805 */ | |
806 mainwin_setup_menus(); | |
3678
e82ad057d1db
Get rid of read_volume() craq. Add ui_main_set_initial_volume() to replace the only necessary remaining code.
William Pitcock <nenolod@atheme.org>
parents:
3543
diff
changeset
|
807 ui_main_set_initial_volume(); |
2313 | 808 |
809 /* FIXME: delayed, because it deals directly with the plugin | |
810 * interface to set menu items */ | |
811 create_prefs_window(); | |
812 | |
2364 | 813 create_fileinfo_window(); |
814 | |
2313 | 815 |
816 if (cfg.player_visible) | |
817 mainwin_show(TRUE); | |
818 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
|
819 { |
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
|
820 /* 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
|
821 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
|
822 } |
2313 | 823 |
824 if (cfg.equalizer_visible) | |
825 equalizerwin_show(TRUE); | |
826 | |
827 if (cfg.playlist_visible) | |
828 playlistwin_show(); | |
829 | |
830 hint_set_always(cfg.always_on_top); | |
831 | |
2364 | 832 has_x11_connection = TRUE; |
2313 | 833 |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
834 resume_playback_on_startup(); |
2364 | 835 |
2313 | 836 gtk_main(); |
837 | |
838 GDK_THREADS_LEAVE(); | |
839 } | |
2364 | 840 // if we are running headless |
2313 | 841 else |
842 { | |
4366
1f900d7b737b
print a note when headless operation is enabled
mf0102 <0102@gmx.at>
parents:
4365
diff
changeset
|
843 g_print(_("Headless operation enabled\n")); |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
844 resume_playback_on_startup(); |
2313 | 845 |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
846 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
|
847 g_main_loop_run(g_main_loop_new(NULL, TRUE)); |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
848 } |
2313 | 849 |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
850 aud_quit(); |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
851 return EXIT_SUCCESS; |
2313 | 852 } |