annotate audacious/main.c @ 486:c4a560cb40f9 trunk

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