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