Mercurial > audlegacy
annotate audacious/main.c @ 729:f5457b6cdc0e trunk
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
author | nenolod |
---|---|
date | Mon, 27 Feb 2006 08:32:57 -0800 |
parents | 8282b365f6cb |
children | 9a5075ce88a8 |
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 | |
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
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> | |
46 #include <gdk/gdkx.h> | |
47 #include <X11/Xlib.h> | |
48 #include <X11/Xatom.h> | |
49 | |
50 #include "libaudacious/configdb.h" | |
51 #include "libaudacious/beepctrl.h" | |
52 #include "libaudacious/util.h" | |
53 #include "libaudacious/vfs.h" | |
54 | |
55 #include "controlsocket.h" | |
56 #include "dnd.h" | |
57 #include "dock.h" | |
58 #include "effect.h" | |
59 #include "equalizer.h" | |
60 #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
|
61 #include "genevent.h" |
0 | 62 #include "hints.h" |
63 #include "input.h" | |
64 #include "logger.h" | |
65 #include "mainwin.h" | |
66 #include "output.h" | |
538
e4e897d20791
[svn] remove libaudcore, we never did anything with it
nenolod
parents:
534
diff
changeset
|
67 #include "playback.h" |
0 | 68 #include "playlist.h" |
383 | 69 #include "ui_playlist.h" |
0 | 70 #include "pluginenum.h" |
71 #include "prefswin.h" | |
72 #include "skin.h" | |
73 #include "skinwin.h" | |
74 #include "util.h" | |
75 #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
|
76 #include "build_stamp.h" |
0 | 77 |
78 #include "pixmaps.h" | |
120 | 79 #include "images/audacious_player.xpm" |
0 | 80 |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
81 gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ |
0 | 82 |
83 /* Translatable string for beep.desktop's comment field */ | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
84 const gchar *desktop_comment = N_("Audacious"); |
0 | 85 |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
86 const gchar *application_name = N_("Audacious"); |
0 | 87 |
88 | |
89 struct _BmpCmdLineOpt { | |
90 GList *filenames; | |
91 gint session; | |
92 gboolean play, stop, pause, fwd, rew, play_pause, playcd; | |
93 gboolean enqueue, mainwin, remote, activate; | |
94 gboolean load_skins; | |
191 | 95 gboolean headless; |
0 | 96 gchar *previous_session_id; |
97 }; | |
98 | |
99 typedef struct _BmpCmdLineOpt BmpCmdLineOpt; | |
100 | |
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 */ | |
143 TRUE, /* UNUSED (smooth title scrolling) */ | |
144 TRUE, /* use playlist metadata */ | |
145 TRUE, /* warn about unplayables */ | |
146 FALSE, /* use \ as directory delimiter */ | |
147 FALSE, /* random skin on play */ | |
148 FALSE, /* use fontsets */ | |
149 FALSE, /* use X font for mainwin */ | |
150 TRUE, /* use custom cursors */ | |
151 TRUE, /* close dialog on open */ | |
152 TRUE, /* close dialog on add */ | |
153 0.0, /* equalizer preamp */ | |
154 {0, 0, 0, 0, 0, /* equalizer bands */ | |
155 0, 0, 0, 0, 0}, | |
156 NULL, /* skin */ | |
157 NULL, /* output plugin */ | |
158 NULL, /* file selector path */ | |
159 NULL, /* playlist path */ | |
160 NULL, /* playlist font */ | |
161 NULL, /* mainwin font */ | |
162 NULL, /* disabled input plugins */ | |
163 NULL, /* enabled general plugins */ | |
164 NULL, /* enabled visualization plugins */ | |
165 NULL, /* enabled effect plugins */ | |
166 NULL, /* equalizer preset default file */ | |
167 NULL, /* equalizer preset extension */ | |
168 NULL, /* URL history */ | |
169 0, /* timer mode */ | |
170 VIS_ANALYZER, /* visualizer type */ | |
171 ANALYZER_NORMAL, /* analyzer mode */ | |
172 ANALYZER_BARS, /* analyzer type */ | |
173 SCOPE_DOT, /* scope mode */ | |
174 VU_SMOOTH, /* VU mode */ | |
175 REFRESH_FULL, /* visualizer refresh rate */ | |
176 FALLOFF_FAST, /* analyzer fall off rate */ | |
177 FALLOFF_SLOW, /* peaks fall off rate */ | |
178 0, /* playlist position */ | |
179 2, /* pause between songs time */ | |
180 FALSE, /* pause between songs */ | |
181 FALSE, /* show window decorations */ | |
182 8, /* mouse wheel scroll step */ | |
183 FALSE, /* playlist transparent */ | |
534
ba0608cbbdaa
[svn] artist - album - title is now the default title format.
nenolod
parents:
530
diff
changeset
|
184 2, /* 2nd preset (ARTIST - TITLE) */ |
0 | 185 NULL, /* title format */ |
186 FALSE, /* software volume control enabled */ | |
187 TRUE, /* UNUSED (XMMS compatibility mode) */ | |
188 TRUE, /* extra eq filtering */ | |
189 3 /* scroll pl by */ | |
190 }; | |
191 | |
192 typedef struct bmp_cfg_boolent_t { | |
193 char const *be_vname; | |
194 gboolean *be_vloc; | |
195 gboolean be_wrt; | |
196 } bmp_cfg_boolent; | |
197 | |
198 typedef struct bmp_cfg_nument_t { | |
199 char const *ie_vname; | |
200 gint *ie_vloc; | |
201 gboolean ie_wrt; | |
202 } bmp_cfg_nument; | |
203 | |
204 typedef struct bmp_cfg_strent_t { | |
205 char const *se_vname; | |
206 char **se_vloc; | |
207 gboolean se_wrt; | |
208 } bmp_cfg_strent; | |
209 | |
210 const gchar *bmp_titlestring_presets[] = { | |
211 "%t", | |
212 "%p - %t", | |
213 "%p - %a - %t", | |
214 "%a - %t" | |
215 }; | |
216 | |
217 const guint n_titlestring_presets = G_N_ELEMENTS(bmp_titlestring_presets); | |
218 | |
219 static bmp_cfg_boolent bmp_boolents[] = { | |
220 {"allow_multiple_instances", &cfg.allow_multiple_instances, TRUE}, | |
221 {"use_realtime", &cfg.use_realtime, TRUE}, | |
222 {"always_show_cb", &cfg.always_show_cb, TRUE}, | |
223 {"convert_underscore", &cfg.convert_underscore, TRUE}, | |
224 {"convert_twenty", &cfg.convert_twenty, TRUE}, | |
225 {"show_numbers_in_pl", &cfg.show_numbers_in_pl, TRUE}, | |
226 {"snap_windows", &cfg.snap_windows, TRUE}, | |
227 {"save_window_positions", &cfg.save_window_position, TRUE}, | |
228 {"dim_titlebar", &cfg.dim_titlebar, TRUE}, | |
229 {"get_info_on_load", &cfg.get_info_on_load, TRUE}, | |
230 {"get_info_on_demand", &cfg.get_info_on_demand, TRUE}, | |
231 {"no_playlist_advance", &cfg.no_playlist_advance, TRUE}, | |
232 {"sort_jump_to_file", &cfg.sort_jump_to_file, TRUE}, | |
233 {"use_pl_metadata", &cfg.use_pl_metadata, TRUE}, | |
234 {"warn_about_unplayables", &cfg.warn_about_unplayables, TRUE}, | |
235 {"use_backslash_as_dir_delimiter", &cfg.use_backslash_as_dir_delimiter, TRUE}, | |
236 {"player_shaded", &cfg.player_shaded, TRUE}, | |
237 {"player_visible", &cfg.player_visible, TRUE}, | |
238 {"shuffle", &cfg.shuffle, TRUE}, | |
239 {"repeat", &cfg.repeat, TRUE}, | |
240 {"autoscroll_songname", &cfg.autoscroll, TRUE}, | |
241 {"playlist_shaded", &cfg.playlist_shaded, TRUE}, | |
242 {"playlist_visible", &cfg.playlist_visible, TRUE}, | |
243 {"playlist_transparent", &cfg.playlist_transparent, TRUE}, | |
244 {"use_fontsets", &cfg.use_fontsets, TRUE}, | |
85
8c8a20f72ace
[svn] s/static GTKItemFactoryEntry/GTKItemFactoryEntry/g.
nenolod
parents:
80
diff
changeset
|
245 {"mainwin_use_xfont", &cfg.mainwin_use_xfont, FALSE}, |
0 | 246 {"equalizer_visible", &cfg.equalizer_visible, TRUE}, |
247 {"equalizer_active", &cfg.equalizer_active, TRUE}, | |
248 {"equalizer_shaded", &cfg.equalizer_shaded, TRUE}, | |
249 {"equalizer_autoload", &cfg.equalizer_autoload, TRUE}, | |
250 {"use_eplugins", &cfg.use_eplugins, TRUE}, | |
251 {"always_on_top", &cfg.always_on_top, TRUE}, | |
252 {"sticky", &cfg.sticky, TRUE}, | |
253 {"random_skin_on_play", &cfg.random_skin_on_play, TRUE}, | |
254 {"pause_between_songs", &cfg.pause_between_songs, TRUE}, | |
255 {"show_wm_decorations", &cfg.show_wm_decorations, TRUE}, | |
256 {"eq_extra_filtering", &cfg.eq_extra_filtering, TRUE}, | |
257 {"analyzer_peaks", &cfg.analyzer_peaks, TRUE}, | |
258 {"custom_cursors", &cfg.custom_cursors, TRUE}, | |
259 {"close_dialog_open", &cfg.close_dialog_open, TRUE}, | |
260 {"close_dialog_add", &cfg.close_dialog_add, TRUE} | |
261 }; | |
262 | |
263 static gint ncfgbent = G_N_ELEMENTS(bmp_boolents); | |
264 | |
265 static bmp_cfg_nument bmp_numents[] = { | |
266 {"player_x", &cfg.player_x, TRUE}, | |
267 {"player_y", &cfg.player_y, TRUE}, | |
268 {"timer_mode", &cfg.timer_mode, TRUE}, | |
269 {"vis_type", &cfg.vis_type, TRUE}, | |
270 {"analyzer_mode", &cfg.analyzer_mode, TRUE}, | |
271 {"analyzer_type", &cfg.analyzer_type, TRUE}, | |
272 {"scope_mode", &cfg.scope_mode, TRUE}, | |
273 {"vu_mode", &cfg.vu_mode, TRUE}, | |
274 {"vis_refresh_rate", &cfg.vis_refresh, TRUE}, | |
275 {"analyzer_falloff", &cfg.analyzer_falloff, TRUE}, | |
276 {"peaks_falloff", &cfg.peaks_falloff, TRUE}, | |
277 {"playlist_x", &cfg.playlist_x, TRUE}, | |
278 {"playlist_y", &cfg.playlist_y, TRUE}, | |
279 {"playlist_width", &cfg.playlist_width, TRUE}, | |
280 {"playlist_height", &cfg.playlist_height, TRUE}, | |
281 {"playlist_position", &cfg.playlist_position, TRUE}, | |
282 {"equalizer_x", &cfg.equalizer_x, TRUE}, | |
283 {"equalizer_y", &cfg.equalizer_y, TRUE}, | |
284 {"snap_distance", &cfg.snap_distance, TRUE}, | |
285 {"pause_between_songs_time", &cfg.pause_between_songs_time, TRUE}, | |
286 {"mouse_wheel_change", &cfg.mouse_change, TRUE}, | |
287 {"scroll_pl_by", &cfg.scroll_pl_by, TRUE}, | |
288 {"titlestring_preset", &cfg.titlestring_preset, TRUE}, | |
289 }; | |
290 | |
291 static gint ncfgient = G_N_ELEMENTS(bmp_numents); | |
292 | |
293 static bmp_cfg_strent bmp_strents[] = { | |
294 {"playlist_font", &cfg.playlist_font, TRUE}, | |
295 {"mainwin_font", &cfg.mainwin_font, TRUE}, | |
296 {"eqpreset_default_file", &cfg.eqpreset_default_file, TRUE}, | |
297 {"eqpreset_extension", &cfg.eqpreset_extension, TRUE}, | |
298 {"skin", &cfg.skin, FALSE}, | |
299 {"output_plugin", &cfg.outputplugin, FALSE}, | |
300 {"disabled_iplugins", &cfg.disabled_iplugins, TRUE}, | |
301 {"enabled_gplugins", &cfg.enabled_gplugins, FALSE}, | |
302 {"enabled_vplugins", &cfg.enabled_vplugins, FALSE}, | |
303 {"enabled_eplugins", &cfg.enabled_eplugins, FALSE}, | |
304 {"filesel_path", &cfg.filesel_path, FALSE}, | |
305 {"playlist_path", &cfg.playlist_path, FALSE}, | |
306 {"generic_title_format", &cfg.gentitle_format, TRUE}, | |
307 }; | |
308 | |
309 static gint ncfgsent = G_N_ELEMENTS(bmp_strents); | |
310 | |
311 gchar *bmp_paths[BMP_PATH_COUNT] = {}; | |
312 | |
313 GList *dock_window_list = NULL; | |
314 | |
315 gboolean pposition_broken = FALSE; | |
316 | |
486 | 317 gboolean starting_up = TRUE; |
0 | 318 |
319 static GSList * | |
320 get_feature_list(void) | |
321 { | |
322 GSList *features = NULL; | |
323 | |
324 #ifdef HAVE_GNOME_VFS | |
325 features = g_slist_append(features, "GNOME VFS"); | |
326 #endif | |
327 | |
328 #ifdef HAVE_GCONF | |
329 features = g_slist_append(features, "GConf"); | |
330 #endif | |
331 | |
332 return features; | |
333 } | |
334 | |
335 static void | |
336 dump_version(void) | |
337 { | |
338 GSList *features; | |
339 | |
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
|
340 g_printf("%s %s [%s]", _(application_name), VERSION, svn_stamp); |
0 | 341 |
342 features = get_feature_list(); | |
343 | |
344 if (features) { | |
345 GSList *item; | |
346 | |
347 g_printf(" ("); | |
348 | |
349 for (item = features; g_slist_next(item); item = g_slist_next(item)) | |
350 g_printf("%s, ", (const gchar *) item->data); | |
351 | |
352 g_printf("%s)", (const gchar *) item->data); | |
353 | |
354 g_slist_free(features); | |
355 } | |
356 | |
357 g_printf("\n"); | |
358 } | |
359 | |
360 const gchar * | |
361 xmms_get_gentitle_format(void) | |
362 { | |
625
0a73d1faeb4e
[svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents:
538
diff
changeset
|
363 guint titlestring_preset = cfg.titlestring_preset; |
0 | 364 |
365 if (titlestring_preset < n_titlestring_presets) | |
366 return bmp_titlestring_presets[titlestring_preset]; | |
367 | |
368 return cfg.gentitle_format; | |
369 } | |
370 | |
371 static void | |
372 make_directory(const gchar * path, mode_t mode) | |
373 { | |
374 if (mkdir(path, mode) == 0) | |
375 return; | |
376 | |
377 if (errno == EEXIST) | |
378 return; | |
379 | |
380 g_printerr(_("Could not create directory (%s): %s"), path, | |
381 g_strerror(errno)); | |
382 } | |
383 | |
384 static void | |
385 bmp_make_user_dir(void) | |
386 { | |
387 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
388 | |
389 make_directory(bmp_paths[BMP_PATH_USER_DIR], mode755); | |
390 make_directory(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], mode755); | |
391 make_directory(bmp_paths[BMP_PATH_USER_SKIN_DIR], mode755); | |
392 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
393 } | |
394 | |
395 static void | |
396 bmp_free_paths(void) | |
397 { | |
398 int i; | |
399 | |
400 for (i = 0; i < BMP_PATH_COUNT; i++) | |
401 { | |
402 g_free(bmp_paths[i]); | |
403 bmp_paths[i] = 0; | |
404 } | |
405 } | |
406 | |
407 | |
408 #define USER_PATH(path) \ | |
409 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], path, NULL); | |
410 | |
411 static void | |
412 bmp_init_paths(void) | |
413 { | |
729
f5457b6cdc0e
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
nenolod
parents:
680
diff
changeset
|
414 gchar *home_dir = g_get_home_dir(); |
f5457b6cdc0e
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
nenolod
parents:
680
diff
changeset
|
415 |
f5457b6cdc0e
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
nenolod
parents:
680
diff
changeset
|
416 bmp_paths[BMP_PATH_USER_DIR] = g_build_filename(home_dir, BMP_RCPATH, NULL); |
f5457b6cdc0e
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
nenolod
parents:
680
diff
changeset
|
417 |
f5457b6cdc0e
[svn] - memleak fix (noticed by HopeSeekr @ efnet #xmule)
nenolod
parents:
680
diff
changeset
|
418 g_free(home_dir); |
0 | 419 |
420 bmp_paths[BMP_PATH_USER_PLUGIN_DIR] = USER_PATH(BMP_USER_PLUGIN_DIR_BASENAME); | |
421 bmp_paths[BMP_PATH_USER_SKIN_DIR] = USER_PATH(BMP_SKIN_DIR_BASENAME); | |
422 bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = USER_PATH(BMP_SKIN_THUMB_DIR_BASENAME); | |
423 bmp_paths[BMP_PATH_CONFIG_FILE] = USER_PATH(BMP_CONFIG_BASENAME); | |
424 bmp_paths[BMP_PATH_PLAYLIST_FILE] = USER_PATH(BMP_PLAYLIST_BASENAME); | |
425 bmp_paths[BMP_PATH_ACCEL_FILE] = USER_PATH(BMP_ACCEL_BASENAME); | |
426 bmp_paths[BMP_PATH_LOG_FILE] = USER_PATH(BMP_LOG_BASENAME); | |
427 | |
428 g_atexit(bmp_free_paths); | |
429 } | |
430 | |
431 | |
432 void | |
433 bmp_config_load(void) | |
434 { | |
435 ConfigDb *db; | |
436 gint i, length; | |
437 | |
438 memcpy(&cfg, &bmp_default_config, sizeof(BmpConfig)); | |
439 | |
440 db = bmp_cfg_db_open(); | |
441 for (i = 0; i < ncfgbent; ++i) { | |
442 bmp_cfg_db_get_bool(db, NULL, | |
443 bmp_boolents[i].be_vname, | |
444 bmp_boolents[i].be_vloc); | |
445 } | |
446 | |
447 for (i = 0; i < ncfgient; ++i) { | |
448 bmp_cfg_db_get_int(db, NULL, | |
449 bmp_numents[i].ie_vname, | |
450 bmp_numents[i].ie_vloc); | |
451 } | |
452 | |
453 for (i = 0; i < ncfgsent; ++i) { | |
454 bmp_cfg_db_get_string(db, NULL, | |
455 bmp_strents[i].se_vname, | |
456 bmp_strents[i].se_vloc); | |
457 } | |
458 | |
459 /* Preset */ | |
460 bmp_cfg_db_get_float(db, NULL, "equalizer_preamp", &cfg.equalizer_preamp); | |
461 for (i = 0; i < 10; i++) { | |
462 gchar eqtext[18]; | |
463 | |
464 g_snprintf(eqtext, sizeof(eqtext), "equalizer_band%d", i); | |
465 bmp_cfg_db_get_float(db, NULL, eqtext, &cfg.equalizer_bands[i]); | |
466 } | |
467 | |
468 /* History */ | |
469 if (bmp_cfg_db_get_int(db, NULL, "url_history_length", &length)) { | |
470 for (i = 1; i <= length; i++) { | |
471 gchar str[19], *tmp; | |
472 | |
473 g_snprintf(str, sizeof(str), "url_history%d", i); | |
474 if (bmp_cfg_db_get_string(db, NULL, str, &tmp)) | |
475 cfg.url_history = g_list_append(cfg.url_history, tmp); | |
476 } | |
477 } | |
478 | |
479 bmp_cfg_db_close(db); | |
480 | |
481 | |
482 if (cfg.playlist_font && strlen(cfg.playlist_font) == 0) { | |
483 g_free(cfg.playlist_font); | |
484 cfg.playlist_font = NULL; | |
485 } | |
486 | |
487 if (cfg.mainwin_font && strlen(cfg.mainwin_font) == 0) { | |
488 g_free(cfg.mainwin_font); | |
489 cfg.mainwin_font = NULL; | |
490 } | |
491 | |
492 if (!cfg.playlist_font) | |
493 cfg.playlist_font = g_strdup(PLAYLISTWIN_DEFAULT_FONT); | |
494 | |
495 if (!cfg.mainwin_font) | |
496 cfg.mainwin_font = g_strdup(MAINWIN_DEFAULT_FONT); | |
497 | |
498 if (!cfg.gentitle_format) | |
534
ba0608cbbdaa
[svn] artist - album - title is now the default title format.
nenolod
parents:
530
diff
changeset
|
499 cfg.gentitle_format = g_strdup("%p - %a - %t"); |
0 | 500 |
501 if (!cfg.outputplugin) { | |
502 #ifdef HAVE_OSS | |
503 cfg.outputplugin = g_build_filename(PLUGIN_DIR, plugin_dir_list[0], | |
504 PLUGIN_FILENAME("OSS"), NULL); | |
505 #else | |
506 /* FIXME: This implicitly means the output plugin that is | |
507 * first in the alphabet will be used (usually the disk writer | |
508 * plugin) */ | |
509 cfg.outputplugin = g_strdup(""); | |
510 #endif | |
511 } | |
512 | |
513 if (!cfg.eqpreset_default_file) | |
514 cfg.eqpreset_default_file = g_strdup(EQUALIZER_DEFAULT_DIR_PRESET); | |
515 | |
516 if (!cfg.eqpreset_extension) | |
517 cfg.eqpreset_extension = g_strdup(EQUALIZER_DEFAULT_PRESET_EXT); | |
518 } | |
519 | |
520 | |
521 void | |
522 bmp_config_save(void) | |
523 { | |
524 GList *node; | |
525 gchar *str; | |
526 gint i; | |
527 ConfigDb *db; | |
528 | |
529 cfg.disabled_iplugins = input_stringify_disabled_list(); | |
530 | |
531 | |
532 db = bmp_cfg_db_open(); | |
533 | |
534 for (i = 0; i < ncfgbent; ++i) | |
535 if (bmp_boolents[i].be_wrt) | |
536 bmp_cfg_db_set_bool(db, NULL, | |
537 bmp_boolents[i].be_vname, | |
538 *bmp_boolents[i].be_vloc); | |
539 | |
540 /* HACK: Work-around for bug #129 */ | |
80 | 541 /* |
0 | 542 bmp_cfg_db_set_bool(db, NULL, "playlist_shaded", |
543 FALSE); | |
80 | 544 */ |
0 | 545 for (i = 0; i < ncfgient; ++i) |
546 if (bmp_numents[i].ie_wrt) | |
547 bmp_cfg_db_set_int(db, NULL, | |
548 bmp_numents[i].ie_vname, | |
549 *bmp_numents[i].ie_vloc); | |
550 | |
551 /* This is a bit lame .. it'll end up being written twice, | |
552 * could do with being done a bit neater. -larne */ | |
553 bmp_cfg_db_set_int(db, NULL, "playlist_position", | |
554 playlist_get_position()); | |
555 | |
207
e152a92d3f45
[svn] Save the preference to enable or disable bitmap fonts.
nenolod
parents:
198
diff
changeset
|
556 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
|
557 cfg.mainwin_use_xfont); |
e152a92d3f45
[svn] Save the preference to enable or disable bitmap fonts.
nenolod
parents:
198
diff
changeset
|
558 |
0 | 559 for (i = 0; i < ncfgsent; ++i) { |
560 if (bmp_strents[i].se_wrt) | |
561 bmp_cfg_db_set_string(db, NULL, | |
562 bmp_strents[i].se_vname, | |
563 *bmp_strents[i].se_vloc); | |
564 } | |
565 | |
566 bmp_cfg_db_set_float(db, NULL, "equalizer_preamp", cfg.equalizer_preamp); | |
567 | |
568 for (i = 0; i < 10; i++) { | |
569 str = g_strdup_printf("equalizer_band%d", i); | |
570 bmp_cfg_db_set_float(db, NULL, str, cfg.equalizer_bands[i]); | |
571 g_free(str); | |
572 } | |
573 | |
196 | 574 if (bmp_active_skin != NULL) |
575 { | |
576 if (bmp_active_skin->path) | |
577 bmp_cfg_db_set_string(db, NULL, "skin", bmp_active_skin->path); | |
578 else | |
579 bmp_cfg_db_unset_key(db, NULL, "skin"); | |
580 } | |
0 | 581 |
582 if (get_current_output_plugin()) | |
583 bmp_cfg_db_set_string(db, NULL, "output_plugin", | |
584 get_current_output_plugin()->filename); | |
585 else | |
586 bmp_cfg_db_unset_key(db, NULL, "output_plugin"); | |
587 | |
588 str = general_stringify_enabled_list(); | |
589 if (str) { | |
590 bmp_cfg_db_set_string(db, NULL, "enabled_gplugins", str); | |
591 g_free(str); | |
592 } | |
593 else | |
594 bmp_cfg_db_unset_key(db, NULL, "enabled_gplugins"); | |
595 | |
596 str = vis_stringify_enabled_list(); | |
597 if (str) { | |
598 bmp_cfg_db_set_string(db, NULL, "enabled_vplugins", str); | |
599 g_free(str); | |
600 } | |
601 else | |
602 bmp_cfg_db_unset_key(db, NULL, "enabled_vplugins"); | |
603 | |
604 str = effect_stringify_enabled_list(); | |
605 if (str) { | |
606 bmp_cfg_db_set_string(db, NULL, "enabled_eplugins", str); | |
607 g_free(str); | |
608 } | |
609 else | |
610 bmp_cfg_db_unset_key(db, NULL, "enabled_eplugins"); | |
611 | |
612 if (cfg.filesel_path) | |
613 bmp_cfg_db_set_string(db, NULL, "filesel_path", cfg.filesel_path); | |
614 | |
615 if (cfg.playlist_path) | |
616 bmp_cfg_db_set_string(db, NULL, "playlist_path", cfg.playlist_path); | |
617 | |
618 bmp_cfg_db_set_int(db, NULL, "url_history_length", | |
619 g_list_length(cfg.url_history)); | |
620 | |
621 for (node = cfg.url_history, i = 1; node; node = g_list_next(node), i++) { | |
622 str = g_strdup_printf("url_history%d", i); | |
623 bmp_cfg_db_set_string(db, NULL, str, node->data); | |
624 g_free(str); | |
625 } | |
626 | |
627 bmp_cfg_db_close(db); | |
628 | |
629 playlist_save(bmp_paths[BMP_PATH_PLAYLIST_FILE], FALSE); | |
630 } | |
631 | |
632 static void | |
633 bmp_set_default_icon(void) | |
634 { | |
635 GdkPixbuf *icon; | |
636 | |
120 | 637 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); |
0 | 638 gtk_window_set_default_icon(icon); |
639 g_object_unref(icon); | |
640 } | |
641 | |
642 static void | |
643 display_usage(void) | |
644 { | |
44 | 645 g_print(_("Usage: audacious [options] [files] ...\n\n" |
0 | 646 "Options:\n" |
647 "--------\n")); | |
648 g_print("\n-h, --help "); | |
649 /* -h, --help switch */ | |
650 g_print(_("Display this text and exit")); | |
651 g_print("\n-n, --session "); | |
652 /* -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
|
653 g_print(_("Select Audacious/BMP/XMMS session (Default: 0)")); |
0 | 654 g_print("\n-r, --rew "); |
655 /* -r, --rew switch */ | |
656 g_print(_("Skip backwards in playlist")); | |
657 g_print("\n-p, --play "); | |
658 /* -p, --play switch */ | |
659 g_print(_("Start playing current playlist")); | |
660 g_print("\n-u, --pause "); | |
661 /* -u, --pause switch */ | |
662 g_print(_("Pause current song")); | |
663 g_print("\n-s, --stop "); | |
664 /* -s, --stop switch */ | |
665 g_print(_("Stop current song")); | |
666 g_print("\n-t, --play-pause "); | |
667 /* -t, --play-pause switch */ | |
668 g_print(_("Pause if playing, play otherwise")); | |
669 g_print("\n-f, --fwd "); | |
670 /* -f, --fwd switch */ | |
671 g_print(_("Skip forward in playlist")); | |
672 g_print("\n-e, --enqueue "); | |
673 /* -e, --enqueue switch */ | |
674 g_print(_("Don't clear the playlist")); | |
675 g_print("\n-m, --show-main-window "); | |
676 /* -m, --show-main-window switch */ | |
677 g_print(_("Show the main window")); | |
678 g_print("\n-a, --activate "); | |
679 /* -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
|
680 g_print(_("Activate Audacious")); |
0 | 681 g_print("\n-i, --sm-client-id "); |
682 /* -i, --sm-client-id switch */ | |
683 g_print(_("Previous session ID")); | |
316
950f104f2e11
[svn] Fix spacing in --help output, patch by Mikachu.
chainsaw
parents:
284
diff
changeset
|
684 g_print("\n-H, --headless "); |
193 | 685 /* -h, --headless switch */ |
686 g_print(_("Headless operation [experimental]")); | |
0 | 687 g_print("\n-v, --version "); |
688 /* -v, --version switch */ | |
689 g_print(_("Print version number and exit\n")); | |
690 | |
691 exit(EXIT_SUCCESS); | |
692 } | |
693 | |
694 static void | |
695 parse_cmd_line(gint argc, | |
696 gchar ** argv, | |
697 BmpCmdLineOpt * options) | |
698 { | |
699 static struct option long_options[] = { | |
700 {"help", 0, NULL, 'h'}, | |
701 {"session", 1, NULL, 'n'}, | |
702 {"rew", 0, NULL, 'r'}, | |
703 {"play", 0, NULL, 'p'}, | |
704 {"pause", 0, NULL, 'u'}, | |
705 {"play-pause", 0, NULL, 't'}, | |
706 {"stop", 0, NULL, 's'}, | |
707 {"fwd", 0, NULL, 'f'}, | |
708 {"enqueue", 0, NULL, 'e'}, | |
709 {"show-main-window", 0, NULL, 'm'}, | |
710 {"activate", 0, NULL, 'a'}, | |
711 {"version", 0, NULL, 'v'}, | |
712 {"sm-client-id", 1, NULL, 'i'}, | |
713 {"xmms", 0, NULL, 'x'}, | |
191 | 714 {"headless", 0, NULL, 'H'}, |
0 | 715 {0, 0, 0, 0} |
716 }; | |
717 | |
718 gchar *filename, *current_dir; | |
719 gint c, i; | |
720 | |
721 memset(options, 0, sizeof(BmpCmdLineOpt)); | |
722 options->session = -1; | |
723 | |
191 | 724 while ((c = getopt_long(argc, argv, "chn:HrpusfemavtLS", long_options, |
0 | 725 NULL)) != -1) { |
726 switch (c) { | |
727 case 'h': | |
728 display_usage(); | |
729 break; | |
730 case 'n': | |
731 options->session = atoi(optarg); | |
732 break; | |
191 | 733 case 'H': |
734 options->headless = TRUE; | |
735 break; | |
0 | 736 case 'r': |
737 options->rew = TRUE; | |
738 break; | |
739 case 'p': | |
740 options->play = TRUE; | |
741 break; | |
742 case 'u': | |
743 options->pause = TRUE; | |
744 break; | |
745 case 's': | |
746 options->stop = TRUE; | |
747 break; | |
748 case 'f': | |
749 options->fwd = TRUE; | |
750 break; | |
751 case 't': | |
752 options->play_pause = TRUE; | |
753 break; | |
754 case 'm': | |
755 options->mainwin = TRUE; | |
756 break; | |
757 case 'a': | |
758 options->activate = TRUE; | |
759 break; | |
760 case 'e': | |
761 options->enqueue = TRUE; | |
762 break; | |
763 case 'v': | |
764 dump_version(); | |
765 exit(EXIT_SUCCESS); | |
766 break; | |
767 case 'i': | |
768 options->previous_session_id = g_strdup(optarg); | |
769 break; | |
770 case 'c': | |
771 options->playcd = TRUE; | |
772 break; | |
773 case 'S': | |
774 options->load_skins = TRUE; | |
775 break; | |
776 } | |
777 } | |
778 | |
779 current_dir = g_get_current_dir(); | |
780 | |
781 for (i = optind; i < argc; i++) { | |
782 if (argv[i][0] == '/' || strstr(argv[i], "://")) | |
783 filename = g_strdup(argv[i]); | |
784 else | |
785 filename = g_build_filename(current_dir, argv[i], NULL); | |
786 | |
787 options->filenames = g_list_prepend(options->filenames, filename); | |
788 } | |
789 | |
790 options->filenames = g_list_reverse(options->filenames); | |
791 | |
792 g_free(current_dir); | |
793 } | |
794 | |
795 static void | |
796 handle_cmd_line_options(BmpCmdLineOpt * options, | |
797 gboolean remote) | |
798 { | |
799 GList *filenames = options->filenames; | |
800 gint session = options->session; | |
801 | |
802 if (session == -1) { | |
803 if (!remote) | |
804 session = ctrlsocket_get_session_id(); | |
805 else | |
806 session = 0; | |
807 } | |
808 | |
809 if (filenames) { | |
810 gint pos = 0; | |
811 | |
812 if (options->load_skins) { | |
813 xmms_remote_set_skin(session, filenames->data); | |
814 skin_install_skin(filenames->data); | |
815 } | |
816 else { | |
817 if (options->enqueue && options->play) | |
818 pos = xmms_remote_get_playlist_length(session); | |
819 | |
820 if (!options->enqueue) | |
821 xmms_remote_playlist_clear(session); | |
822 | |
823 xmms_remote_playlist_add(session, filenames); | |
824 | |
825 if (options->enqueue && options->play && | |
826 xmms_remote_get_playlist_length(session) > pos) | |
827 xmms_remote_set_playlist_pos(session, pos); | |
828 | |
829 if (!options->enqueue) | |
830 xmms_remote_play(session); | |
831 } | |
832 | |
833 g_list_foreach(filenames, (GFunc) g_free, NULL); | |
834 g_list_free(filenames); | |
835 } | |
836 | |
837 if (options->rew) | |
838 xmms_remote_playlist_prev(session); | |
839 | |
840 if (options->play) | |
841 xmms_remote_play(session); | |
842 | |
843 if (options->pause) | |
844 xmms_remote_pause(session); | |
845 | |
846 if (options->stop) | |
847 xmms_remote_stop(session); | |
848 | |
849 if (options->fwd) | |
850 xmms_remote_playlist_next(session); | |
851 | |
852 if (options->play_pause) | |
853 xmms_remote_play_pause(session); | |
854 | |
855 if (options->mainwin) | |
856 xmms_remote_main_win_toggle(session, TRUE); | |
857 | |
858 if (options->activate) | |
859 xmms_remote_activate(session); | |
860 | |
861 if (options->playcd) | |
862 play_medium(); | |
863 } | |
864 | |
865 static void | |
866 segfault_handler(gint sig) | |
867 { | |
868 g_printerr(_("\nReceived SIGSEGV\n\n" | |
27
d160ae2251e9
[svn] Update SIGSEGV message, contained the BMP mailing information.
nenolod
parents:
0
diff
changeset
|
869 "This could be a bug in Audacious. If you don't know why this happened, " |
d160ae2251e9
[svn] Update SIGSEGV message, contained the BMP mailing information.
nenolod
parents:
0
diff
changeset
|
870 "file a bug at http://bugs.nenolod.net/\n\n")); |
0 | 871 #ifdef HANDLE_SIGSEGV |
872 exit(EXIT_FAILURE); | |
873 #else | |
874 abort(); | |
875 #endif | |
876 } | |
877 | |
878 static void | |
879 bmp_setup_logger(void) | |
880 { | |
881 if (!bmp_logger_start(bmp_paths[BMP_PATH_LOG_FILE])) | |
882 return; | |
883 | |
884 g_atexit(bmp_logger_stop); | |
885 } | |
886 | |
887 static void | |
888 run_load_skin_error_dialog(const gchar * skin_path) | |
889 { | |
890 const gchar *markup = | |
891 N_("<b><big>Unable to load skin.</big></b>\n" | |
892 "\n" | |
893 "Check that skin at '%s' is usable and default skin is properly " | |
894 "installed at '%s'\n"); | |
895 | |
896 GtkWidget *dialog = | |
897 gtk_message_dialog_new_with_markup(NULL, | |
898 GTK_DIALOG_MODAL, | |
899 GTK_MESSAGE_ERROR, | |
900 GTK_BUTTONS_CLOSE, | |
901 _(markup), | |
902 skin_path, | |
903 BMP_DEFAULT_SKIN_PATH); | |
904 gtk_dialog_run(GTK_DIALOG(dialog)); | |
905 gtk_widget_destroy(dialog); | |
906 } | |
907 | |
908 gint | |
909 main(gint argc, gchar ** argv) | |
910 { | |
911 BmpCmdLineOpt options; | |
44 | 912 gboolean gtk_init_check_ok; |
0 | 913 |
914 /* Setup l10n early so we can print localized error messages */ | |
915 gtk_set_locale(); | |
916 bindtextdomain(PACKAGE, LOCALEDIR); | |
917 bind_textdomain_codeset(PACKAGE, "UTF-8"); | |
918 textdomain(PACKAGE); | |
919 | |
920 bmp_init_paths(); | |
921 bmp_make_user_dir(); | |
922 bmp_setup_logger(); | |
923 | |
924 /* Check GTK version. Really, this is only needed for binary | |
925 * 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
|
926 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
|
927 g_printerr(_("Sorry, your GTK+ version (%d.%d.%d) does not work with Audacious.\n" |
0 | 928 "Please use GTK+ %s or newer.\n"), |
929 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
|
930 "2.6.0"); |
0 | 931 exit(EXIT_FAILURE); |
932 } | |
933 | |
934 g_set_application_name(_(application_name)); | |
935 | |
936 g_thread_init(NULL); | |
937 if (!g_thread_supported()) { | |
938 g_printerr(_("Sorry, threads isn't supported on your platform.\n\n" | |
939 "If you're on a libc5 based linux system and installed Glib & GTK+ before you\n" | |
940 "installed LinuxThreads you need to recompile Glib & GTK+.\n")); | |
941 exit(EXIT_FAILURE); | |
942 } | |
943 | |
944 gdk_threads_init(); | |
945 | |
44 | 946 gtk_init_check_ok = gtk_init_check(&argc, &argv); |
947 /* Now let's parse the command line options first. */ | |
948 parse_cmd_line(argc, argv, &options); | |
949 if (!gtk_init_check_ok) { | |
0 | 950 if (argc < 2) { |
951 /* GTK check failed, and no arguments passed to indicate | |
952 that user is intending to only remote control a running | |
953 session */ | |
44 | 954 g_printerr(_("audacious: Unable to open display, exiting.\n")); |
0 | 955 exit(EXIT_FAILURE); |
956 } | |
957 | |
958 handle_cmd_line_options(&options, TRUE); | |
191 | 959 |
960 /* we could be running headless, so GTK probably wont matter */ | |
961 if (options.headless != 1) | |
962 exit(EXIT_SUCCESS); | |
0 | 963 } |
964 | |
965 if (!vfs_init()) { | |
966 g_printerr(Q_("Could not initialize VFS.\n")); | |
967 exit(EXIT_FAILURE); | |
968 } | |
969 | |
970 signal(SIGPIPE, SIG_IGN); /* for controlsocket.c */ | |
971 signal(SIGSEGV, segfault_handler); | |
972 | |
973 g_random_set_seed(time(NULL)); | |
974 | |
975 bmp_config_load(); | |
976 | |
977 if (options.session != -1 || !ctrlsocket_setup()) { | |
978 handle_cmd_line_options(&options, TRUE); | |
979 exit(EXIT_SUCCESS); | |
980 } | |
981 | |
191 | 982 if (options.headless != 1) |
983 { | |
984 bmp_set_default_icon(); | |
0 | 985 |
191 | 986 gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]); |
0 | 987 |
191 | 988 mainwin_create(); |
989 playlistwin_create(); | |
990 equalizerwin_create(); | |
0 | 991 |
191 | 992 if (!init_skins(cfg.skin)) { |
993 run_load_skin_error_dialog(cfg.skin); | |
994 exit(EXIT_FAILURE); | |
995 } | |
996 | |
997 GDK_THREADS_ENTER(); | |
0 | 998 } |
999 | |
1000 plugin_system_init(); | |
1001 | |
1002 playlist_load(bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
1003 playlist_set_position(cfg.playlist_position); | |
1004 | |
1005 /* this needs to be called after all 3 windows are created and | |
191 | 1006 * input plugins are setup'ed |
1007 * but not if we're running headless --nenolod | |
1008 */ | |
0 | 1009 mainwin_setup_menus(); |
1010 | |
191 | 1011 if (options.headless != 1) |
1012 GDK_THREADS_LEAVE(); | |
0 | 1013 |
1014 ctrlsocket_start(); | |
1015 | |
1016 handle_cmd_line_options(&options, FALSE); | |
1017 | |
191 | 1018 if (options.headless != 1) |
1019 { | |
1020 GDK_THREADS_ENTER(); | |
0 | 1021 |
191 | 1022 read_volume(VOLSET_STARTUP); |
1023 mainwin_set_info_text(); | |
1024 | |
1025 /* FIXME: delayed, because it deals directly with the plugin | |
1026 * interface to set menu items */ | |
1027 create_prefs_window(); | |
0 | 1028 |
191 | 1029 if (cfg.player_visible) |
1030 mainwin_show(TRUE); | |
1031 else if (!cfg.playlist_visible && !cfg.equalizer_visible) | |
1032 mainwin_show(TRUE); | |
125 | 1033 |
191 | 1034 if (cfg.equalizer_visible) |
1035 equalizerwin_show(TRUE); | |
1036 | |
1037 if (cfg.playlist_visible) | |
1038 playlistwin_show(); | |
0 | 1039 |
191 | 1040 hint_set_always(cfg.always_on_top); |
0 | 1041 |
191 | 1042 playlist_start_get_info_thread(); |
1043 mainwin_attach_idle_func(); | |
1044 | |
486 | 1045 starting_up = FALSE; |
1046 | |
680
8282b365f6cb
[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
nenolod
parents:
625
diff
changeset
|
1047 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
|
1048 |
191 | 1049 gtk_main(); |
1050 | |
1051 GDK_THREADS_LEAVE(); | |
0 | 1052 |
191 | 1053 return EXIT_SUCCESS; |
1054 } | |
1055 else | |
1056 { | |
1057 mainwin_set_info_text(); | |
1058 playlist_start_get_info_thread(); | |
0 | 1059 |
486 | 1060 starting_up = FALSE; |
1061 | |
191 | 1062 for (;;) |
192
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1063 { |
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
|
1064 /* 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
|
1065 audcore_generic_events(); |
198 | 1066 free_vis_data(); /* to prevent buffer overflow -- paranoia */ |
191 | 1067 xmms_usleep(10000); |
192
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1068 } |
0ee0b9b6db7e
[svn] headless now working, use --headless if you wish to experiment.
nenolod
parents:
191
diff
changeset
|
1069 |
191 | 1070 return EXIT_SUCCESS; |
1071 } | |
0 | 1072 } |