Mercurial > audlegacy
annotate audacious/main.c @ 2186:7be793a34b48 trunk
[svn] - add ability to colourtheme the UI
author | nenolod |
---|---|
date | Wed, 20 Dec 2006 07:09:22 -0800 |
parents | a792aaee8e8e |
children | 60bd49189fde |
rev | line source |
---|---|
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1 /* Audacious - Cross-platform multimedia player |
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
2 * Copyright (C) 2005-2006 Audacious development team. |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
3 * |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
4 * Based on BMP: |
0 | 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 | |
2105
f18a5b617c34
[svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents:
2088
diff
changeset
|
12 * the Free Software Foundation; under version 2 of the License. |
0 | 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 | |
20 * along with this program; if not, write to the Free Software | |
1459 | 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
0 | 22 */ |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 #include "main.h" | |
29 | |
30 #include <glib.h> | |
31 #include <glib/gi18n.h> | |
32 #include <glib/gprintf.h> | |
33 #include <gdk/gdk.h> | |
34 #include <stdlib.h> | |
35 #include <string.h> | |
36 #include <getopt.h> | |
37 #include <ctype.h> | |
38 #include <time.h> | |
39 | |
40 #include <unistd.h> | |
41 #include <errno.h> | |
42 #include <sys/types.h> | |
43 #include <sys/stat.h> | |
44 #include <signal.h> | |
1640 | 45 |
46 #include "platform/smartinclude.h" | |
0 | 47 |
48 #include "libaudacious/configdb.h" | |
49 #include "libaudacious/beepctrl.h" | |
50 #include "libaudacious/util.h" | |
2146
e0e50e151bab
[svn] - move vfs from libaudacious to main audacious
nenolod
parents:
2127
diff
changeset
|
51 #include "vfs.h" |
0 | 52 |
53 #include "controlsocket.h" | |
54 #include "dnd.h" | |
55 #include "effect.h" | |
1653 | 56 #include "equalizer.h" |
0 | 57 #include "general.h" |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
58 #include "genevent.h" |
0 | 59 #include "hints.h" |
60 #include "input.h" | |
61 #include "logger.h" | |
1653 | 62 #include "mainwin.h" |
0 | 63 #include "output.h" |
538
e4e897d20791
[svn] remove libaudcore, we never did anything with it
nenolod
parents:
534
diff
changeset
|
64 #include "playback.h" |
0 | 65 #include "playlist.h" |
1653 | 66 #include "ui_playlist.h" |
0 | 67 #include "pluginenum.h" |
68 #include "prefswin.h" | |
69 #include "skinwin.h" | |
70 #include "util.h" | |
71 #include "visualization.h" | |
530
1947144093bc
[svn] When running SVN, make a note of the SVN version. The SVN version is stored in build_stamp.c.
nenolod
parents:
486
diff
changeset
|
72 #include "build_stamp.h" |
1264 | 73 #include "ui_fileinfo.h" |
2156
a792aaee8e8e
[svn] - new signal handling which does not block (based on concept from BMP 0.9.8 that never got released)
nenolod
parents:
2146
diff
changeset
|
74 #include "signals.h" |
0 | 75 |
76 #include "pixmaps.h" | |
120 | 77 #include "images/audacious_player.xpm" |
0 | 78 |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
79 gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ |
0 | 80 |
81 /* Translatable string for beep.desktop's comment field */ | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
82 const gchar *desktop_comment = N_("Audacious"); |
0 | 83 |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
84 const gchar *application_name = N_("Audacious"); |
0 | 85 |
1653 | 86 |
0 | 87 struct _BmpCmdLineOpt { |
88 GList *filenames; | |
89 gint session; | |
1885
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
90 gboolean play, stop, pause, fwd, rew, play_pause, playcd, show_jump_box; |
0 | 91 gboolean enqueue, mainwin, remote, activate; |
92 gboolean load_skins; | |
191 | 93 gboolean headless; |
1348
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
94 gboolean no_log; |
2127
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
95 gboolean enqueue_to_temp; |
0 | 96 gchar *previous_session_id; |
97 }; | |
98 | |
99 typedef struct _BmpCmdLineOpt BmpCmdLineOpt; | |
100 | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
101 BmpCmdLineOpt options; |
0 | 102 |
103 BmpConfig cfg; | |
104 | |
105 BmpConfig bmp_default_config = { | |
106 MAINWIN_DEFAULT_POS_X, /* mainwin x position */ | |
107 MAINWIN_DEFAULT_POS_Y, /* mainwin y position */ | |
108 EQUALIZER_DEFAULT_POS_X, /* equalizer x position */ | |
109 EQUALIZER_DEFAULT_POS_Y, /* equalizer y position */ | |
110 PLAYLISTWIN_DEFAULT_POS_X, /* playlistwin x position */ | |
111 PLAYLISTWIN_DEFAULT_POS_Y, /* playlistwin y position */ | |
112 PLAYLISTWIN_DEFAULT_WIDTH, /* playlistwin width */ | |
113 PLAYLISTWIN_DEFAULT_HEIGHT, /* playlistwin height */ | |
114 10, /* snap distance */ | |
115 FALSE, /* real-time priority */ | |
116 FALSE, FALSE, /* shuffle, repeat */ | |
117 FALSE, /* UNUSED (double size) */ | |
118 TRUE, /* autoscroll */ | |
119 TRUE, /* analyzer peaks */ | |
120 FALSE, /* equalizer autoload */ | |
121 FALSE, /* easy move */ | |
122 FALSE, /* equalizer active */ | |
123 FALSE, /* playlistwin visible */ | |
124 FALSE, /* equalizer visible */ | |
125 TRUE, /* player visible */ | |
126 FALSE, /* player shaded */ | |
127 FALSE, /* playlistwin shaded */ | |
128 FALSE, /* equalizer shaded */ | |
129 FALSE, /* allow multiple instances */ | |
130 TRUE, /* always show cb */ | |
2019
d3a62e1075e2
[svn] Allow \ to / conversion to be switched on & off, by external contributor Chris Kehler <cbkehler@sympatico.ca>.
chainsaw
parents:
2003
diff
changeset
|
131 TRUE, TRUE, TRUE, /* convert '_', %20 and '\' */ |
0 | 132 TRUE, /* show numbers in playlist */ |
133 TRUE, /* snap windows */ | |
134 TRUE, /* save window positions */ | |
135 TRUE, /* dim titlebar */ | |
136 FALSE, /* get playlist info on load */ | |
137 TRUE, /* get playlist info on demand */ | |
138 TRUE, /* UNUSED (equalizer doublesize linked) */ | |
139 FALSE, /* sort jump to file */ | |
140 FALSE, /* use effect plugins */ | |
141 FALSE, /* always on top */ | |
142 FALSE, /* sticky */ | |
143 FALSE, /* no playlist advance */ | |
1884 | 144 FALSE, /* stop after current song */ |
893
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
145 TRUE, /* refresh file list */ |
0 | 146 TRUE, /* UNUSED (smooth title scrolling) */ |
147 TRUE, /* use playlist metadata */ | |
148 TRUE, /* warn about unplayables */ | |
149 FALSE, /* use \ as directory delimiter */ | |
150 FALSE, /* random skin on play */ | |
151 FALSE, /* use fontsets */ | |
152 FALSE, /* use X font for mainwin */ | |
153 TRUE, /* use custom cursors */ | |
154 TRUE, /* close dialog on open */ | |
155 TRUE, /* close dialog on add */ | |
156 0.0, /* equalizer preamp */ | |
157 {0, 0, 0, 0, 0, /* equalizer bands */ | |
158 0, 0, 0, 0, 0}, | |
159 NULL, /* skin */ | |
160 NULL, /* output plugin */ | |
161 NULL, /* file selector path */ | |
162 NULL, /* playlist path */ | |
163 NULL, /* playlist font */ | |
164 NULL, /* mainwin font */ | |
165 NULL, /* disabled input plugins */ | |
166 NULL, /* enabled general plugins */ | |
167 NULL, /* enabled visualization plugins */ | |
168 NULL, /* enabled effect plugins */ | |
169 NULL, /* equalizer preset default file */ | |
170 NULL, /* equalizer preset extension */ | |
171 NULL, /* URL history */ | |
172 0, /* timer mode */ | |
173 VIS_ANALYZER, /* visualizer type */ | |
174 ANALYZER_NORMAL, /* analyzer mode */ | |
175 ANALYZER_BARS, /* analyzer type */ | |
176 SCOPE_DOT, /* scope mode */ | |
177 VU_SMOOTH, /* VU mode */ | |
178 REFRESH_FULL, /* visualizer refresh rate */ | |
179 FALLOFF_FAST, /* analyzer fall off rate */ | |
180 FALLOFF_SLOW, /* peaks fall off rate */ | |
181 0, /* playlist position */ | |
182 2, /* pause between songs time */ | |
183 FALSE, /* pause between songs */ | |
184 FALSE, /* show window decorations */ | |
185 8, /* mouse wheel scroll step */ | |
186 FALSE, /* playlist transparent */ | |
1347
8a874906535b
[svn] - use a more standard-looking default title format
nenolod
parents:
1283
diff
changeset
|
187 2, /* 3rd preset (ARTIST - ALBUM - TITLE) */ |
0 | 188 NULL, /* title format */ |
189 FALSE, /* software volume control enabled */ | |
190 TRUE, /* UNUSED (XMMS compatibility mode) */ | |
191 TRUE, /* extra eq filtering */ | |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
192 3, /* scroll pl by */ |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
193 FALSE, /* resume playback on startup */ |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
194 -1, /* resume playback on startup time */ |
1147 | 195 TRUE, /* show seperators in pl */ |
1146
7e208feb36a2
[svn] - new global variable `output_buffer_size', replaces all of the per-plugin buffer sizes
nenolod
parents:
1105
diff
changeset
|
196 NULL, |
7e208feb36a2
[svn] - new global variable `output_buffer_size', replaces all of the per-plugin buffer sizes
nenolod
parents:
1105
diff
changeset
|
197 NULL, |
1163
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
198 3000, /* audio buffer size */ |
1164 | 199 FALSE, /* whether or not to postpone format detection on initial add */ |
1358 | 200 TRUE, /* show filepopup for tuple */ |
1413 | 201 NULL, /* words identifying covers */ |
202 NULL, /* words that might not show up in cover names */ | |
1444
c04ce16b2b57
[svn] - libaudacious/beepctrl.c: optimise further and be more paranoid about leaks
nenolod
parents:
1429
diff
changeset
|
203 FALSE, |
c04ce16b2b57
[svn] - libaudacious/beepctrl.c: optimise further and be more paranoid about leaks
nenolod
parents:
1429
diff
changeset
|
204 0, |
c04ce16b2b57
[svn] - libaudacious/beepctrl.c: optimise further and be more paranoid about leaks
nenolod
parents:
1429
diff
changeset
|
205 NULL, /* default session uri base (non-NULL = custom session uri base) */ |
1710 | 206 150, /* short side length of the picture in the filepopup */ |
207 20, /* delay until the filepopup comes up */ | |
1904
4960ba312ffe
[svn] - add a default value for cfg.use_file_cover (FALSE)
nenolod
parents:
1889
diff
changeset
|
208 FALSE, /* use filename.jpg for coverart */ |
1905
6b4116c34489
[svn] - change "Transparency" to "Miscillaneous UI Features" in prefswin
nenolod
parents:
1904
diff
changeset
|
209 FALSE, /* use XMMS-style file selection */ |
2113 | 210 TRUE, /* use extension probing */ |
2186 | 211 255, 255, 255, /* colorize r, g, b */ |
0 | 212 }; |
213 | |
214 typedef struct bmp_cfg_boolent_t { | |
215 char const *be_vname; | |
216 gboolean *be_vloc; | |
217 gboolean be_wrt; | |
218 } bmp_cfg_boolent; | |
219 | |
220 typedef struct bmp_cfg_nument_t { | |
221 char const *ie_vname; | |
222 gint *ie_vloc; | |
223 gboolean ie_wrt; | |
224 } bmp_cfg_nument; | |
225 | |
226 typedef struct bmp_cfg_strent_t { | |
227 char const *se_vname; | |
228 char **se_vloc; | |
229 gboolean se_wrt; | |
230 } bmp_cfg_strent; | |
231 | |
232 const gchar *bmp_titlestring_presets[] = { | |
233 "%t", | |
946
8cfe13fcd0c7
[svn] - Forgot a few things regarding titlestrings!
nhjm449
parents:
943
diff
changeset
|
234 "%{p:%p - %}%t", |
8cfe13fcd0c7
[svn] - Forgot a few things regarding titlestrings!
nhjm449
parents:
943
diff
changeset
|
235 "%{p:%p - %}%{a:%a - %}%t", |
943 | 236 "%{p:%p - %}%{a:%a - %}%{n:%n. %}%t", |
237 "%{p:%p %}%{a:[ %a ] %}%{p:- %}%{n:%n. %}%{t:%t%}", | |
946
8cfe13fcd0c7
[svn] - Forgot a few things regarding titlestrings!
nhjm449
parents:
943
diff
changeset
|
238 "%{a:%a - %}%t" |
0 | 239 }; |
240 | |
241 const guint n_titlestring_presets = G_N_ELEMENTS(bmp_titlestring_presets); | |
242 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
243 const gchar *chardet_detector_presets[] = { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
244 "None", |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
245 "Japanese", |
1595
e6cc84e06444
[svn] - libguess update: workaround for that g_convert can't convert properly from UCS-2BE/LE trailing after BOM.
yaz
parents:
1566
diff
changeset
|
246 "Taiwanese", |
e6cc84e06444
[svn] - libguess update: workaround for that g_convert can't convert properly from UCS-2BE/LE trailing after BOM.
yaz
parents:
1566
diff
changeset
|
247 "Chinese", |
e6cc84e06444
[svn] - libguess update: workaround for that g_convert can't convert properly from UCS-2BE/LE trailing after BOM.
yaz
parents:
1566
diff
changeset
|
248 "Korean", |
1613
9becbe564217
[svn] - chardet patch for Russian language witten by Valentine Sinitsyn.
yaz
parents:
1595
diff
changeset
|
249 "Russian", |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
250 #ifdef HAVE_UDET |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
251 "Universal" |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
252 #endif |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
253 }; |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
254 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
255 const guint n_chardet_detector_presets = G_N_ELEMENTS(chardet_detector_presets); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
256 |
0 | 257 static bmp_cfg_boolent bmp_boolents[] = { |
258 {"allow_multiple_instances", &cfg.allow_multiple_instances, TRUE}, | |
259 {"use_realtime", &cfg.use_realtime, TRUE}, | |
260 {"always_show_cb", &cfg.always_show_cb, TRUE}, | |
261 {"convert_underscore", &cfg.convert_underscore, TRUE}, | |
262 {"convert_twenty", &cfg.convert_twenty, TRUE}, | |
2019
d3a62e1075e2
[svn] Allow \ to / conversion to be switched on & off, by external contributor Chris Kehler <cbkehler@sympatico.ca>.
chainsaw
parents:
2003
diff
changeset
|
263 {"convert_slash", &cfg.convert_slash, TRUE }, |
0 | 264 {"show_numbers_in_pl", &cfg.show_numbers_in_pl, TRUE}, |
1056
21628529c615
[svn] add the config option to enable/disable separator line in the playlist
yaz
parents:
1042
diff
changeset
|
265 {"show_separator_in_pl", &cfg.show_separator_in_pl, TRUE}, |
0 | 266 {"snap_windows", &cfg.snap_windows, TRUE}, |
267 {"save_window_positions", &cfg.save_window_position, TRUE}, | |
268 {"dim_titlebar", &cfg.dim_titlebar, TRUE}, | |
269 {"get_info_on_load", &cfg.get_info_on_load, TRUE}, | |
270 {"get_info_on_demand", &cfg.get_info_on_demand, TRUE}, | |
1938 | 271 {"eq_doublesize_linked", &cfg.eq_doublesize_linked, TRUE}, |
0 | 272 {"no_playlist_advance", &cfg.no_playlist_advance, TRUE}, |
893
6afdd0d7e1e1
[svn] Make refreshing optional, default to disabled if Gnome VFS available.
nemo
parents:
887
diff
changeset
|
273 {"refresh_file_list", &cfg.refresh_file_list, TRUE}, |
0 | 274 {"sort_jump_to_file", &cfg.sort_jump_to_file, TRUE}, |
275 {"use_pl_metadata", &cfg.use_pl_metadata, TRUE}, | |
276 {"warn_about_unplayables", &cfg.warn_about_unplayables, TRUE}, | |
277 {"use_backslash_as_dir_delimiter", &cfg.use_backslash_as_dir_delimiter, TRUE}, | |
278 {"player_shaded", &cfg.player_shaded, TRUE}, | |
279 {"player_visible", &cfg.player_visible, TRUE}, | |
280 {"shuffle", &cfg.shuffle, TRUE}, | |
281 {"repeat", &cfg.repeat, TRUE}, | |
1938 | 282 {"doublesize", &cfg.doublesize, TRUE}, |
0 | 283 {"autoscroll_songname", &cfg.autoscroll, TRUE}, |
898 | 284 {"stop_after_current_song", &cfg.stopaftersong, TRUE}, |
0 | 285 {"playlist_shaded", &cfg.playlist_shaded, TRUE}, |
286 {"playlist_visible", &cfg.playlist_visible, TRUE}, | |
287 {"playlist_transparent", &cfg.playlist_transparent, TRUE}, | |
288 {"use_fontsets", &cfg.use_fontsets, TRUE}, | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
289 {"mainwin_use_xfont", &cfg.mainwin_use_xfont, FALSE}, |
0 | 290 {"equalizer_visible", &cfg.equalizer_visible, TRUE}, |
291 {"equalizer_active", &cfg.equalizer_active, TRUE}, | |
292 {"equalizer_shaded", &cfg.equalizer_shaded, TRUE}, | |
293 {"equalizer_autoload", &cfg.equalizer_autoload, TRUE}, | |
1938 | 294 {"easy_move", &cfg.easy_move, TRUE}, |
0 | 295 {"use_eplugins", &cfg.use_eplugins, TRUE}, |
296 {"always_on_top", &cfg.always_on_top, TRUE}, | |
297 {"sticky", &cfg.sticky, TRUE}, | |
298 {"random_skin_on_play", &cfg.random_skin_on_play, TRUE}, | |
299 {"pause_between_songs", &cfg.pause_between_songs, TRUE}, | |
300 {"show_wm_decorations", &cfg.show_wm_decorations, TRUE}, | |
301 {"eq_extra_filtering", &cfg.eq_extra_filtering, TRUE}, | |
302 {"analyzer_peaks", &cfg.analyzer_peaks, TRUE}, | |
303 {"custom_cursors", &cfg.custom_cursors, TRUE}, | |
304 {"close_dialog_open", &cfg.close_dialog_open, TRUE}, | |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
305 {"close_dialog_add", &cfg.close_dialog_add, TRUE}, |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
306 {"resume_playback_on_startup", &cfg.resume_playback_on_startup, TRUE}, |
1163
ff71f891265b
[svn] - Allow to do format detection on demand; instead of immediately on add
nenolod
parents:
1147
diff
changeset
|
307 {"playlist_detect", &cfg.playlist_detect, TRUE}, |
1358 | 308 {"show_filepopup_for_tuple", &cfg.show_filepopup_for_tuple, TRUE}, |
1889
597bd579d9af
[svn] Patch by Michael Hanselmann to fetch a per-song image file.
nemo
parents:
1886
diff
changeset
|
309 {"recurse_for_cover", &cfg.recurse_for_cover, TRUE}, |
597bd579d9af
[svn] Patch by Michael Hanselmann to fetch a per-song image file.
nemo
parents:
1886
diff
changeset
|
310 {"use_file_cover", &cfg.use_file_cover, TRUE}, |
1905
6b4116c34489
[svn] - change "Transparency" to "Miscillaneous UI Features" in prefswin
nenolod
parents:
1904
diff
changeset
|
311 {"use_xmms_style_fileselector", &cfg.use_xmms_style_fileselector, TRUE}, |
2108
02f39b64f36b
[svn] - add support for new extension probing system
nenolod
parents:
2105
diff
changeset
|
312 {"use_extension_probing", &cfg.use_extension_probing, TRUE}, |
0 | 313 }; |
314 | |
315 static gint ncfgbent = G_N_ELEMENTS(bmp_boolents); | |
316 | |
317 static bmp_cfg_nument bmp_numents[] = { | |
318 {"player_x", &cfg.player_x, TRUE}, | |
319 {"player_y", &cfg.player_y, TRUE}, | |
320 {"timer_mode", &cfg.timer_mode, TRUE}, | |
321 {"vis_type", &cfg.vis_type, TRUE}, | |
322 {"analyzer_mode", &cfg.analyzer_mode, TRUE}, | |
323 {"analyzer_type", &cfg.analyzer_type, TRUE}, | |
324 {"scope_mode", &cfg.scope_mode, TRUE}, | |
325 {"vu_mode", &cfg.vu_mode, TRUE}, | |
326 {"vis_refresh_rate", &cfg.vis_refresh, TRUE}, | |
327 {"analyzer_falloff", &cfg.analyzer_falloff, TRUE}, | |
328 {"peaks_falloff", &cfg.peaks_falloff, TRUE}, | |
329 {"playlist_x", &cfg.playlist_x, TRUE}, | |
330 {"playlist_y", &cfg.playlist_y, TRUE}, | |
331 {"playlist_width", &cfg.playlist_width, TRUE}, | |
332 {"playlist_height", &cfg.playlist_height, TRUE}, | |
333 {"playlist_position", &cfg.playlist_position, TRUE}, | |
334 {"equalizer_x", &cfg.equalizer_x, TRUE}, | |
335 {"equalizer_y", &cfg.equalizer_y, TRUE}, | |
336 {"snap_distance", &cfg.snap_distance, TRUE}, | |
337 {"pause_between_songs_time", &cfg.pause_between_songs_time, TRUE}, | |
338 {"mouse_wheel_change", &cfg.mouse_change, TRUE}, | |
339 {"scroll_pl_by", &cfg.scroll_pl_by, TRUE}, | |
340 {"titlestring_preset", &cfg.titlestring_preset, TRUE}, | |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
341 {"resume_playback_on_startup_time", &cfg.resume_playback_on_startup_time, TRUE}, |
1146
7e208feb36a2
[svn] - new global variable `output_buffer_size', replaces all of the per-plugin buffer sizes
nenolod
parents:
1105
diff
changeset
|
342 {"output_buffer_size", &cfg.output_buffer_size, TRUE}, |
1710 | 343 {"recurse_for_cover_depth", &cfg.recurse_for_cover_depth, TRUE}, |
344 {"filepopup_pixelsize", &cfg.filepopup_pixelsize, TRUE}, | |
345 {"filepopup_delay", &cfg.filepopup_delay, TRUE}, | |
2186 | 346 {"colorize_r", &cfg.colorize_r, TRUE}, |
347 {"colorize_g", &cfg.colorize_g, TRUE}, | |
348 {"colorize_b", &cfg.colorize_b, TRUE}, | |
0 | 349 }; |
350 | |
351 static gint ncfgient = G_N_ELEMENTS(bmp_numents); | |
352 | |
353 static bmp_cfg_strent bmp_strents[] = { | |
354 {"playlist_font", &cfg.playlist_font, TRUE}, | |
355 {"mainwin_font", &cfg.mainwin_font, TRUE}, | |
356 {"eqpreset_default_file", &cfg.eqpreset_default_file, TRUE}, | |
357 {"eqpreset_extension", &cfg.eqpreset_extension, TRUE}, | |
358 {"skin", &cfg.skin, FALSE}, | |
359 {"output_plugin", &cfg.outputplugin, FALSE}, | |
360 {"disabled_iplugins", &cfg.disabled_iplugins, TRUE}, | |
361 {"enabled_gplugins", &cfg.enabled_gplugins, FALSE}, | |
362 {"enabled_vplugins", &cfg.enabled_vplugins, FALSE}, | |
363 {"enabled_eplugins", &cfg.enabled_eplugins, FALSE}, | |
364 {"filesel_path", &cfg.filesel_path, FALSE}, | |
365 {"playlist_path", &cfg.playlist_path, FALSE}, | |
366 {"generic_title_format", &cfg.gentitle_format, TRUE}, | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
367 {"chardet_detector", &cfg.chardet_detector, TRUE}, |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1068
diff
changeset
|
368 {"chardet_fallback", &cfg.chardet_fallback, TRUE}, |
1413 | 369 {"cover_name_include", &cfg.cover_name_include, TRUE}, |
370 {"cover_name_exclude", &cfg.cover_name_exclude, TRUE}, | |
1444
c04ce16b2b57
[svn] - libaudacious/beepctrl.c: optimise further and be more paranoid about leaks
nenolod
parents:
1429
diff
changeset
|
371 {"session_uri_base", &cfg.session_uri_base, TRUE} |
0 | 372 }; |
373 | |
374 static gint ncfgsent = G_N_ELEMENTS(bmp_strents); | |
375 | |
376 gchar *bmp_paths[BMP_PATH_COUNT] = {}; | |
377 | |
378 GList *dock_window_list = NULL; | |
379 | |
380 gboolean pposition_broken = FALSE; | |
381 | |
486 | 382 gboolean starting_up = TRUE; |
0 | 383 |
1883
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
384 /* XXX: case-sensitivity is bad for lazy nenolods. :( -nenolod */ |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
385 static gchar *pl_candidates[] = { |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
386 PLUGIN_FILENAME("ALSA"), |
1886 | 387 PLUGIN_FILENAME("coreaudio"), |
1883
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
388 PLUGIN_FILENAME("OSS"), |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
389 PLUGIN_FILENAME("sun"), |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
390 PLUGIN_FILENAME("ESD"), |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
391 PLUGIN_FILENAME("pulse_audio"), |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
392 PLUGIN_FILENAME("disk_writer"), |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
393 NULL |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
394 }; |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
395 |
2026 | 396 GCond *cond_scan; |
397 GMutex *mutex_scan; | |
398 | |
0 | 399 static GSList * |
400 get_feature_list(void) | |
401 { | |
402 GSList *features = NULL; | |
403 | |
404 #ifdef HAVE_GCONF | |
405 features = g_slist_append(features, "GConf"); | |
406 #endif | |
407 | |
408 return features; | |
409 } | |
410 | |
411 static void | |
412 dump_version(void) | |
413 { | |
414 GSList *features; | |
415 | |
530
1947144093bc
[svn] When running SVN, make a note of the SVN version. The SVN version is stored in build_stamp.c.
nenolod
parents:
486
diff
changeset
|
416 g_printf("%s %s [%s]", _(application_name), VERSION, svn_stamp); |
0 | 417 |
418 features = get_feature_list(); | |
419 | |
420 if (features) { | |
421 GSList *item; | |
422 | |
423 g_printf(" ("); | |
424 | |
425 for (item = features; g_slist_next(item); item = g_slist_next(item)) | |
426 g_printf("%s, ", (const gchar *) item->data); | |
427 | |
428 g_printf("%s)", (const gchar *) item->data); | |
429 | |
430 g_slist_free(features); | |
431 } | |
432 | |
433 g_printf("\n"); | |
434 } | |
435 | |
436 const gchar * | |
437 xmms_get_gentitle_format(void) | |
438 { | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
538
diff
changeset
|
439 guint titlestring_preset = cfg.titlestring_preset; |
0 | 440 |
441 if (titlestring_preset < n_titlestring_presets) | |
442 return bmp_titlestring_presets[titlestring_preset]; | |
443 | |
444 return cfg.gentitle_format; | |
445 } | |
446 | |
887 | 447 void |
0 | 448 make_directory(const gchar * path, mode_t mode) |
449 { | |
450 if (mkdir(path, mode) == 0) | |
451 return; | |
452 | |
453 if (errno == EEXIST) | |
454 return; | |
455 | |
456 g_printerr(_("Could not create directory (%s): %s"), path, | |
457 g_strerror(errno)); | |
458 } | |
459 | |
460 static void | |
461 bmp_make_user_dir(void) | |
462 { | |
463 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
464 | |
465 make_directory(bmp_paths[BMP_PATH_USER_DIR], mode755); | |
466 make_directory(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], mode755); | |
467 make_directory(bmp_paths[BMP_PATH_USER_SKIN_DIR], mode755); | |
468 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
469 } | |
470 | |
471 static void | |
472 bmp_free_paths(void) | |
473 { | |
474 int i; | |
475 | |
476 for (i = 0; i < BMP_PATH_COUNT; i++) | |
477 { | |
478 g_free(bmp_paths[i]); | |
479 bmp_paths[i] = 0; | |
480 } | |
481 } | |
482 | |
483 | |
484 #define USER_PATH(path) \ | |
485 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], path, NULL); | |
486 | |
487 static void | |
488 bmp_init_paths(void) | |
489 { | |
734 | 490 bmp_paths[BMP_PATH_USER_DIR] = g_build_filename(g_get_home_dir(), BMP_RCPATH, NULL); |
0 | 491 |
492 bmp_paths[BMP_PATH_USER_PLUGIN_DIR] = USER_PATH(BMP_USER_PLUGIN_DIR_BASENAME); | |
493 bmp_paths[BMP_PATH_USER_SKIN_DIR] = USER_PATH(BMP_SKIN_DIR_BASENAME); | |
494 bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = USER_PATH(BMP_SKIN_THUMB_DIR_BASENAME); | |
495 bmp_paths[BMP_PATH_CONFIG_FILE] = USER_PATH(BMP_CONFIG_BASENAME); | |
496 bmp_paths[BMP_PATH_PLAYLIST_FILE] = USER_PATH(BMP_PLAYLIST_BASENAME); | |
497 bmp_paths[BMP_PATH_ACCEL_FILE] = USER_PATH(BMP_ACCEL_BASENAME); | |
498 bmp_paths[BMP_PATH_LOG_FILE] = USER_PATH(BMP_LOG_BASENAME); | |
499 | |
500 g_atexit(bmp_free_paths); | |
501 } | |
502 | |
503 | |
504 void | |
505 bmp_config_load(void) | |
506 { | |
507 ConfigDb *db; | |
508 gint i, length; | |
509 | |
510 memcpy(&cfg, &bmp_default_config, sizeof(BmpConfig)); | |
511 | |
512 db = bmp_cfg_db_open(); | |
513 for (i = 0; i < ncfgbent; ++i) { | |
514 bmp_cfg_db_get_bool(db, NULL, | |
515 bmp_boolents[i].be_vname, | |
516 bmp_boolents[i].be_vloc); | |
517 } | |
518 | |
519 for (i = 0; i < ncfgient; ++i) { | |
520 bmp_cfg_db_get_int(db, NULL, | |
521 bmp_numents[i].ie_vname, | |
522 bmp_numents[i].ie_vloc); | |
523 } | |
524 | |
525 for (i = 0; i < ncfgsent; ++i) { | |
526 bmp_cfg_db_get_string(db, NULL, | |
527 bmp_strents[i].se_vname, | |
528 bmp_strents[i].se_vloc); | |
529 } | |
530 | |
531 /* Preset */ | |
532 bmp_cfg_db_get_float(db, NULL, "equalizer_preamp", &cfg.equalizer_preamp); | |
533 for (i = 0; i < 10; i++) { | |
534 gchar eqtext[18]; | |
535 | |
536 g_snprintf(eqtext, sizeof(eqtext), "equalizer_band%d", i); | |
537 bmp_cfg_db_get_float(db, NULL, eqtext, &cfg.equalizer_bands[i]); | |
538 } | |
539 | |
540 /* History */ | |
541 if (bmp_cfg_db_get_int(db, NULL, "url_history_length", &length)) { | |
542 for (i = 1; i <= length; i++) { | |
543 gchar str[19], *tmp; | |
544 | |
545 g_snprintf(str, sizeof(str), "url_history%d", i); | |
546 if (bmp_cfg_db_get_string(db, NULL, str, &tmp)) | |
547 cfg.url_history = g_list_append(cfg.url_history, tmp); | |
548 } | |
549 } | |
550 | |
551 bmp_cfg_db_close(db); | |
552 | |
553 | |
554 if (cfg.playlist_font && strlen(cfg.playlist_font) == 0) { | |
555 g_free(cfg.playlist_font); | |
556 cfg.playlist_font = NULL; | |
557 } | |
558 | |
559 if (cfg.mainwin_font && strlen(cfg.mainwin_font) == 0) { | |
560 g_free(cfg.mainwin_font); | |
561 cfg.mainwin_font = NULL; | |
562 } | |
563 | |
564 if (!cfg.playlist_font) | |
1653 | 565 cfg.playlist_font = g_strdup(PLAYLISTWIN_DEFAULT_FONT); |
0 | 566 |
567 if (!cfg.mainwin_font) | |
1653 | 568 cfg.mainwin_font = g_strdup(MAINWIN_DEFAULT_FONT); |
0 | 569 |
570 if (!cfg.gentitle_format) | |
1347
8a874906535b
[svn] - use a more standard-looking default title format
nenolod
parents:
1283
diff
changeset
|
571 cfg.gentitle_format = g_strdup("%{p:%p - %}%{a:%a - %}%t"); |
0 | 572 |
573 if (!cfg.outputplugin) { | |
1883
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
574 gint iter; |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
575 gchar *pl_path = g_build_filename(PLUGIN_DIR, plugin_dir_list[0], NULL); |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
576 |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
577 for (iter = 0; pl_candidates[iter] != NULL && cfg.outputplugin == NULL; iter++) |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
578 { |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
579 cfg.outputplugin = find_file_recursively(pl_path, pl_candidates[iter]); |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
580 } |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
581 |
5f0266d393b8
[svn] - try to intelligently choose which output plugin is best. candidates are in an null-terminated array, pl_candidates.
nenolod
parents:
1811
diff
changeset
|
582 g_free(pl_path); |
0 | 583 } |
584 | |
585 if (!cfg.eqpreset_default_file) | |
1653 | 586 cfg.eqpreset_default_file = g_strdup(EQUALIZER_DEFAULT_DIR_PRESET); |
0 | 587 |
588 if (!cfg.eqpreset_extension) | |
1653 | 589 cfg.eqpreset_extension = g_strdup(EQUALIZER_DEFAULT_PRESET_EXT); |
1413 | 590 |
1761
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
591 if (!cfg.chardet_fallback) |
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
592 cfg.chardet_fallback = g_strdup(""); |
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
593 |
1413 | 594 if (!cfg.cover_name_include) |
595 cfg.cover_name_include = g_strdup(""); | |
596 | |
597 if (!cfg.cover_name_exclude) | |
598 cfg.cover_name_exclude = g_strdup("back"); | |
1761
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
599 |
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
600 if (!cfg.session_uri_base) |
70caa62ead63
[svn] - fix for "bmp_rcfile_write_string: assertion `value != NULL' failed"
yaz
parents:
1753
diff
changeset
|
601 cfg.session_uri_base = g_strdup(""); |
0 | 602 } |
603 | |
604 | |
605 void | |
606 bmp_config_save(void) | |
607 { | |
608 GList *node; | |
609 gchar *str; | |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
610 gint i, cur_pb_time; |
0 | 611 ConfigDb *db; |
2088 | 612 Playlist *playlist = playlist_get_active(); |
0 | 613 |
614 cfg.disabled_iplugins = input_stringify_disabled_list(); | |
615 | |
616 | |
617 db = bmp_cfg_db_open(); | |
618 | |
619 for (i = 0; i < ncfgbent; ++i) | |
620 if (bmp_boolents[i].be_wrt) | |
621 bmp_cfg_db_set_bool(db, NULL, | |
622 bmp_boolents[i].be_vname, | |
623 *bmp_boolents[i].be_vloc); | |
624 | |
625 for (i = 0; i < ncfgient; ++i) | |
626 if (bmp_numents[i].ie_wrt) | |
627 bmp_cfg_db_set_int(db, NULL, | |
628 bmp_numents[i].ie_vname, | |
629 *bmp_numents[i].ie_vloc); | |
630 | |
631 /* This is a bit lame .. it'll end up being written twice, | |
632 * could do with being done a bit neater. -larne */ | |
633 bmp_cfg_db_set_int(db, NULL, "playlist_position", | |
2088 | 634 playlist_get_position(playlist)); |
0 | 635 |
207
e152a92d3f45
[svn] Save the preference to enable or disable bitmap fonts.
nenolod
parents:
198
diff
changeset
|
636 bmp_cfg_db_set_bool(db, NULL, "mainwin_use_xfont", |
e152a92d3f45
[svn] Save the preference to enable or disable bitmap fonts.
nenolod
parents:
198
diff
changeset
|
637 cfg.mainwin_use_xfont); |
e152a92d3f45
[svn] Save the preference to enable or disable bitmap fonts.
nenolod
parents:
198
diff
changeset
|
638 |
0 | 639 for (i = 0; i < ncfgsent; ++i) { |
640 if (bmp_strents[i].se_wrt) | |
641 bmp_cfg_db_set_string(db, NULL, | |
642 bmp_strents[i].se_vname, | |
643 *bmp_strents[i].se_vloc); | |
644 } | |
645 | |
646 bmp_cfg_db_set_float(db, NULL, "equalizer_preamp", cfg.equalizer_preamp); | |
647 | |
648 for (i = 0; i < 10; i++) { | |
649 str = g_strdup_printf("equalizer_band%d", i); | |
650 bmp_cfg_db_set_float(db, NULL, str, cfg.equalizer_bands[i]); | |
651 g_free(str); | |
652 } | |
653 | |
196 | 654 if (bmp_active_skin != NULL) |
655 { | |
656 if (bmp_active_skin->path) | |
657 bmp_cfg_db_set_string(db, NULL, "skin", bmp_active_skin->path); | |
658 else | |
659 bmp_cfg_db_unset_key(db, NULL, "skin"); | |
660 } | |
0 | 661 |
662 if (get_current_output_plugin()) | |
663 bmp_cfg_db_set_string(db, NULL, "output_plugin", | |
664 get_current_output_plugin()->filename); | |
665 else | |
666 bmp_cfg_db_unset_key(db, NULL, "output_plugin"); | |
667 | |
668 str = general_stringify_enabled_list(); | |
669 if (str) { | |
670 bmp_cfg_db_set_string(db, NULL, "enabled_gplugins", str); | |
671 g_free(str); | |
672 } | |
673 else | |
674 bmp_cfg_db_unset_key(db, NULL, "enabled_gplugins"); | |
675 | |
676 str = vis_stringify_enabled_list(); | |
677 if (str) { | |
678 bmp_cfg_db_set_string(db, NULL, "enabled_vplugins", str); | |
679 g_free(str); | |
680 } | |
681 else | |
682 bmp_cfg_db_unset_key(db, NULL, "enabled_vplugins"); | |
683 | |
684 str = effect_stringify_enabled_list(); | |
685 if (str) { | |
686 bmp_cfg_db_set_string(db, NULL, "enabled_eplugins", str); | |
687 g_free(str); | |
688 } | |
689 else | |
690 bmp_cfg_db_unset_key(db, NULL, "enabled_eplugins"); | |
691 | |
692 if (cfg.filesel_path) | |
693 bmp_cfg_db_set_string(db, NULL, "filesel_path", cfg.filesel_path); | |
694 | |
695 if (cfg.playlist_path) | |
696 bmp_cfg_db_set_string(db, NULL, "playlist_path", cfg.playlist_path); | |
697 | |
698 bmp_cfg_db_set_int(db, NULL, "url_history_length", | |
699 g_list_length(cfg.url_history)); | |
700 | |
701 for (node = cfg.url_history, i = 1; node; node = g_list_next(node), i++) { | |
702 str = g_strdup_printf("url_history%d", i); | |
703 bmp_cfg_db_set_string(db, NULL, str, node->data); | |
704 g_free(str); | |
705 } | |
706 | |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
707 if (bmp_playback_get_playing()) { |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
708 cur_pb_time = bmp_playback_get_time(); |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
709 } else |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
710 cur_pb_time = -1; |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
711 cfg.resume_playback_on_startup_time = cur_pb_time; |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
712 bmp_cfg_db_set_int(db, NULL, "resume_playback_on_startup_time", |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
713 cfg.resume_playback_on_startup_time); |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
714 |
0 | 715 bmp_cfg_db_close(db); |
716 | |
2088 | 717 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); |
0 | 718 } |
719 | |
720 static void | |
721 bmp_set_default_icon(void) | |
722 { | |
723 GdkPixbuf *icon; | |
724 | |
120 | 725 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); |
0 | 726 gtk_window_set_default_icon(icon); |
727 g_object_unref(icon); | |
728 } | |
729 | |
730 static void | |
731 display_usage(void) | |
732 { | |
44 | 733 g_print(_("Usage: audacious [options] [files] ...\n\n" |
0 | 734 "Options:\n" |
735 "--------\n")); | |
736 g_print("\n-h, --help "); | |
737 /* -h, --help switch */ | |
738 g_print(_("Display this text and exit")); | |
739 g_print("\n-n, --session "); | |
740 /* -n, --session switch */ | |
257
256b3acc87d4
[svn] Properly report Audacious instead of XMMS or BMP in all places. Patch by laci; closes bug #379.
chainsaw
parents:
216
diff
changeset
|
741 g_print(_("Select Audacious/BMP/XMMS session (Default: 0)")); |
0 | 742 g_print("\n-r, --rew "); |
743 /* -r, --rew switch */ | |
744 g_print(_("Skip backwards in playlist")); | |
745 g_print("\n-p, --play "); | |
746 /* -p, --play switch */ | |
747 g_print(_("Start playing current playlist")); | |
748 g_print("\n-u, --pause "); | |
749 /* -u, --pause switch */ | |
750 g_print(_("Pause current song")); | |
751 g_print("\n-s, --stop "); | |
752 /* -s, --stop switch */ | |
753 g_print(_("Stop current song")); | |
754 g_print("\n-t, --play-pause "); | |
755 /* -t, --play-pause switch */ | |
756 g_print(_("Pause if playing, play otherwise")); | |
757 g_print("\n-f, --fwd "); | |
758 /* -f, --fwd switch */ | |
759 g_print(_("Skip forward in playlist")); | |
1885
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
760 g_print("\n-j, --show-jump-box "); |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
761 /* -j, --show-jump-box switch */ |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
762 g_print(_("Display Jump to file dialog")); |
0 | 763 g_print("\n-e, --enqueue "); |
764 /* -e, --enqueue switch */ | |
765 g_print(_("Don't clear the playlist")); | |
766 g_print("\n-m, --show-main-window "); | |
767 /* -m, --show-main-window switch */ | |
768 g_print(_("Show the main window")); | |
769 g_print("\n-a, --activate "); | |
770 /* -a, --activate switch */ | |
257
256b3acc87d4
[svn] Properly report Audacious instead of XMMS or BMP in all places. Patch by laci; closes bug #379.
chainsaw
parents:
216
diff
changeset
|
771 g_print(_("Activate Audacious")); |
0 | 772 g_print("\n-i, --sm-client-id "); |
773 /* -i, --sm-client-id switch */ | |
774 g_print(_("Previous session ID")); | |
316
950f104f2e11
[svn] Fix spacing in --help output, patch by Mikachu.
chainsaw
parents:
284
diff
changeset
|
775 g_print("\n-H, --headless "); |
193 | 776 /* -h, --headless switch */ |
777 g_print(_("Headless operation [experimental]")); | |
1348
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
778 g_print("\n-N, --no-log "); |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
779 /* -N, --no-log switch */ |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
780 g_print(_("Disable error/warning interception (logging)")); |
0 | 781 g_print("\n-v, --version "); |
782 /* -v, --version switch */ | |
783 g_print(_("Print version number and exit\n")); | |
784 | |
785 exit(EXIT_SUCCESS); | |
786 } | |
787 | |
788 static void | |
789 parse_cmd_line(gint argc, | |
790 gchar ** argv, | |
791 BmpCmdLineOpt * options) | |
792 { | |
793 static struct option long_options[] = { | |
794 {"help", 0, NULL, 'h'}, | |
795 {"session", 1, NULL, 'n'}, | |
796 {"rew", 0, NULL, 'r'}, | |
797 {"play", 0, NULL, 'p'}, | |
798 {"pause", 0, NULL, 'u'}, | |
799 {"play-pause", 0, NULL, 't'}, | |
800 {"stop", 0, NULL, 's'}, | |
801 {"fwd", 0, NULL, 'f'}, | |
1885
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
802 {"show-jump-box", 0, NULL, 'j'}, |
0 | 803 {"enqueue", 0, NULL, 'e'}, |
2127
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
804 {"enqueue-to-temp", 0, NULL, 'E'}, |
0 | 805 {"show-main-window", 0, NULL, 'm'}, |
806 {"activate", 0, NULL, 'a'}, | |
807 {"version", 0, NULL, 'v'}, | |
808 {"sm-client-id", 1, NULL, 'i'}, | |
809 {"xmms", 0, NULL, 'x'}, | |
191 | 810 {"headless", 0, NULL, 'H'}, |
1348
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
811 {"no-log", 0, NULL, 'N'}, |
0 | 812 {0, 0, 0, 0} |
813 }; | |
814 | |
815 gchar *filename, *current_dir; | |
816 gint c, i; | |
817 | |
818 memset(options, 0, sizeof(BmpCmdLineOpt)); | |
819 options->session = -1; | |
820 | |
2127
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
821 while ((c = getopt_long(argc, argv, "chn:HrpusfemavtLSjE", long_options, |
0 | 822 NULL)) != -1) { |
823 switch (c) { | |
824 case 'h': | |
825 display_usage(); | |
826 break; | |
827 case 'n': | |
828 options->session = atoi(optarg); | |
829 break; | |
191 | 830 case 'H': |
831 options->headless = TRUE; | |
832 break; | |
0 | 833 case 'r': |
834 options->rew = TRUE; | |
835 break; | |
836 case 'p': | |
837 options->play = TRUE; | |
838 break; | |
839 case 'u': | |
840 options->pause = TRUE; | |
841 break; | |
842 case 's': | |
843 options->stop = TRUE; | |
844 break; | |
845 case 'f': | |
846 options->fwd = TRUE; | |
847 break; | |
848 case 't': | |
849 options->play_pause = TRUE; | |
850 break; | |
1885
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
851 case 'j': |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
852 options->show_jump_box = TRUE; |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
853 break; |
0 | 854 case 'm': |
855 options->mainwin = TRUE; | |
856 break; | |
857 case 'a': | |
858 options->activate = TRUE; | |
859 break; | |
2127
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
860 case 'E': |
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
861 options->enqueue_to_temp = TRUE; |
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
862 break; |
0 | 863 case 'e': |
864 options->enqueue = TRUE; | |
865 break; | |
866 case 'v': | |
867 dump_version(); | |
868 exit(EXIT_SUCCESS); | |
869 break; | |
870 case 'i': | |
871 options->previous_session_id = g_strdup(optarg); | |
872 break; | |
873 case 'c': | |
874 options->playcd = TRUE; | |
875 break; | |
876 case 'S': | |
877 options->load_skins = TRUE; | |
878 break; | |
1348
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
879 case 'N': |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
880 options->no_log = TRUE; |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
881 break; |
0 | 882 } |
883 } | |
884 | |
885 current_dir = g_get_current_dir(); | |
886 | |
887 for (i = optind; i < argc; i++) { | |
888 if (argv[i][0] == '/' || strstr(argv[i], "://")) | |
889 filename = g_strdup(argv[i]); | |
890 else | |
891 filename = g_build_filename(current_dir, argv[i], NULL); | |
892 | |
893 options->filenames = g_list_prepend(options->filenames, filename); | |
894 } | |
895 | |
896 options->filenames = g_list_reverse(options->filenames); | |
897 | |
898 g_free(current_dir); | |
899 } | |
900 | |
901 static void | |
902 handle_cmd_line_options(BmpCmdLineOpt * options, | |
903 gboolean remote) | |
904 { | |
905 GList *filenames = options->filenames; | |
906 gint session = options->session; | |
907 | |
908 if (session == -1) { | |
909 if (!remote) | |
910 session = ctrlsocket_get_session_id(); | |
911 else | |
912 session = 0; | |
913 } | |
914 | |
915 if (filenames) { | |
916 gint pos = 0; | |
917 | |
918 if (options->load_skins) { | |
919 xmms_remote_set_skin(session, filenames->data); | |
920 skin_install_skin(filenames->data); | |
921 } | |
922 else { | |
2127
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
923 if (options->enqueue_to_temp) |
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
924 xmms_remote_playlist_enqueue_to_temp(session, filenames->data); |
63af5b9c5026
[svn] - add playlist_select_playlist() to select a literal playlist
nenolod
parents:
2120
diff
changeset
|
925 |
0 | 926 if (options->enqueue && options->play) |
927 pos = xmms_remote_get_playlist_length(session); | |
928 | |
929 if (!options->enqueue) | |
930 xmms_remote_playlist_clear(session); | |
931 | |
932 xmms_remote_playlist_add(session, filenames); | |
933 | |
934 if (options->enqueue && options->play && | |
935 xmms_remote_get_playlist_length(session) > pos) | |
936 xmms_remote_set_playlist_pos(session, pos); | |
937 | |
938 if (!options->enqueue) | |
939 xmms_remote_play(session); | |
940 } | |
941 | |
942 g_list_foreach(filenames, (GFunc) g_free, NULL); | |
943 g_list_free(filenames); | |
944 } | |
945 | |
946 if (options->rew) | |
947 xmms_remote_playlist_prev(session); | |
948 | |
949 if (options->play) | |
950 xmms_remote_play(session); | |
951 | |
952 if (options->pause) | |
953 xmms_remote_pause(session); | |
954 | |
955 if (options->stop) | |
956 xmms_remote_stop(session); | |
957 | |
958 if (options->fwd) | |
959 xmms_remote_playlist_next(session); | |
960 | |
961 if (options->play_pause) | |
962 xmms_remote_play_pause(session); | |
963 | |
1885
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
964 if (options->show_jump_box) |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
965 xmms_remote_show_jtf_box(session); |
1cd683dd944e
[svn] Jump to track window shown when calling audacious with the -j option. Patch by Henrik Johansson <henrik_johansson@home.se>, submitted as Gentoo bug #151260.
chainsaw
parents:
1884
diff
changeset
|
966 |
0 | 967 if (options->mainwin) |
968 xmms_remote_main_win_toggle(session, TRUE); | |
969 | |
970 if (options->activate) | |
971 xmms_remote_activate(session); | |
972 | |
973 if (options->playcd) | |
974 play_medium(); | |
975 } | |
976 | |
977 static void | |
978 bmp_setup_logger(void) | |
979 { | |
980 if (!bmp_logger_start(bmp_paths[BMP_PATH_LOG_FILE])) | |
981 return; | |
982 | |
983 g_atexit(bmp_logger_stop); | |
984 } | |
985 | |
986 static void | |
987 run_load_skin_error_dialog(const gchar * skin_path) | |
988 { | |
989 const gchar *markup = | |
990 N_("<b><big>Unable to load skin.</big></b>\n" | |
991 "\n" | |
992 "Check that skin at '%s' is usable and default skin is properly " | |
993 "installed at '%s'\n"); | |
994 | |
995 GtkWidget *dialog = | |
996 gtk_message_dialog_new_with_markup(NULL, | |
997 GTK_DIALOG_MODAL, | |
998 GTK_MESSAGE_ERROR, | |
999 GTK_BUTTONS_CLOSE, | |
1000 _(markup), | |
1001 skin_path, | |
1002 BMP_DEFAULT_SKIN_PATH); | |
1003 gtk_dialog_run(GTK_DIALOG(dialog)); | |
1004 gtk_widget_destroy(dialog); | |
1005 } | |
1006 | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1007 // use a format string? |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1008 void report_error(const gchar *error_text) |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1009 { |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1010 fprintf(stderr,error_text); |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1011 if (options.headless!=1) { |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
781
diff
changeset
|
1012 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), |
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
781
diff
changeset
|
1013 error_text); |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1014 gtk_dialog_run(GTK_DIALOG(err)); |
813
c8cf439179b8
[svn] - Fix a ton and a half of memory leaks, via the wonderful Leonardo Boshell <leonardop -at- gentoo.org>.
nenolod
parents:
781
diff
changeset
|
1015 gtk_widget_hide(err); |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1016 } |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1017 } |
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1018 |
0 | 1019 gint |
1020 main(gint argc, gchar ** argv) | |
1021 { | |
44 | 1022 gboolean gtk_init_check_ok; |
2088 | 1023 Playlist *playlist; |
0 | 1024 |
1025 /* Setup l10n early so we can print localized error messages */ | |
1026 gtk_set_locale(); | |
749 | 1027 bindtextdomain(PACKAGE_NAME, LOCALEDIR); |
1028 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | |
1029 textdomain(PACKAGE_NAME); | |
0 | 1030 |
1031 bmp_init_paths(); | |
1032 bmp_make_user_dir(); | |
1033 | |
1034 /* Check GTK version. Really, this is only needed for binary | |
1035 * distribution since configure already checks. */ | |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1036 if (!GTK_CHECK_VERSION(2, 6, 0)) { |
257
256b3acc87d4
[svn] Properly report Audacious instead of XMMS or BMP in all places. Patch by laci; closes bug #379.
chainsaw
parents:
216
diff
changeset
|
1037 g_printerr(_("Sorry, your GTK+ version (%d.%d.%d) does not work with Audacious.\n" |
0 | 1038 "Please use GTK+ %s or newer.\n"), |
1039 gtk_major_version, gtk_minor_version, gtk_micro_version, | |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1040 "2.6.0"); |
0 | 1041 exit(EXIT_FAILURE); |
1042 } | |
1043 | |
1044 g_set_application_name(_(application_name)); | |
1045 | |
1046 g_thread_init(NULL); | |
1047 if (!g_thread_supported()) { | |
1048 g_printerr(_("Sorry, threads isn't supported on your platform.\n\n" | |
1049 "If you're on a libc5 based linux system and installed Glib & GTK+ before you\n" | |
1050 "installed LinuxThreads you need to recompile Glib & GTK+.\n")); | |
1051 exit(EXIT_FAILURE); | |
1052 } | |
1053 | |
1054 gdk_threads_init(); | |
1055 | |
2026 | 1056 cond_scan = g_cond_new(); |
1057 mutex_scan = g_mutex_new(); | |
1058 | |
44 | 1059 gtk_init_check_ok = gtk_init_check(&argc, &argv); |
1060 /* Now let's parse the command line options first. */ | |
1061 parse_cmd_line(argc, argv, &options); | |
1062 if (!gtk_init_check_ok) { | |
0 | 1063 if (argc < 2) { |
1064 /* GTK check failed, and no arguments passed to indicate | |
1065 that user is intending to only remote control a running | |
1066 session */ | |
44 | 1067 g_printerr(_("audacious: Unable to open display, exiting.\n")); |
0 | 1068 exit(EXIT_FAILURE); |
1069 } | |
1070 | |
1071 handle_cmd_line_options(&options, TRUE); | |
191 | 1072 |
1073 /* we could be running headless, so GTK probably wont matter */ | |
1074 if (options.headless != 1) | |
1075 exit(EXIT_SUCCESS); | |
0 | 1076 } |
1077 | |
1348
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
1078 if (options.no_log == FALSE) |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
1079 bmp_setup_logger(); |
cc57f7545876
[svn] - add --no-log switch to disable the system logger (and instead dump to stdout)
nenolod
parents:
1347
diff
changeset
|
1080 |
2156
a792aaee8e8e
[svn] - new signal handling which does not block (based on concept from BMP 0.9.8 that never got released)
nenolod
parents:
2146
diff
changeset
|
1081 signal_handlers_init(); |
0 | 1082 |
1083 g_random_set_seed(time(NULL)); | |
1084 | |
1085 bmp_config_load(); | |
1086 | |
1087 if (options.session != -1 || !ctrlsocket_setup()) { | |
1088 handle_cmd_line_options(&options, TRUE); | |
1089 exit(EXIT_SUCCESS); | |
1090 } | |
1091 | |
2003
74f280120233
[svn] - init plugins before initalizing the skin system.
nenolod
parents:
2000
diff
changeset
|
1092 plugin_system_init(); |
74f280120233
[svn] - init plugins before initalizing the skin system.
nenolod
parents:
2000
diff
changeset
|
1093 |
2120
1d67cf383e32
[svn] - dynamically allocate the playlist at startup and fix some lingering improper uses of playlist_get()
nenolod
parents:
2113
diff
changeset
|
1094 /* Initialize the playlist system. */ |
1d67cf383e32
[svn] - dynamically allocate the playlist at startup and fix some lingering improper uses of playlist_get()
nenolod
parents:
2113
diff
changeset
|
1095 playlist_init(); |
1d67cf383e32
[svn] - dynamically allocate the playlist at startup and fix some lingering improper uses of playlist_get()
nenolod
parents:
2113
diff
changeset
|
1096 |
191 | 1097 if (options.headless != 1) |
1098 { | |
781
12c47704b4b5
[svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents:
749
diff
changeset
|
1099 |
191 | 1100 bmp_set_default_icon(); |
0 | 1101 |
191 | 1102 gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]); |
0 | 1103 |
1810 | 1104 if (!init_skins(cfg.skin)) { |
1105 run_load_skin_error_dialog(cfg.skin); | |
1106 exit(EXIT_FAILURE); | |
1107 } | |
1108 | |
191 | 1109 GDK_THREADS_ENTER(); |
0 | 1110 } |
1111 | |
2120
1d67cf383e32
[svn] - dynamically allocate the playlist at startup and fix some lingering improper uses of playlist_get()
nenolod
parents:
2113
diff
changeset
|
1112 /* Load the default playlist in. */ |
2088 | 1113 playlist = playlist_get_active(); |
1114 playlist_load(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
1115 playlist_set_position(playlist, cfg.playlist_position); | |
0 | 1116 |
1117 /* this needs to be called after all 3 windows are created and | |
191 | 1118 * input plugins are setup'ed |
1119 * but not if we're running headless --nenolod | |
1120 */ | |
0 | 1121 mainwin_setup_menus(); |
1122 | |
191 | 1123 if (options.headless != 1) |
1124 GDK_THREADS_LEAVE(); | |
0 | 1125 |
1126 ctrlsocket_start(); | |
1127 | |
1128 handle_cmd_line_options(&options, FALSE); | |
1129 | |
191 | 1130 if (options.headless != 1) |
1131 { | |
1132 GDK_THREADS_ENTER(); | |
0 | 1133 |
191 | 1134 read_volume(VOLSET_STARTUP); |
1135 mainwin_set_info_text(); | |
1136 | |
1137 /* FIXME: delayed, because it deals directly with the plugin | |
1138 * interface to set menu items */ | |
1139 create_prefs_window(); | |
0 | 1140 |
1264 | 1141 create_fileinfo_window(); |
1283
19b1d3f22e10
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
nenolod
parents:
1264
diff
changeset
|
1142 create_filepopup_window(); |
1264 | 1143 |
191 | 1144 if (cfg.player_visible) |
1145 mainwin_show(TRUE); | |
1146 else if (!cfg.playlist_visible && !cfg.equalizer_visible) | |
1147 mainwin_show(TRUE); | |
125 | 1148 |
191 | 1149 if (cfg.equalizer_visible) |
1150 equalizerwin_show(TRUE); | |
1151 | |
1152 if (cfg.playlist_visible) | |
1153 playlistwin_show(); | |
0 | 1154 |
191 | 1155 hint_set_always(cfg.always_on_top); |
0 | 1156 |
191 | 1157 playlist_start_get_info_thread(); |
1158 mainwin_attach_idle_func(); | |
1159 | |
486 | 1160 starting_up = FALSE; |
1161 | |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1162 has_x11_connection = TRUE; |
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1163 |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1164 if (cfg.resume_playback_on_startup) { |
2088 | 1165 if (cfg.resume_playback_on_startup_time != -1 && playlist_get_length(playlist) > 0) { |
1659
eeaf62b288a3
[svn] Make the playback resume code a lot more robust.
chainsaw
parents:
1653
diff
changeset
|
1166 int i; |
1753
01df1ea5feae
[svn] Mute while seeking for playback resume, tighten the loop. We want a responsive GUI ASAP.
chainsaw
parents:
1710
diff
changeset
|
1167 gint l=0, r=0; |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1168 while (gtk_events_pending()) gtk_main_iteration(); |
1753
01df1ea5feae
[svn] Mute while seeking for playback resume, tighten the loop. We want a responsive GUI ASAP.
chainsaw
parents:
1710
diff
changeset
|
1169 output_get_volume(&l, &r); |
01df1ea5feae
[svn] Mute while seeking for playback resume, tighten the loop. We want a responsive GUI ASAP.
chainsaw
parents:
1710
diff
changeset
|
1170 output_set_volume(0,0); |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1171 bmp_playback_initiate(); |
1966
fcf3900d05b9
[svn] - temporarily display the newui at startup along with the oldui
nenolod
parents:
1959
diff
changeset
|
1172 |
fcf3900d05b9
[svn] - temporarily display the newui at startup along with the oldui
nenolod
parents:
1959
diff
changeset
|
1173 /* Busy wait; loop is fairly tight to minimize duration of "frozen" GUI. Feel free to |
fcf3900d05b9
[svn] - temporarily display the newui at startup along with the oldui
nenolod
parents:
1959
diff
changeset
|
1174 * tune. --chainsaw |
fcf3900d05b9
[svn] - temporarily display the newui at startup along with the oldui
nenolod
parents:
1959
diff
changeset
|
1175 */ |
fcf3900d05b9
[svn] - temporarily display the newui at startup along with the oldui
nenolod
parents:
1959
diff
changeset
|
1176 for (i = 0; i < 20; i++) { |
1753
01df1ea5feae
[svn] Mute while seeking for playback resume, tighten the loop. We want a responsive GUI ASAP.
chainsaw
parents:
1710
diff
changeset
|
1177 g_usleep(1000); |
1659
eeaf62b288a3
[svn] Make the playback resume code a lot more robust.
chainsaw
parents:
1653
diff
changeset
|
1178 if (!ip_data.playing) |
eeaf62b288a3
[svn] Make the playback resume code a lot more robust.
chainsaw
parents:
1653
diff
changeset
|
1179 break; |
eeaf62b288a3
[svn] Make the playback resume code a lot more robust.
chainsaw
parents:
1653
diff
changeset
|
1180 } |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1181 bmp_playback_seek(cfg.resume_playback_on_startup_time / |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1182 1000); |
1753
01df1ea5feae
[svn] Mute while seeking for playback resume, tighten the loop. We want a responsive GUI ASAP.
chainsaw
parents:
1710
diff
changeset
|
1183 output_set_volume(l, r); |
998
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1184 } |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1185 } |
8c6949ffd7f8
[svn] Support for saving the playback state, and resuming playback after restart. Patch by cha0smaster, closes bug #479.
chainsaw
parents:
946
diff
changeset
|
1186 |
191 | 1187 gtk_main(); |
1188 | |
1189 GDK_THREADS_LEAVE(); | |
0 | 1190 |
2026 | 1191 g_cond_free(cond_scan); |
1192 g_mutex_free(mutex_scan); | |
1193 | |
191 | 1194 return EXIT_SUCCESS; |
1195 } | |
1196 else | |
1197 { | |
1198 mainwin_set_info_text(); | |
1199 playlist_start_get_info_thread(); | |
0 | 1200 |
486 | 1201 starting_up = FALSE; |
1202 | |
191 | 1203 for (;;) |
192
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1204 { |
197
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
1205 /* headless eventloop */ |
ccd034857702
[svn] Split up generic events into audcore_generic_events(), and client-specific stuff remains in mainwin_idle_func().
nenolod
parents:
196
diff
changeset
|
1206 audcore_generic_events(); |
198 | 1207 free_vis_data(); /* to prevent buffer overflow -- paranoia */ |
191 | 1208 xmms_usleep(10000); |
192
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1209 } |
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1210 |
191 | 1211 return EXIT_SUCCESS; |
1212 } | |
0 | 1213 } |