Mercurial > audlegacy
annotate src/audacious/main.c @ 4350:8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
author | mf0102 <0102@gmx.at> |
---|---|
date | Sun, 16 Mar 2008 19:02:57 +0100 |
parents | f493c456c77f |
children | ac1f6d211223 |
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 "effect.h" | |
66 #include "general.h" | |
67 #include "hints.h" | |
68 #include "input.h" | |
69 #include "logger.h" | |
70 #include "output.h" | |
71 #include "playback.h" | |
72 #include "playlist.h" | |
4347 | 73 #include "pluginenum.h" |
74 #include "signals.h" | |
75 #include "skin.h" | |
76 #include "ui_equalizer.h" | |
77 #include "ui_fileinfo.h" | |
78 #include "ui_main.h" | |
79 #include "ui_manager.h" | |
2313 | 80 #include "ui_playlist.h" |
81 #include "ui_preferences.h" | |
4347 | 82 #include "ui_skinned_window.h" |
2313 | 83 #include "ui_skinselector.h" |
84 #include "util.h" | |
85 #include "visualization.h" | |
4347 | 86 |
4234 | 87 #include "libSAD.h" |
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
88 #include "eggsmclient.h" |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
89 #include "eggdesktopfile.h" |
2313 | 90 |
91 #include "icons-stock.h" | |
92 #include "images/audacious_player.xpm" | |
93 | |
2364 | 94 gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ |
2313 | 95 const gchar *application_name = N_("Audacious"); |
96 | |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
97 struct _AudCmdLineOpt { |
2411 | 98 gchar **filenames; |
2313 | 99 gint session; |
3351
7a4fcf84a34f
Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents:
3346
diff
changeset
|
100 gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box; |
2313 | 101 gboolean enqueue, mainwin, remote, activate; |
102 gboolean load_skins; | |
103 gboolean headless; | |
104 gboolean no_log; | |
105 gboolean enqueue_to_temp; | |
2411 | 106 gboolean version; |
2313 | 107 gchar *previous_session_id; |
4200 | 108 gboolean macpack; |
2313 | 109 }; |
110 | |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
111 typedef struct _AudCmdLineOpt AudCmdLineOpt; |
2313 | 112 |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
113 AudCmdLineOpt options; |
2313 | 114 |
115 BmpConfig cfg; | |
116 | |
117 BmpConfig bmp_default_config = { | |
118 MAINWIN_DEFAULT_POS_X, /* mainwin x position */ | |
119 MAINWIN_DEFAULT_POS_Y, /* mainwin y position */ | |
120 EQUALIZER_DEFAULT_POS_X, /* equalizer x position */ | |
121 EQUALIZER_DEFAULT_POS_Y, /* equalizer y position */ | |
122 PLAYLISTWIN_DEFAULT_POS_X, /* playlistwin x position */ | |
123 PLAYLISTWIN_DEFAULT_POS_Y, /* playlistwin y position */ | |
124 PLAYLISTWIN_DEFAULT_WIDTH, /* playlistwin width */ | |
125 PLAYLISTWIN_DEFAULT_HEIGHT, /* playlistwin height */ | |
126 10, /* snap distance */ | |
127 FALSE, /* real-time priority */ | |
128 FALSE, FALSE, /* shuffle, repeat */ | |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
129 FALSE, /* scaling */ |
2313 | 130 TRUE, /* autoscroll */ |
131 TRUE, /* analyzer peaks */ | |
132 FALSE, /* equalizer autoload */ | |
133 FALSE, /* easy move */ | |
134 FALSE, /* equalizer active */ | |
135 FALSE, /* playlistwin visible */ | |
136 FALSE, /* equalizer visible */ | |
137 TRUE, /* player visible */ | |
138 FALSE, /* player shaded */ | |
139 FALSE, /* playlistwin shaded */ | |
140 FALSE, /* equalizer shaded */ | |
141 FALSE, /* allow multiple instances */ | |
142 TRUE, /* always show cb */ | |
143 TRUE, TRUE, TRUE, /* convert '_', %20 and '\' */ | |
144 TRUE, /* show numbers in playlist */ | |
145 TRUE, /* snap windows */ | |
146 TRUE, /* save window positions */ | |
147 TRUE, /* dim titlebar */ | |
148 FALSE, /* get playlist info on load */ | |
149 TRUE, /* get playlist info on demand */ | |
4218
f1074a07ec09
mostly works, but the VIS is broken, and the eq window is too large...more bugs
Cristi Magherusan <majeru@atheme.org>
parents:
4216
diff
changeset
|
150 TRUE, /* equalizer scale linked */ |
2313 | 151 FALSE, /* sort jump to file */ |
152 FALSE, /* use effect plugins */ | |
153 FALSE, /* always on top */ | |
154 FALSE, /* sticky */ | |
155 FALSE, /* no playlist advance */ | |
156 FALSE, /* stop after current song */ | |
157 TRUE, /* refresh file list */ | |
158 TRUE, /* UNUSED (smooth title scrolling) */ | |
159 TRUE, /* use playlist metadata */ | |
2662
09b404d61ebd
[svn] - remove the unplayable files dialog. it is more annoying than useful.
nenolod
parents:
2651
diff
changeset
|
160 TRUE, /* deprecated */ |
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
|
161 TRUE, /* warn about windows visibility */ |
2313 | 162 FALSE, /* use \ as directory delimiter */ |
163 FALSE, /* random skin on play */ | |
164 FALSE, /* use fontsets */ | |
4121
bb35123048fb
oops, this should get commited together with 4204b0a6aeb2
Tomasz Mon <desowin@gmail.com>
parents:
4116
diff
changeset
|
165 TRUE, /* use bitmap font for mainwin */ |
2364 | 166 TRUE, /* use custom cursors */ |
167 TRUE, /* close dialog on open */ | |
168 TRUE, /* close dialog on add */ | |
2313 | 169 0.0, /* equalizer preamp */ |
3229
5e12e740c66c
default value for "enabled discovery plugins" was missing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3216
diff
changeset
|
170 {0.0, 0.0, 0.0, 0.0, 0.0, /* equalizer bands */ |
5e12e740c66c
default value for "enabled discovery plugins" was missing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3216
diff
changeset
|
171 0.0, 0.0, 0.0, 0.0, 0.0}, |
4223
2c9c2b5caaee
changed the hardcoded scale to 1.2 and set some dither and interpolation
Cristi Magherusan <majeru@atheme.org>
parents:
4218
diff
changeset
|
172 1.2, /* GUI scale factor, hardcoded for testing purposes --majeru */ |
2313 | 173 NULL, /* skin */ |
174 NULL, /* output plugin */ | |
175 NULL, /* file selector path */ | |
176 NULL, /* playlist path */ | |
177 NULL, /* playlist font */ | |
178 NULL, /* mainwin font */ | |
179 NULL, /* disabled input plugins */ | |
180 NULL, /* enabled general plugins */ | |
181 NULL, /* enabled visualization plugins */ | |
182 NULL, /* enabled effect plugins */ | |
3229
5e12e740c66c
default value for "enabled discovery plugins" was missing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3216
diff
changeset
|
183 NULL, /* enabled discovery plugins */ |
2313 | 184 NULL, /* equalizer preset default file */ |
185 NULL, /* equalizer preset extension */ | |
186 NULL, /* URL history */ | |
187 0, /* timer mode */ | |
188 VIS_ANALYZER, /* visualizer type */ | |
189 ANALYZER_NORMAL, /* analyzer mode */ | |
190 ANALYZER_BARS, /* analyzer type */ | |
191 SCOPE_DOT, /* scope mode */ | |
192 VOICEPRINT_NORMAL, /* voiceprint mode */ | |
193 VU_SMOOTH, /* VU mode */ | |
194 REFRESH_FULL, /* visualizer refresh rate */ | |
195 FALLOFF_FAST, /* analyzer fall off rate */ | |
196 FALLOFF_SLOW, /* peaks fall off rate */ | |
197 0, /* playlist position */ | |
198 2, /* pause between songs time */ | |
199 FALSE, /* pause between songs */ | |
200 FALSE, /* show window decorations */ | |
201 8, /* mouse wheel scroll step */ | |
202 FALSE, /* playlist transparent */ | |
203 2, /* 3rd preset (ARTIST - ALBUM - TITLE) */ | |
204 NULL, /* title format */ | |
205 FALSE, /* software volume control enabled */ | |
206 TRUE, /* UNUSED (XMMS compatibility mode) */ | |
207 TRUE, /* extra eq filtering */ | |
208 3, /* scroll pl by */ | |
209 FALSE, /* resume playback on startup */ | |
210 -1, /* resume playback on startup time */ | |
2364 | 211 TRUE, /* show seperators in pl */ |
3229
5e12e740c66c
default value for "enabled discovery plugins" was missing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3216
diff
changeset
|
212 NULL, /* chardet_detector */ |
5e12e740c66c
default value for "enabled discovery plugins" was missing.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3216
diff
changeset
|
213 NULL, /* chardet_fallback */ |
3959
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3883
diff
changeset
|
214 500, /* audio buffer size */ |
a575c29cee05
- revive on-demand metadata retrieving. in the combination with "Detect file formats on demand", now audacious can load large directory in a few seconds.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3883
diff
changeset
|
215 TRUE, /* whether or not to postpone format detection on initial add */ |
2364 | 216 TRUE, /* show filepopup for tuple */ |
217 NULL, /* words identifying covers */ | |
218 NULL, /* words that might not show up in cover names */ | |
2313 | 219 FALSE, |
220 0, | |
2364 | 221 NULL, /* default session uri base (non-NULL = custom session uri base) */ |
222 150, /* short side length of the picture in the filepopup */ | |
223 20, /* delay until the filepopup comes up */ | |
224 FALSE, /* use filename.jpg for coverart */ | |
225 FALSE, /* use XMMS-style file selection */ | |
226 TRUE, /* use extension probing */ | |
227 255, 255, 255, /* colorize r, g, b */ | |
228 FALSE, /* internal: whether or not to terminate */ | |
2405 | 229 TRUE, /* whether show progress bar in filepopup or not */ |
2806 | 230 TRUE, /* close jtf dialog on jump */ |
3543
6b8c8e051c1b
Add new configuration option: Software Volume Control.
William Pitcock <nenolod@atheme.org>
parents:
3530
diff
changeset
|
231 TRUE, /* use back and forth scroll */ |
6b8c8e051c1b
Add new configuration option: Software Volume Control.
William Pitcock <nenolod@atheme.org>
parents:
3530
diff
changeset
|
232 FALSE, /* use software volume control */ |
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
|
233 .warn_about_broken_gtk_engines = TRUE, /* warn about broken gtk themes */ |
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
|
234 FALSE, /* disable inline themes */ |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4112
diff
changeset
|
235 TRUE, /* remember jtf text entry */ |
4232
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4224
diff
changeset
|
236 16, /* output bit depth */ |
4236
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
237 TRUE, /* enable replay gain */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
238 TRUE, /* enable clipping prevention */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
239 TRUE, /* track mode */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
240 FALSE, /* album mode */ |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4236
diff
changeset
|
241 FALSE, /* enable adaptive scaler */ |
4236
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
242 0.0, /* preamp */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
243 -9.0, /* default gain */ |
4267
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
244 #ifdef USE_SRC |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
245 FALSE, /* enable resampling */ |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
246 48000, /* samplerate */ |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
247 SRC_SINC_BEST_QUALITY, /* default interpolation method */ |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
248 #endif |
4286
af324ff0a983
added passthrough mode. tested with ape and flac
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4267
diff
changeset
|
249 FALSE, /* bypass dsp */ |
2313 | 250 }; |
251 | |
252 typedef struct bmp_cfg_boolent_t { | |
253 char const *be_vname; | |
254 gboolean *be_vloc; | |
255 gboolean be_wrt; | |
256 } bmp_cfg_boolent; | |
257 | |
258 typedef struct bmp_cfg_nument_t { | |
259 char const *ie_vname; | |
260 gint *ie_vloc; | |
261 gboolean ie_wrt; | |
262 } bmp_cfg_nument; | |
263 | |
264 typedef struct bmp_cfg_strent_t { | |
265 char const *se_vname; | |
266 char **se_vloc; | |
267 gboolean se_wrt; | |
268 } bmp_cfg_strent; | |
269 | |
270 const gchar *bmp_titlestring_presets[] = { | |
3296
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
271 "${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
272 "${?artist:${artist} - }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
273 "${?artist:${artist} - }${?album:${album} - }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
274 "${?artist:${artist} - }${?album:${album} - }${?track-number:${track-number}. }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
275 "${?artist:${artist} }${?album:[ ${album} ] }${?artist:- }${?track-number:${track-number}. }${title}", |
c1f506c2b1d0
new format strings
William Pitcock <nenolod@atheme-project.org>
parents:
3251
diff
changeset
|
276 "${?album:${album} - }${title}" |
2313 | 277 }; |
278 | |
279 const guint n_titlestring_presets = G_N_ELEMENTS(bmp_titlestring_presets); | |
280 | |
281 const gchar *chardet_detector_presets[] = { | |
4043
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
282 N_("None"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
283 N_("Japanese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
284 N_("Taiwanese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
285 N_("Chinese"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
286 N_("Korean"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
287 N_("Russian"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
288 N_("Greek"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
289 N_("Hebrew"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
290 N_("Turkish"), |
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
291 N_("Arabic"), |
2313 | 292 #ifdef HAVE_UDET |
4043
c86f63f652aa
made character set detection combo box translatable
mf0102 <0102@gmx.at>
parents:
4026
diff
changeset
|
293 N_("Universal") |
2313 | 294 #endif |
295 }; | |
296 | |
2364 | 297 const guint n_chardet_detector_presets = G_N_ELEMENTS(chardet_detector_presets); |
2313 | 298 |
299 static bmp_cfg_boolent bmp_boolents[] = { | |
300 {"allow_multiple_instances", &cfg.allow_multiple_instances, TRUE}, | |
301 {"use_realtime", &cfg.use_realtime, TRUE}, | |
302 {"always_show_cb", &cfg.always_show_cb, TRUE}, | |
303 {"convert_underscore", &cfg.convert_underscore, TRUE}, | |
304 {"convert_twenty", &cfg.convert_twenty, TRUE}, | |
305 {"convert_slash", &cfg.convert_slash, TRUE }, | |
306 {"show_numbers_in_pl", &cfg.show_numbers_in_pl, TRUE}, | |
307 {"show_separator_in_pl", &cfg.show_separator_in_pl, TRUE}, | |
308 {"snap_windows", &cfg.snap_windows, TRUE}, | |
309 {"save_window_positions", &cfg.save_window_position, TRUE}, | |
310 {"dim_titlebar", &cfg.dim_titlebar, TRUE}, | |
311 {"get_info_on_load", &cfg.get_info_on_load, TRUE}, | |
312 {"get_info_on_demand", &cfg.get_info_on_demand, TRUE}, | |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4200
diff
changeset
|
313 {"eq_scaled_linked", &cfg.eq_scaled_linked, TRUE}, |
2313 | 314 {"no_playlist_advance", &cfg.no_playlist_advance, TRUE}, |
315 {"refresh_file_list", &cfg.refresh_file_list, TRUE}, | |
316 {"sort_jump_to_file", &cfg.sort_jump_to_file, TRUE}, | |
317 {"use_pl_metadata", &cfg.use_pl_metadata, TRUE}, | |
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
|
318 {"warn_about_win_visibility", &cfg.warn_about_win_visibility, TRUE}, |
2313 | 319 {"use_backslash_as_dir_delimiter", &cfg.use_backslash_as_dir_delimiter, TRUE}, |
320 {"player_shaded", &cfg.player_shaded, TRUE}, | |
321 {"player_visible", &cfg.player_visible, TRUE}, | |
322 {"shuffle", &cfg.shuffle, TRUE}, | |
323 {"repeat", &cfg.repeat, TRUE}, | |
4216
75d99359357b
doublesize -> custom scale:
Cristi Magherusan <majeru@atheme.org>
parents:
4200
diff
changeset
|
324 {"scaled", &cfg.scaled, TRUE}, /* toggles custom scale */ |
2313 | 325 {"autoscroll_songname", &cfg.autoscroll, TRUE}, |
326 {"stop_after_current_song", &cfg.stopaftersong, TRUE}, | |
327 {"playlist_shaded", &cfg.playlist_shaded, TRUE}, | |
328 {"playlist_visible", &cfg.playlist_visible, TRUE}, | |
329 {"use_fontsets", &cfg.use_fontsets, TRUE}, | |
4121
bb35123048fb
oops, this should get commited together with 4204b0a6aeb2
Tomasz Mon <desowin@gmail.com>
parents:
4116
diff
changeset
|
330 {"mainwin_use_bitmapfont", &cfg.mainwin_use_bitmapfont, TRUE}, |
2313 | 331 {"equalizer_visible", &cfg.equalizer_visible, TRUE}, |
332 {"equalizer_active", &cfg.equalizer_active, TRUE}, | |
333 {"equalizer_shaded", &cfg.equalizer_shaded, TRUE}, | |
334 {"equalizer_autoload", &cfg.equalizer_autoload, TRUE}, | |
335 {"easy_move", &cfg.easy_move, TRUE}, | |
336 {"use_eplugins", &cfg.use_eplugins, TRUE}, | |
337 {"always_on_top", &cfg.always_on_top, TRUE}, | |
338 {"sticky", &cfg.sticky, TRUE}, | |
339 {"random_skin_on_play", &cfg.random_skin_on_play, TRUE}, | |
340 {"pause_between_songs", &cfg.pause_between_songs, TRUE}, | |
341 {"show_wm_decorations", &cfg.show_wm_decorations, TRUE}, | |
342 {"eq_extra_filtering", &cfg.eq_extra_filtering, TRUE}, | |
343 {"analyzer_peaks", &cfg.analyzer_peaks, TRUE}, | |
344 {"custom_cursors", &cfg.custom_cursors, TRUE}, | |
345 {"close_dialog_open", &cfg.close_dialog_open, TRUE}, | |
346 {"close_dialog_add", &cfg.close_dialog_add, TRUE}, | |
347 {"resume_playback_on_startup", &cfg.resume_playback_on_startup, TRUE}, | |
348 {"playlist_detect", &cfg.playlist_detect, TRUE}, | |
349 {"show_filepopup_for_tuple", &cfg.show_filepopup_for_tuple, TRUE}, | |
350 {"recurse_for_cover", &cfg.recurse_for_cover, TRUE}, | |
351 {"use_file_cover", &cfg.use_file_cover, TRUE}, | |
352 {"use_xmms_style_fileselector", &cfg.use_xmms_style_fileselector, TRUE}, | |
353 {"use_extension_probing", &cfg.use_extension_probing, TRUE}, | |
2405 | 354 {"filepopup_showprogressbar", &cfg.filepopup_showprogressbar, TRUE}, |
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2788
diff
changeset
|
355 {"close_jtf_dialog", &cfg.close_jtf_dialog, TRUE}, |
2968
83f03505f819
add support for one-way text scroll.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2938
diff
changeset
|
356 {"twoway_scroll", &cfg.twoway_scroll, TRUE}, |
3543
6b8c8e051c1b
Add new configuration option: Software Volume Control.
William Pitcock <nenolod@atheme.org>
parents:
3530
diff
changeset
|
357 {"software_volume_control", &cfg.software_volume_control, TRUE}, |
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
|
358 {"warn_about_broken_gtk_engines", &cfg.warn_about_broken_gtk_engines, TRUE}, |
4088
2b1bba93f726
add option to disable inline gtk theme
Tomasz Mon <desowin@gmail.com>
parents:
4080
diff
changeset
|
359 {"disable_inline_gtk", &cfg.disable_inline_gtk, TRUE}, |
4116
5853d43e539a
remember filter entry in jtf dialog is extremely useful when jtf deals with large playlist. now this feature is configurable.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
4112
diff
changeset
|
360 {"remember_jtf_entry", &cfg.remember_jtf_entry, TRUE}, |
4236
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
361 {"enable_replay_gain", &cfg.enable_replay_gain, TRUE}, |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
362 {"enable_clipping_prevention", &cfg.enable_clipping_prevention, TRUE}, |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
363 {"replay_gain_track", &cfg.replay_gain_track, TRUE}, |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
364 {"replay_gain_album", &cfg.replay_gain_album, TRUE}, |
4256
b0ca963fd965
adaptive scaler added, disabled hard limiter
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4236
diff
changeset
|
365 {"enable_adaptive_scaler", &cfg.enable_adaptive_scaler, TRUE}, |
4267
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
366 #ifdef USE_SRC |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
367 {"enable_src", &cfg.enable_src, TRUE}, |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
368 #endif |
4286
af324ff0a983
added passthrough mode. tested with ape and flac
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4267
diff
changeset
|
369 {"bypass_dsp", &cfg.bypass_dsp, TRUE}, |
2313 | 370 }; |
371 | |
372 static gint ncfgbent = G_N_ELEMENTS(bmp_boolents); | |
373 | |
374 static bmp_cfg_nument bmp_numents[] = { | |
375 {"player_x", &cfg.player_x, TRUE}, | |
376 {"player_y", &cfg.player_y, TRUE}, | |
377 {"timer_mode", &cfg.timer_mode, TRUE}, | |
378 {"vis_type", &cfg.vis_type, TRUE}, | |
379 {"analyzer_mode", &cfg.analyzer_mode, TRUE}, | |
380 {"analyzer_type", &cfg.analyzer_type, TRUE}, | |
381 {"scope_mode", &cfg.scope_mode, TRUE}, | |
382 {"vu_mode", &cfg.vu_mode, TRUE}, | |
383 {"voiceprint_mode", &cfg.voiceprint_mode, TRUE}, | |
384 {"vis_refresh_rate", &cfg.vis_refresh, TRUE}, | |
385 {"analyzer_falloff", &cfg.analyzer_falloff, TRUE}, | |
386 {"peaks_falloff", &cfg.peaks_falloff, TRUE}, | |
387 {"playlist_x", &cfg.playlist_x, TRUE}, | |
388 {"playlist_y", &cfg.playlist_y, TRUE}, | |
389 {"playlist_width", &cfg.playlist_width, TRUE}, | |
390 {"playlist_height", &cfg.playlist_height, TRUE}, | |
391 {"playlist_position", &cfg.playlist_position, TRUE}, | |
392 {"equalizer_x", &cfg.equalizer_x, TRUE}, | |
393 {"equalizer_y", &cfg.equalizer_y, TRUE}, | |
394 {"snap_distance", &cfg.snap_distance, TRUE}, | |
395 {"pause_between_songs_time", &cfg.pause_between_songs_time, TRUE}, | |
396 {"mouse_wheel_change", &cfg.mouse_change, TRUE}, | |
397 {"scroll_pl_by", &cfg.scroll_pl_by, TRUE}, | |
398 {"titlestring_preset", &cfg.titlestring_preset, TRUE}, | |
399 {"resume_playback_on_startup_time", &cfg.resume_playback_on_startup_time, TRUE}, | |
400 {"output_buffer_size", &cfg.output_buffer_size, TRUE}, | |
401 {"recurse_for_cover_depth", &cfg.recurse_for_cover_depth, TRUE}, | |
402 {"filepopup_pixelsize", &cfg.filepopup_pixelsize, TRUE}, | |
403 {"filepopup_delay", &cfg.filepopup_delay, TRUE}, | |
404 {"colorize_r", &cfg.colorize_r, TRUE}, | |
405 {"colorize_g", &cfg.colorize_g, TRUE}, | |
406 {"colorize_b", &cfg.colorize_b, TRUE}, | |
4232
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4224
diff
changeset
|
407 {"output_bit_depth", &cfg.output_bit_depth, TRUE}, |
4267
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
408 #ifdef USE_SRC |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
409 {"src_rate", &cfg.src_rate, TRUE}, |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
410 {"src_type", &cfg.src_type, TRUE}, |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
411 #endif |
2313 | 412 }; |
413 | |
414 static gint ncfgient = G_N_ELEMENTS(bmp_numents); | |
415 | |
416 static bmp_cfg_strent bmp_strents[] = { | |
417 {"playlist_font", &cfg.playlist_font, TRUE}, | |
418 {"mainwin_font", &cfg.mainwin_font, TRUE}, | |
419 {"eqpreset_default_file", &cfg.eqpreset_default_file, TRUE}, | |
420 {"eqpreset_extension", &cfg.eqpreset_extension, TRUE}, | |
421 {"skin", &cfg.skin, FALSE}, | |
422 {"output_plugin", &cfg.outputplugin, FALSE}, | |
423 {"disabled_iplugins", &cfg.disabled_iplugins, TRUE}, | |
424 {"enabled_gplugins", &cfg.enabled_gplugins, FALSE}, | |
425 {"enabled_vplugins", &cfg.enabled_vplugins, FALSE}, | |
426 {"enabled_eplugins", &cfg.enabled_eplugins, FALSE}, | |
427 {"filesel_path", &cfg.filesel_path, FALSE}, | |
428 {"playlist_path", &cfg.playlist_path, FALSE}, | |
429 {"generic_title_format", &cfg.gentitle_format, TRUE}, | |
430 {"chardet_detector", &cfg.chardet_detector, TRUE}, | |
431 {"chardet_fallback", &cfg.chardet_fallback, TRUE}, | |
432 {"cover_name_include", &cfg.cover_name_include, TRUE}, | |
433 {"cover_name_exclude", &cfg.cover_name_exclude, TRUE}, | |
434 {"session_uri_base", &cfg.session_uri_base, TRUE} | |
435 }; | |
436 | |
437 static gint ncfgsent = G_N_ELEMENTS(bmp_strents); | |
438 | |
439 gchar *bmp_paths[BMP_PATH_COUNT] = {}; | |
440 | |
441 GList *dock_window_list = NULL; | |
442 | |
443 /* XXX: case-sensitivity is bad for lazy nenolods. :( -nenolod */ | |
444 static gchar *pl_candidates[] = { | |
2364 | 445 PLUGIN_FILENAME("ALSA"), |
446 PLUGIN_FILENAME("coreaudio"), | |
447 PLUGIN_FILENAME("OSS"), | |
448 PLUGIN_FILENAME("sun"), | |
449 PLUGIN_FILENAME("ESD"), | |
450 PLUGIN_FILENAME("pulse_audio"), | |
451 PLUGIN_FILENAME("disk_writer"), | |
452 NULL | |
2313 | 453 }; |
454 | |
455 GCond *cond_scan; | |
456 GMutex *mutex_scan; | |
3346
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
457 #ifdef USE_DBUS |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
458 MprisPlayer *mpris; |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
459 #endif |
2313 | 460 |
461 static GSList * | |
462 get_feature_list(void) | |
463 { | |
464 GSList *features = NULL; | |
465 | |
466 #ifdef HAVE_GCONF | |
467 features = g_slist_append(features, "GConf"); | |
468 #endif | |
469 | |
470 return features; | |
471 } | |
472 | |
473 static void | |
474 dump_version(void) | |
475 { | |
476 GSList *features; | |
477 | |
478 g_printf("%s %s [%s]", _(application_name), VERSION, svn_stamp); | |
479 | |
480 features = get_feature_list(); | |
481 | |
482 if (features) { | |
483 GSList *item; | |
484 | |
485 g_printf(" ("); | |
486 | |
487 for (item = features; g_slist_next(item); item = g_slist_next(item)) | |
488 g_printf("%s, ", (const gchar *) item->data); | |
489 | |
490 g_printf("%s)", (const gchar *) item->data); | |
491 | |
492 g_slist_free(features); | |
493 } | |
494 | |
495 g_printf("\n"); | |
496 } | |
497 | |
498 const gchar * | |
3334
ea806daf3ef0
rename xmms_get_gentitle_format() to get_gentitle_format().
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3317
diff
changeset
|
499 get_gentitle_format(void) |
2313 | 500 { |
501 guint titlestring_preset = cfg.titlestring_preset; | |
502 | |
503 if (titlestring_preset < n_titlestring_presets) | |
2364 | 504 return bmp_titlestring_presets[titlestring_preset]; |
2313 | 505 |
506 return cfg.gentitle_format; | |
507 } | |
508 | |
509 void | |
510 make_directory(const gchar * path, mode_t mode) | |
511 { | |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
512 if (g_mkdir_with_parents(path, mode) == 0) |
2313 | 513 return; |
514 | |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
515 g_printerr(_("Could not create directory (%s): %s\n"), path, |
2313 | 516 g_strerror(errno)); |
517 } | |
518 | |
519 static void | |
520 bmp_make_user_dir(void) | |
521 { | |
522 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
523 | |
524 make_directory(bmp_paths[BMP_PATH_USER_DIR], mode755); | |
525 make_directory(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], mode755); | |
526 make_directory(bmp_paths[BMP_PATH_USER_SKIN_DIR], mode755); | |
527 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
3400
8764498b75ed
Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3351
diff
changeset
|
528 make_directory(bmp_paths[BMP_PATH_PLAYLISTS_DIR], mode755); |
2313 | 529 } |
530 | |
531 static void | |
532 bmp_free_paths(void) | |
533 { | |
534 int i; | |
535 | |
536 for (i = 0; i < BMP_PATH_COUNT; i++) | |
537 { | |
538 g_free(bmp_paths[i]); | |
539 bmp_paths[i] = 0; | |
540 } | |
541 } | |
542 | |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
543 static void |
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
544 bmp_init_paths() |
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
545 { |
2364 | 546 char *xdg_config_home; |
547 char *xdg_data_home; | |
548 char *xdg_cache_home; | |
2313 | 549 |
2364 | 550 xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL |
551 ? g_build_filename(g_get_home_dir(), ".config", NULL) | |
552 : g_strdup(getenv("XDG_CONFIG_HOME"))); | |
553 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL | |
554 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) | |
555 : g_strdup(getenv("XDG_DATA_HOME"))); | |
556 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL | |
557 ? g_build_filename(g_get_home_dir(), ".cache", NULL) | |
558 : g_strdup(getenv("XDG_CACHE_HOME"))); | |
2313 | 559 |
2364 | 560 bmp_paths[BMP_PATH_USER_DIR] = |
561 g_build_filename(xdg_config_home, "audacious", NULL); | |
562 bmp_paths[BMP_PATH_USER_SKIN_DIR] = | |
563 g_build_filename(xdg_data_home, "audacious", "Skins", NULL); | |
564 bmp_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
|
565 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
|
566 |
2364 | 567 bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = |
568 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); | |
2313 | 569 |
3400
8764498b75ed
Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3351
diff
changeset
|
570 bmp_paths[BMP_PATH_PLAYLISTS_DIR] = |
8764498b75ed
Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3351
diff
changeset
|
571 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "playlists", NULL); |
8764498b75ed
Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3351
diff
changeset
|
572 |
2364 | 573 bmp_paths[BMP_PATH_CONFIG_FILE] = |
574 g_build_filename(bmp_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
|
575 #ifdef HAVE_XSPF_PLAYLIST |
2364 | 576 bmp_paths[BMP_PATH_PLAYLIST_FILE] = |
577 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], | |
578 "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
|
579 #else |
2364 | 580 bmp_paths[BMP_PATH_PLAYLIST_FILE] = |
581 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], | |
582 "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
|
583 #endif |
2364 | 584 bmp_paths[BMP_PATH_ACCEL_FILE] = |
585 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "accels", NULL); | |
586 bmp_paths[BMP_PATH_LOG_FILE] = | |
587 g_build_filename(bmp_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
|
588 |
2463 | 589 bmp_paths[BMP_PATH_GTKRC_FILE] = |
2570 | 590 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "gtkrc", NULL); |
2463 | 591 |
2364 | 592 g_free(xdg_config_home); |
593 g_free(xdg_data_home); | |
594 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
|
595 |
2364 | 596 g_atexit(bmp_free_paths); |
2313 | 597 } |
598 | |
599 void | |
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
600 bmp_config_free(void) |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
601 { |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
602 gint i; |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
603 for (i = 0; i < ncfgsent; ++i) { |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
604 if ( *(bmp_strents[i].se_vloc) != NULL ) |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
605 { |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
606 g_free( *(bmp_strents[i].se_vloc) ); |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
607 *(bmp_strents[i].se_vloc) = NULL; |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
608 } |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
609 } |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
610 } |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
611 |
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
612 void |
2313 | 613 bmp_config_load(void) |
614 { | |
615 ConfigDb *db; | |
616 gint i, length; | |
617 | |
618 memcpy(&cfg, &bmp_default_config, sizeof(BmpConfig)); | |
619 | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
620 db = cfg_db_open(); |
2313 | 621 for (i = 0; i < ncfgbent; ++i) { |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
622 cfg_db_get_bool(db, NULL, |
2313 | 623 bmp_boolents[i].be_vname, |
624 bmp_boolents[i].be_vloc); | |
625 } | |
626 | |
627 for (i = 0; i < ncfgient; ++i) { | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
628 cfg_db_get_int(db, NULL, |
2313 | 629 bmp_numents[i].ie_vname, |
630 bmp_numents[i].ie_vloc); | |
631 } | |
632 | |
633 for (i = 0; i < ncfgsent; ++i) { | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
634 cfg_db_get_string(db, NULL, |
2313 | 635 bmp_strents[i].se_vname, |
636 bmp_strents[i].se_vloc); | |
637 } | |
638 | |
639 /* Preset */ | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
640 cfg_db_get_float(db, NULL, "equalizer_preamp", &cfg.equalizer_preamp); |
2313 | 641 for (i = 0; i < 10; i++) { |
642 gchar eqtext[18]; | |
643 | |
644 g_snprintf(eqtext, sizeof(eqtext), "equalizer_band%d", i); | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
645 cfg_db_get_float(db, NULL, eqtext, &cfg.equalizer_bands[i]); |
2313 | 646 } |
647 | |
4224
9b8d6438e00f
load/save the scale value
Cristi Magherusan <majeru@atheme.org>
parents:
4223
diff
changeset
|
648 /* custom scale factor */ |
9b8d6438e00f
load/save the scale value
Cristi Magherusan <majeru@atheme.org>
parents:
4223
diff
changeset
|
649 cfg_db_get_float(db, NULL, "scale_factor", &cfg.scale_factor); |
9b8d6438e00f
load/save the scale value
Cristi Magherusan <majeru@atheme.org>
parents:
4223
diff
changeset
|
650 |
2313 | 651 /* History */ |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
652 if (cfg_db_get_int(db, NULL, "url_history_length", &length)) { |
2313 | 653 for (i = 1; i <= length; i++) { |
654 gchar str[19], *tmp; | |
655 | |
656 g_snprintf(str, sizeof(str), "url_history%d", i); | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
657 if (cfg_db_get_string(db, NULL, str, &tmp)) |
2313 | 658 cfg.url_history = g_list_append(cfg.url_history, tmp); |
659 } | |
660 } | |
661 | |
4236
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
662 /* RG settings */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
663 cfg_db_get_float(db, NULL, "replay_gain_preamp", &cfg.replay_gain_preamp); |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
664 cfg_db_get_float(db, NULL, "default_gain", &cfg.default_gain); |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
665 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
666 cfg_db_close(db); |
2313 | 667 |
668 | |
669 if (cfg.playlist_font && strlen(cfg.playlist_font) == 0) { | |
670 g_free(cfg.playlist_font); | |
671 cfg.playlist_font = NULL; | |
672 } | |
673 | |
674 if (cfg.mainwin_font && strlen(cfg.mainwin_font) == 0) { | |
675 g_free(cfg.mainwin_font); | |
676 cfg.mainwin_font = NULL; | |
677 } | |
678 | |
679 if (!cfg.playlist_font) | |
680 cfg.playlist_font = g_strdup(PLAYLISTWIN_DEFAULT_FONT); | |
681 | |
682 if (!cfg.mainwin_font) | |
683 cfg.mainwin_font = g_strdup(MAINWIN_DEFAULT_FONT); | |
684 | |
685 if (!cfg.gentitle_format) | |
3317 | 686 cfg.gentitle_format = g_strdup("${?artist:${artist} - }${?album:${album} - }${title}"); |
2313 | 687 |
688 if (!cfg.outputplugin) { | |
2364 | 689 gint iter; |
2313 | 690 gchar *pl_path = g_build_filename(PLUGIN_DIR, plugin_dir_list[0], NULL); |
691 | |
692 for (iter = 0; pl_candidates[iter] != NULL && cfg.outputplugin == NULL; iter++) | |
2364 | 693 { |
694 cfg.outputplugin = find_file_recursively(pl_path, pl_candidates[iter]); | |
695 } | |
2313 | 696 |
697 g_free(pl_path); | |
698 } | |
699 | |
700 if (!cfg.eqpreset_default_file) | |
701 cfg.eqpreset_default_file = g_strdup(EQUALIZER_DEFAULT_DIR_PRESET); | |
702 | |
703 if (!cfg.eqpreset_extension) | |
704 cfg.eqpreset_extension = g_strdup(EQUALIZER_DEFAULT_PRESET_EXT); | |
705 | |
706 if (!cfg.chardet_detector) | |
707 cfg.chardet_detector = g_strdup(""); | |
708 | |
709 if (!cfg.chardet_fallback) | |
710 cfg.chardet_fallback = g_strdup(""); | |
711 | |
712 if (!cfg.cover_name_include) | |
2364 | 713 cfg.cover_name_include = g_strdup(""); |
2313 | 714 |
715 if (!cfg.cover_name_exclude) | |
2364 | 716 cfg.cover_name_exclude = g_strdup("back"); |
2313 | 717 |
718 if (!cfg.session_uri_base) | |
719 cfg.session_uri_base = g_strdup(""); | |
720 | |
721 /* at least one of these should be true */ | |
722 if ((!cfg.get_info_on_demand) && (!cfg.get_info_on_load)) | |
723 cfg.get_info_on_demand = TRUE; | |
4104
7b01df6730eb
cfg.playlist_width and cfg.playlist_height can't be smaller than minimum values for those; fixes #11
Tomasz Mon <desowin@gmail.com>
parents:
4088
diff
changeset
|
724 |
7b01df6730eb
cfg.playlist_width and cfg.playlist_height can't be smaller than minimum values for those; fixes #11
Tomasz Mon <desowin@gmail.com>
parents:
4088
diff
changeset
|
725 /* playlist width and height can't be smaller than minimum */ |
7b01df6730eb
cfg.playlist_width and cfg.playlist_height can't be smaller than minimum values for those; fixes #11
Tomasz Mon <desowin@gmail.com>
parents:
4088
diff
changeset
|
726 cfg.playlist_width = MAX(cfg.playlist_width, PLAYLISTWIN_MIN_WIDTH); |
7b01df6730eb
cfg.playlist_width and cfg.playlist_height can't be smaller than minimum values for those; fixes #11
Tomasz Mon <desowin@gmail.com>
parents:
4088
diff
changeset
|
727 cfg.playlist_height = MAX(cfg.playlist_height, PLAYLISTWIN_MIN_HEIGHT); |
2313 | 728 } |
729 | |
3481
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
730 static gboolean |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
731 save_extra_playlist(const gchar * path, const gchar * basename, |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
732 gpointer savedlist) |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
733 { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
734 GList *playlists, *iter; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
735 GList **saved; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
736 Playlist *playlist; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
737 int found; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
738 gchar *filename; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
739 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
740 playlists = playlist_get_playlists(); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
741 saved = (GList **) savedlist; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
742 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
743 found = 0; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
744 for (iter = playlists; iter; iter = iter->next) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
745 playlist = (Playlist *) iter->data; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
746 if (g_list_find(*saved, playlist)) continue; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
747 filename = playlist_filename_get(playlist); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
748 if (!filename) continue; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
749 if (strcmp(filename, path) == 0) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
750 /* Save playlist */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
751 playlist_save(playlist, path); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
752 *saved = g_list_prepend(*saved, playlist); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
753 found = 1; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
754 g_free(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
755 break; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
756 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
757 g_free(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
758 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
759 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
760 if(!found) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
761 /* Remove playlist */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
762 unlink(path); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
763 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
764 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
765 return FALSE; /* process other playlists */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
766 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
767 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
768 static void |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
769 save_other_playlists(GList *saved) |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
770 { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
771 GList *playlists, *iter; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
772 Playlist *playlist; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
773 gchar *pos, *ext, *basename, *filename, *newbasename; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
774 int i, num, isdigits; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
775 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
776 playlists = playlist_get_playlists(); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
777 for(iter = playlists; iter; iter = iter->next) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
778 playlist = (Playlist *) iter->data; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
779 if (g_list_find(saved, playlist)) continue; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
780 filename = playlist_filename_get(playlist); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
781 if (!filename || !filename[0] |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
782 || g_file_test(filename, G_FILE_TEST_IS_DIR)) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
783 /* default basename */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
784 #ifdef HAVE_XSPF_PLAYLIST |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
785 basename = g_strdup("playlist_01.xspf"); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
786 #else |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
787 basename = g_strdup("playlist_01.m3u"); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
788 #endif |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
789 } else { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
790 basename = g_path_get_basename(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
791 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
792 g_free(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
793 if ((pos = strrchr(basename, '.'))) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
794 *pos = '\0'; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
795 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
796 #ifdef HAVE_XSPF_PLAYLIST |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
797 ext = ".xspf"; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
798 #else |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
799 ext = ".m3u"; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
800 #endif |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
801 num = -1; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
802 if ((pos = strrchr(basename, '_'))) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
803 isdigits = 0; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
804 for (i=1; pos[i]; i++) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
805 if (!g_ascii_isdigit(pos[i])) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
806 isdigits = 0; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
807 break; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
808 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
809 isdigits = 1; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
810 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
811 if (isdigits) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
812 num = atoi(pos+1) + 1; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
813 *pos = '\0'; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
814 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
815 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
816 /* attempt to generate unique filename */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
817 filename = NULL; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
818 do { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
819 g_free(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
820 if (num < 0) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
821 /* try saving without number first */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
822 newbasename = g_strdup_printf("%s%s", basename, ext); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
823 num = 1; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
824 } else { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
825 newbasename = g_strdup_printf("%s_%02d%s", basename, num, ext); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
826 num++; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
827 if (num < 0) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
828 g_warning("Playlist number in filename overflowed." |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
829 " Not saving playlist.\n"); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
830 goto cleanup; |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
831 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
832 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
833 filename = g_build_filename(bmp_paths[BMP_PATH_PLAYLISTS_DIR], |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
834 newbasename, NULL); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
835 g_free(newbasename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
836 } while (g_file_test(filename, G_FILE_TEST_EXISTS)); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
837 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
838 playlist_save(playlist, filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
839 cleanup: |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
840 g_free(filename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
841 g_free(basename); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
842 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
843 } |
2313 | 844 |
845 void | |
846 bmp_config_save(void) | |
847 { | |
848 GList *node; | |
849 gchar *str; | |
850 gint i, cur_pb_time; | |
851 ConfigDb *db; | |
3481
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
852 GList *saved; |
2313 | 853 Playlist *playlist = playlist_get_active(); |
854 | |
855 cfg.disabled_iplugins = input_stringify_disabled_list(); | |
856 | |
857 | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
858 db = cfg_db_open(); |
2313 | 859 |
860 for (i = 0; i < ncfgbent; ++i) | |
861 if (bmp_boolents[i].be_wrt) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
862 cfg_db_set_bool(db, NULL, |
2313 | 863 bmp_boolents[i].be_vname, |
864 *bmp_boolents[i].be_vloc); | |
865 | |
866 for (i = 0; i < ncfgient; ++i) | |
867 if (bmp_numents[i].ie_wrt) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
868 cfg_db_set_int(db, NULL, |
2313 | 869 bmp_numents[i].ie_vname, |
870 *bmp_numents[i].ie_vloc); | |
871 | |
872 /* This is a bit lame .. it'll end up being written twice, | |
873 * could do with being done a bit neater. -larne */ | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
874 cfg_db_set_int(db, NULL, "playlist_position", |
2313 | 875 playlist_get_position(playlist)); |
876 | |
2530 | 877 /* FIXME: we're looking up SkinnedWindow::x &c ourselves here. |
878 * this isn't exactly right. -nenolod | |
879 */ | |
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
|
880 if ( SKINNED_WINDOW(playlistwin)->x != -1 && |
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
|
881 SKINNED_WINDOW(playlistwin)->y != -1 ) |
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
|
882 { |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
883 cfg_db_set_int(db, NULL, "playlist_x", |
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
|
884 SKINNED_WINDOW(playlistwin)->x); |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
885 cfg_db_set_int(db, NULL, "playlist_y", |
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
|
886 SKINNED_WINDOW(playlistwin)->y); |
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
|
887 } |
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
|
888 |
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
|
889 if ( SKINNED_WINDOW(mainwin)->x != -1 && |
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
|
890 SKINNED_WINDOW(mainwin)->y != -1 ) |
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
|
891 { |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
892 cfg_db_set_int(db, NULL, "player_x", |
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
|
893 SKINNED_WINDOW(mainwin)->x); |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
894 cfg_db_set_int(db, NULL, "player_y", |
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
|
895 SKINNED_WINDOW(mainwin)->y); |
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
|
896 } |
2530 | 897 |
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
|
898 if ( SKINNED_WINDOW(equalizerwin)->x != -1 && |
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
|
899 SKINNED_WINDOW(equalizerwin)->y != -1 ) |
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
|
900 { |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
901 cfg_db_set_int(db, NULL, "equalizer_x", |
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
|
902 SKINNED_WINDOW(equalizerwin)->x); |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
903 cfg_db_set_int(db, NULL, "equalizer_y", |
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
|
904 SKINNED_WINDOW(equalizerwin)->y); |
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
|
905 } |
2530 | 906 |
4080 | 907 cfg_db_set_bool(db, NULL, "mainwin_use_bitmapfont", |
908 cfg.mainwin_use_bitmapfont); | |
2313 | 909 |
910 for (i = 0; i < ncfgsent; ++i) { | |
911 if (bmp_strents[i].se_wrt) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
912 cfg_db_set_string(db, NULL, |
2313 | 913 bmp_strents[i].se_vname, |
914 *bmp_strents[i].se_vloc); | |
915 } | |
916 | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
917 cfg_db_set_float(db, NULL, "equalizer_preamp", cfg.equalizer_preamp); |
4236
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
918 |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
919 /* RG settings */ |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
920 cfg_db_set_float(db, NULL, "replay_gain_preamp", cfg.replay_gain_preamp); |
1ab015fe2ade
RG icon added. some changes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4234
diff
changeset
|
921 cfg_db_set_float(db, NULL, "default_gain", cfg.default_gain); |
2313 | 922 |
923 for (i = 0; i < 10; i++) { | |
924 str = g_strdup_printf("equalizer_band%d", i); | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
925 cfg_db_set_float(db, NULL, str, cfg.equalizer_bands[i]); |
2313 | 926 g_free(str); |
927 } | |
928 | |
4224
9b8d6438e00f
load/save the scale value
Cristi Magherusan <majeru@atheme.org>
parents:
4223
diff
changeset
|
929 cfg_db_set_float(db, NULL, "scale_factor", cfg.scale_factor); |
9b8d6438e00f
load/save the scale value
Cristi Magherusan <majeru@atheme.org>
parents:
4223
diff
changeset
|
930 |
2313 | 931 if (bmp_active_skin != NULL) |
932 { | |
933 if (bmp_active_skin->path) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
934 cfg_db_set_string(db, NULL, "skin", bmp_active_skin->path); |
2313 | 935 else |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
936 cfg_db_unset_key(db, NULL, "skin"); |
2313 | 937 } |
938 | |
939 if (get_current_output_plugin()) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
940 cfg_db_set_string(db, NULL, "output_plugin", |
2313 | 941 get_current_output_plugin()->filename); |
942 else | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
943 cfg_db_unset_key(db, NULL, "output_plugin"); |
2313 | 944 |
945 str = general_stringify_enabled_list(); | |
946 if (str) { | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
947 cfg_db_set_string(db, NULL, "enabled_gplugins", str); |
2313 | 948 g_free(str); |
949 } | |
950 else | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
951 cfg_db_unset_key(db, NULL, "enabled_gplugins"); |
2313 | 952 |
953 str = vis_stringify_enabled_list(); | |
954 if (str) { | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
955 cfg_db_set_string(db, NULL, "enabled_vplugins", str); |
2313 | 956 g_free(str); |
957 } | |
958 else | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
959 cfg_db_unset_key(db, NULL, "enabled_vplugins"); |
2313 | 960 |
961 str = effect_stringify_enabled_list(); | |
962 if (str) { | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
963 cfg_db_set_string(db, NULL, "enabled_eplugins", str); |
2313 | 964 g_free(str); |
965 } | |
966 else | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
967 cfg_db_unset_key(db, NULL, "enabled_eplugins"); |
2313 | 968 |
969 if (cfg.filesel_path) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
970 cfg_db_set_string(db, NULL, "filesel_path", cfg.filesel_path); |
2313 | 971 |
972 if (cfg.playlist_path) | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
973 cfg_db_set_string(db, NULL, "playlist_path", cfg.playlist_path); |
2313 | 974 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
975 cfg_db_set_int(db, NULL, "url_history_length", |
2313 | 976 g_list_length(cfg.url_history)); |
977 | |
978 for (node = cfg.url_history, i = 1; node; node = g_list_next(node), i++) { | |
979 str = g_strdup_printf("url_history%d", i); | |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
980 cfg_db_set_string(db, NULL, str, node->data); |
2313 | 981 g_free(str); |
982 } | |
983 | |
984 if (playback_get_playing()) { | |
2364 | 985 cur_pb_time = playback_get_time(); |
2313 | 986 } else |
2364 | 987 cur_pb_time = -1; |
2313 | 988 cfg.resume_playback_on_startup_time = cur_pb_time; |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
989 cfg_db_set_int(db, NULL, "resume_playback_on_startup_time", |
2364 | 990 cfg.resume_playback_on_startup_time); |
2313 | 991 |
3686
259b7d3e0976
sed s/bmp_cfg_db/cfg_db/.
William Pitcock <nenolod@atheme.org>
parents:
3679
diff
changeset
|
992 cfg_db_close(db); |
2313 | 993 |
994 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
3481
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
995 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
996 /* Save extra playlists that were loaded from PLAYLISTS_DIR */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
997 saved = NULL; |
3530
08dae20c75f0
Don't store default playlist in the playlists/ directory.
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3526
diff
changeset
|
998 saved = g_list_prepend(saved, playlist); /* don't save default again */ |
3481
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
999 if(!dir_foreach(bmp_paths[BMP_PATH_PLAYLISTS_DIR], save_extra_playlist, |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1000 &saved, NULL)) { |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1001 g_warning("Could not save extra playlists\n"); |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1002 } |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1003 |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1004 /* Save other playlists to PLAYLISTS_DIR */ |
308e5fb348db
Save extra playlists on exit
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3480
diff
changeset
|
1005 save_other_playlists(saved); |
4112
11f33d0e1c34
Fixes memory leak in bmp_config_save() by freeing temporary saved playlists list. (Bugzilla #41)
Jussi Judin <jjudin+audacious@iki.fi>
parents:
4104
diff
changeset
|
1006 g_list_free(saved); |
2313 | 1007 } |
1008 | |
1009 static void | |
1010 bmp_set_default_icon(void) | |
1011 { | |
1012 GdkPixbuf *icon; | |
1013 | |
1014 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); | |
1015 gtk_window_set_default_icon(icon); | |
1016 g_object_unref(icon); | |
1017 } | |
1018 | |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1019 #ifdef GDK_WINDOWING_QUARTZ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1020 static void |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1021 set_dock_icon(void) |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1022 { |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1023 GdkPixbuf *icon, *pixbuf; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1024 CGColorSpaceRef colorspace; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1025 CGDataProviderRef data_provider; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1026 CGImageRef image; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1027 gpointer data; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1028 gint rowstride, pixbuf_width, pixbuf_height; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1029 gboolean has_alpha; |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1030 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1031 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
|
1032 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
|
1033 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1034 data = gdk_pixbuf_get_pixels(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1035 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
|
1036 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
|
1037 rowstride = gdk_pixbuf_get_rowstride(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1038 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
|
1039 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1040 /* create the colourspace for the CGImage. */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1041 colorspace = CGColorSpaceCreateDeviceRGB(); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1042 data_provider = CGDataProviderCreateWithData(NULL, data, pixbuf_height * rowstride, NULL); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1043 image = CGImageCreate(pixbuf_width, pixbuf_height, 8, |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1044 has_alpha ? 32 : 24, rowstride, colorspace, |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1045 has_alpha ? kCGImageAlphaLast : 0, |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1046 data_provider, NULL, FALSE, |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1047 kCGRenderingIntentDefault); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1048 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1049 /* 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
|
1050 CGDataProviderRelease(data_provider); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1051 CGColorSpaceRelease(colorspace); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1052 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1053 /* set the dock tile images */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1054 SetApplicationDockTileImage(image); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1055 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1056 #if 0 |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1057 /* and release */ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1058 CGImageRelease(image); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1059 g_object_unref(icon); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1060 g_object_unref(pixbuf); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1061 #endif |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1062 } |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1063 #endif |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1064 |
2411 | 1065 static GOptionEntry cmd_entries[] = { |
2448
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
1066 {"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
|
1067 {"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
|
1068 {"pause", 'u', 0, G_OPTION_ARG_NONE, &options.pause, N_("Pause current song"), NULL}, |
2475 | 1069 {"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
|
1070 {"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
|
1071 {"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
|
1072 {"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
|
1073 {"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
|
1074 {"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
|
1075 {"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
|
1076 {"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
|
1077 {"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
|
1078 {"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
|
1079 {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version and builtin features"), NULL}, |
4200 | 1080 #ifdef GDK_WINDOWING_QUARTZ |
1081 {"macpack", 'n', 0, G_OPTION_ARG_NONE, &options.macpack, N_("Used in macpacking"), NULL}, /* Make this hidden */ | |
1082 #endif | |
2411 | 1083 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, N_("FILE..."), NULL}, |
1084 {NULL}, | |
1085 }; | |
2313 | 1086 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1087 static gboolean |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1088 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
|
1089 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1090 drct_play(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1091 return FALSE; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1092 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1093 |
2313 | 1094 static void |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
1095 handle_cmd_line_options(AudCmdLineOpt * options, |
2313 | 1096 gboolean remote) |
1097 { | |
2411 | 1098 gchar **filenames = options->filenames; |
2785 | 1099 #ifdef USE_DBUS |
1100 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
|
1101 gboolean is_running = audacious_remote_is_running(session); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1102 #else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1103 gboolean is_running = FALSE; |
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
1104 #endif |
2313 | 1105 |
2411 | 1106 if (options->version) |
1107 { | |
1108 dump_version(); | |
1109 exit(EXIT_SUCCESS); | |
1110 } | |
1111 | |
2788
b2b920b165ad
[svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents:
2786
diff
changeset
|
1112 #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
|
1113 if (is_running) |
2411 | 1114 { |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1115 if (filenames != NULL) |
2411 | 1116 { |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1117 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
|
1118 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
|
1119 GList *fns = NULL; |
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
1120 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1121 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
|
1122 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1123 gchar *filename; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1124 gchar *current_dir = g_get_current_dir(); |
2313 | 1125 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1126 if (!strstr(filenames[i], "://")) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1127 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1128 if (filenames[i][0] == '/') |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1129 filename = g_strdup_printf("file:///%s", filenames[i]); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1130 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1131 filename = g_strdup_printf("file:///%s/%s", current_dir, filenames[i]); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1132 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1133 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1134 filename = g_strdup(filenames[i]); |
2411 | 1135 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1136 fns = g_list_prepend(fns, filename); |
2411 | 1137 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1138 g_free(current_dir); |
2411 | 1139 } |
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
1140 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1141 fns = g_list_reverse(fns); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
1142 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1143 if (options->load_skins) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1144 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1145 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
|
1146 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
|
1147 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1148 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1149 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1150 GList *i; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1151 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1152 if (options->enqueue_to_temp) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1153 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
|
1154 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1155 if (options->enqueue && options->play) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1156 pos = audacious_remote_get_playlist_length(session); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
1157 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1158 if (!options->enqueue) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1159 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1160 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
|
1161 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
|
1162 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1163 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1164 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
|
1165 audacious_remote_playlist_add_url_string(session, i->data); |
2313 | 1166 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1167 if (options->enqueue && options->play && |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1168 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
|
1169 audacious_remote_set_playlist_pos(session, pos); |
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
1170 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1171 if (!options->enqueue) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1172 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
|
1173 } |
2313 | 1174 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1175 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
|
1176 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
|
1177 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1178 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
|
1179 } /* filename */ |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1180 |
2832 | 1181 if (options->rew) |
1182 audacious_remote_playlist_prev(session); | |
2313 | 1183 |
2832 | 1184 if (options->play) |
1185 audacious_remote_play(session); | |
2313 | 1186 |
2832 | 1187 if (options->pause) |
1188 audacious_remote_pause(session); | |
2313 | 1189 |
2832 | 1190 if (options->stop) |
1191 audacious_remote_stop(session); | |
2313 | 1192 |
2832 | 1193 if (options->fwd) |
1194 audacious_remote_playlist_next(session); | |
2313 | 1195 |
2832 | 1196 if (options->play_pause) |
1197 audacious_remote_play_pause(session); | |
2313 | 1198 |
2832 | 1199 if (options->show_jump_box) |
1200 audacious_remote_show_jtf_box(session); | |
2313 | 1201 |
2832 | 1202 if (options->mainwin) |
1203 audacious_remote_main_win_toggle(session, TRUE); | |
2313 | 1204 |
2832 | 1205 if (options->activate) |
1206 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
|
1207 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1208 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
|
1209 } /* 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
|
1210 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1211 #endif |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
1212 { /* !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
|
1213 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
|
1214 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1215 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
|
1216 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
|
1217 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
|
1218 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1219 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
|
1220 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1221 gchar *filename; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1222 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
|
1223 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1224 if (!strstr(filenames[i], "://")) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1225 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1226 if (filenames[i][0] == '/') |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1227 filename = g_strdup_printf("file:///%s", filenames[i]); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1228 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1229 filename = g_strdup_printf("file:///%s/%s", current_dir, filenames[i]); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1230 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1231 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1232 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
|
1233 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1234 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
|
1235 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1236 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
|
1237 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1238 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1239 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
|
1240 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1241 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1242 if (options->enqueue_to_temp) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1243 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
|
1244 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1245 if (options->enqueue && options->play) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1246 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
|
1247 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1248 if (!options->enqueue) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1249 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1250 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
|
1251 drct_stop(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1252 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1253 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1254 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
|
1255 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1256 if (options->enqueue && options->play && |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1257 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
|
1258 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
|
1259 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1260 if (!options->enqueue) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1261 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
|
1262 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1263 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1264 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
|
1265 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
|
1266 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1267 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
|
1268 } /* filename */ |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1269 |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1270 if (options->rew) |
3753 | 1271 drct_pl_prev(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1272 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1273 if (options->play) |
3753 | 1274 drct_play(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1275 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1276 if (options->pause) |
3753 | 1277 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1278 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1279 if (options->stop) |
3753 | 1280 drct_stop(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1281 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1282 if (options->fwd) |
3753 | 1283 drct_pl_next(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1284 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1285 if (options->play_pause) { |
3753 | 1286 if (drct_get_paused()) |
1287 drct_play(); | |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1288 else |
3753 | 1289 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1290 } |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1291 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1292 if (options->show_jump_box) |
3753 | 1293 drct_jtf_show(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1294 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1295 if (options->mainwin) |
3753 | 1296 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
|
1297 |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1298 if (options->activate) |
3753 | 1299 drct_activate(); |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
1300 } /* !is_running */ |
2313 | 1301 } |
1302 | |
1303 static void | |
1304 bmp_setup_logger(void) | |
1305 { | |
1306 if (!bmp_logger_start(bmp_paths[BMP_PATH_LOG_FILE])) | |
1307 return; | |
1308 | |
1309 g_atexit(bmp_logger_stop); | |
1310 } | |
1311 | |
1312 static void | |
1313 run_load_skin_error_dialog(const gchar * skin_path) | |
1314 { | |
1315 const gchar *markup = | |
1316 N_("<b><big>Unable to load skin.</big></b>\n" | |
1317 "\n" | |
1318 "Check that skin at '%s' is usable and default skin is properly " | |
1319 "installed at '%s'\n"); | |
1320 | |
1321 GtkWidget *dialog = | |
1322 gtk_message_dialog_new_with_markup(NULL, | |
1323 GTK_DIALOG_MODAL, | |
1324 GTK_MESSAGE_ERROR, | |
1325 GTK_BUTTONS_CLOSE, | |
1326 _(markup), | |
1327 skin_path, | |
1328 BMP_DEFAULT_SKIN_PATH); | |
1329 gtk_dialog_run(GTK_DIALOG(dialog)); | |
1330 gtk_widget_destroy(dialog); | |
1331 } | |
1332 | |
2369 | 1333 static gboolean |
1334 aud_headless_iteration(gpointer unused) | |
1335 { | |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1336 free_vis_data(); |
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1337 return TRUE; |
2369 | 1338 } |
1339 | |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1340 static gboolean |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1341 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
|
1342 gpointer def) |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1343 { |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1344 const gchar *title; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1345 Playlist *playlist; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1346 Playlist *deflist; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1347 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1348 deflist = (Playlist *)def; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1349 playlist = playlist_new(); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1350 if (!playlist) { |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1351 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
|
1352 return FALSE; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1353 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1354 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1355 playlist_add_playlist(playlist); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1356 playlist_load(playlist, path); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1357 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1358 title = playlist_get_current_name(playlist); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1359 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1360 return FALSE; /* keep loading other playlists */ |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1361 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1362 |
2313 | 1363 gint |
1364 main(gint argc, gchar ** argv) | |
1365 { | |
1366 gboolean gtk_init_check_ok; | |
1367 Playlist *playlist; | |
2411 | 1368 GOptionContext *context; |
1369 GError *error = NULL; | |
2313 | 1370 |
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1371 /* 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
|
1372 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
|
1373 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
|
1374 if (!g_thread_supported()) { |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1375 g_printerr(_("Sorry, threads isn't supported on your platform.\n\n" |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1376 "If you're on a libc5 based linux system and installed Glib & GTK+ before you\n" |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1377 "installed LinuxThreads you need to recompile Glib & GTK+.\n")); |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1378 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
|
1379 } |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1380 |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1381 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
|
1382 |
2313 | 1383 /* Setup l10n early so we can print localized error messages */ |
1384 gtk_set_locale(); | |
1385 bindtextdomain(PACKAGE_NAME, LOCALEDIR); | |
1386 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | |
2388
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
1387 bindtextdomain(PACKAGE_NAME "-plugins", LOCALEDIR); |
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
1388 bind_textdomain_codeset(PACKAGE_NAME "-plugins", "UTF-8"); |
2313 | 1389 textdomain(PACKAGE_NAME); |
1390 | |
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
1391 #ifndef _WIN32 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
1392 egg_set_desktop_file(AUDACIOUS_DESKTOP_FILE); |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
1393 #endif |
2313 | 1394 bmp_init_paths(); |
1395 bmp_make_user_dir(); | |
1396 | |
1397 cond_scan = g_cond_new(); | |
1398 mutex_scan = g_mutex_new(); | |
2463 | 1399 gtk_rc_add_default_file(bmp_paths[BMP_PATH_GTKRC_FILE]); |
1400 | |
2313 | 1401 gtk_init_check_ok = gtk_init_check(&argc, &argv); |
2411 | 1402 |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
1403 memset(&options, '\0', sizeof(AudCmdLineOpt)); |
2413 | 1404 options.session = -1; |
1405 | |
2411 | 1406 context = g_option_context_new(_("- play multimedia files")); |
1407 g_option_context_add_main_entries(context, cmd_entries, PACKAGE_NAME); | |
1408 g_option_context_add_group(context, gtk_get_option_group(TRUE)); | |
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
1409 g_option_context_add_group(context, egg_sm_client_get_option_group()); |
2411 | 1410 g_option_context_parse(context, &argc, &argv, &error); |
1411 | |
2412 | 1412 if (error != NULL) |
1413 { | |
4193
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1414 if(error->message) |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1415 { /* checking for MacOS X -psn_0_* errors*/ |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1416 char* s = g_strrstr(error->message,"-psn_0_"); |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1417 if(!s) |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1418 { |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1419 g_printerr(_("%s: %s\nTry `%s --help' for more information.\n"), |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1420 argv[0], error->message, argv[0]); |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1421 exit(EXIT_FAILURE); |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1422 } |
f6da5b8d401e
made it ignore -psn_0_* arguments, passed by MacOS X
Cristi Magherusan <majeru@atheme.org>
parents:
4180
diff
changeset
|
1423 } |
2412 | 1424 } |
1425 | |
2313 | 1426 if (!gtk_init_check_ok) { |
1427 if (argc < 2) { | |
1428 /* GTK check failed, and no arguments passed to indicate | |
1429 that user is intending to only remote control a running | |
1430 session */ | |
2412 | 1431 g_printerr(_("%s: Unable to open display, exiting.\n"), argv[0]); |
2313 | 1432 exit(EXIT_FAILURE); |
1433 } | |
1434 | |
1435 handle_cmd_line_options(&options, TRUE); | |
1436 | |
1437 /* we could be running headless, so GTK probably wont matter */ | |
1438 if (options.headless != 1) | |
2938
1cdfc508d758
Fix adding files when Audacious is running.
Jonathan Schleifer <js@h3c.de>
parents:
2914
diff
changeset
|
1439 exit(EXIT_SUCCESS); |
2313 | 1440 } |
1441 | |
1442 if (options.no_log == FALSE) | |
1443 bmp_setup_logger(); | |
1444 | |
1445 signal_handlers_init(); | |
1446 | |
1447 g_random_set_seed(time(NULL)); | |
4234 | 1448 SAD_dither_init_rand((gint32)time(NULL)); |
2313 | 1449 |
1450 bmp_config_load(); | |
1451 | |
2856
c4d07471f647
Added a mowgli_init() call
Cristi Magherusan <majeru@gentoo.ro>
parents:
2846
diff
changeset
|
1452 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
|
1453 |
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
|
1454 if (options.headless != 1) |
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
|
1455 { |
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
|
1456 ui_main_check_theme_engine(); |
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
|
1457 |
3978
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
1458 /* register icons in stock |
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
1459 NOTE: should be called before UIManager */ |
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
1460 register_aud_stock_icons(); |
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
1461 |
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
|
1462 /* UIManager |
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
|
1463 NOTE: this needs to be called before plugin init, cause |
3978
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
1464 plugin init functions may want to add custom menu entries */ |
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
|
1465 ui_manager_init(); |
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
|
1466 ui_manager_create_menus(); |
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
|
1467 } |
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
|
1468 |
2313 | 1469 plugin_system_init(); |
1470 | |
1471 /* Initialize the playlist system. */ | |
1472 playlist_init(); | |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1473 playlist = playlist_get_active(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1474 playlist_load(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1475 playlist_set_position(playlist, cfg.playlist_position); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1476 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1477 handle_cmd_line_options(&options, TRUE); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1478 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1479 #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
|
1480 init_dbus(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
1481 #endif |
2313 | 1482 |
1483 if (options.headless != 1) | |
1484 { | |
1485 bmp_set_default_icon(); | |
3525
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1486 #ifdef GDK_WINDOWING_QUARTZ |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1487 set_dock_icon(); |
540e49d1d87c
macos: Set an application icon in the dock.
William Pitcock <nenolod@atheme.org>
parents:
3400
diff
changeset
|
1488 #endif |
2313 | 1489 |
1490 gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]); | |
1491 | |
1492 if (!init_skins(cfg.skin)) { | |
1493 run_load_skin_error_dialog(cfg.skin); | |
1494 exit(EXIT_FAILURE); | |
1495 } | |
1496 | |
1497 GDK_THREADS_ENTER(); | |
1498 } | |
1499 | |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1500 /* Load extra playlists */ |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1501 if(!dir_foreach(bmp_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist, |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1502 playlist, NULL)) { |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1503 g_warning("Could not load extra playlists\n"); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1504 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
1505 |
2313 | 1506 /* this needs to be called after all 3 windows are created and |
1507 * input plugins are setup'ed | |
1508 * but not if we're running headless --nenolod | |
1509 */ | |
1510 mainwin_setup_menus(); | |
1511 | |
1512 if (options.headless != 1) | |
1513 { | |
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
|
1514 ui_main_set_initial_volume(); |
2313 | 1515 |
1516 /* FIXME: delayed, because it deals directly with the plugin | |
1517 * interface to set menu items */ | |
1518 create_prefs_window(); | |
1519 | |
2364 | 1520 create_fileinfo_window(); |
1521 | |
2313 | 1522 |
1523 if (cfg.player_visible) | |
1524 mainwin_show(TRUE); | |
1525 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
|
1526 { |
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
|
1527 /* 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
|
1528 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
|
1529 } |
2313 | 1530 |
1531 if (cfg.equalizer_visible) | |
1532 equalizerwin_show(TRUE); | |
1533 | |
1534 if (cfg.playlist_visible) | |
1535 playlistwin_show(); | |
1536 | |
1537 hint_set_always(cfg.always_on_top); | |
1538 | |
1539 playlist_start_get_info_thread(); | |
1540 | |
2364 | 1541 has_x11_connection = TRUE; |
2313 | 1542 |
2364 | 1543 if (cfg.resume_playback_on_startup) |
1544 { | |
1545 if (cfg.resume_playback_on_startup_time != -1 && | |
1546 playlist_get_length(playlist) > 0) | |
1547 { | |
1548 int i; | |
1549 gint l = 0, r = 0; | |
1550 while (gtk_events_pending()) gtk_main_iteration(); | |
1551 output_get_volume(&l, &r); | |
1552 output_set_volume(0,0); | |
1553 playback_initiate(); | |
2313 | 1554 |
2364 | 1555 /* Busy wait; loop is fairly tight to minimize duration of |
1556 * "frozen" GUI. Feel free to tune. --chainsaw */ | |
1557 for (i = 0; i < 20; i++) | |
1558 { | |
1559 g_usleep(1000); | |
1560 if (!ip_data.playing) | |
1561 break; | |
1562 } | |
1563 playback_seek(cfg.resume_playback_on_startup_time / 1000); | |
1564 output_set_volume(l, r); | |
1565 } | |
1566 } | |
1567 | |
2313 | 1568 gtk_main(); |
1569 | |
1570 GDK_THREADS_LEAVE(); | |
1571 | |
1572 g_cond_free(cond_scan); | |
1573 g_mutex_free(mutex_scan); | |
1574 | |
1575 return EXIT_SUCCESS; | |
1576 } | |
2364 | 1577 // if we are running headless |
2313 | 1578 else |
1579 { | |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1580 GMainLoop *loop; |
2369 | 1581 |
2313 | 1582 playlist_start_get_info_thread(); |
1583 | |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1584 loop = g_main_loop_new(NULL, TRUE); |
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1585 g_timeout_add(10, aud_headless_iteration, NULL); |
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1586 g_main_loop_run(loop); |
2313 | 1587 |
1588 return EXIT_SUCCESS; | |
1589 } | |
1590 } |