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