Mercurial > audlegacy
annotate src/audacious/main.c @ 4700:3a56d2786063
move all files belonging to the legacy UI to legacy/
author | mf0102 <0102@gmx.at> |
---|---|
date | Sun, 06 Jul 2008 17:55:40 +0200 |
parents | 48cdebc174ef |
children | c2886b393206 |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team. | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2973
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2973
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
4671
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
30 #include "platform/smartinclude.h" |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
31 |
2313 | 32 #include "main.h" |
33 | |
34 #include <glib/gprintf.h> | |
35 | |
4523
b3e4f5c31546
Conditional USE_SRC was changed to USE_SAMPLERATE earlier.
Matti Hamalainen <ccr@tnsp.org>
parents:
4517
diff
changeset
|
36 #ifdef USE_SAMPLERATE |
4267
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
37 # include <samplerate.h> |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
38 #endif |
a41fb6bc632a
- src stuff traveled to src_flow.c
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
4256
diff
changeset
|
39 |
2694
c2b82432c1b6
[svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
2682
diff
changeset
|
40 #ifdef USE_DBUS |
2711
c35913222440
[svn] Initial commit of dbus client library for plugins. Various changes were made to the plugin structure to support dbus.
magma
parents:
2709
diff
changeset
|
41 # include "dbus-service.h" |
2785 | 42 # include "audctrl.h" |
2694
c2b82432c1b6
[svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
2682
diff
changeset
|
43 #endif |
c2b82432c1b6
[svn] Added basic DBus support, disabled by default with a configuration option to enable it. The general and playback information/manipulation methods are currently the only ones implemented. That is version, play, pause, stop, playing, paused, stopped, status, and seek. There are stubs for many unimplemented methods.
magma
parents:
2682
diff
changeset
|
44 |
4671
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
45 #ifdef USE_EGGSM |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
46 #include "eggsmclient.h" |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
47 #include "eggdesktopfile.h" |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
48 #endif |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
49 |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
50 #include "libSAD.h" |
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
51 |
4347 | 52 #include "build_stamp.h" |
4671
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
53 #include "configdb.h" |
2313 | 54 #include "input.h" |
55 #include "logger.h" | |
56 #include "output.h" | |
57 #include "playback.h" | |
58 #include "playlist.h" | |
4347 | 59 #include "pluginenum.h" |
60 #include "signals.h" | |
4700
3a56d2786063
move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
4675
diff
changeset
|
61 #include "legacy/ui_manager.h" |
3a56d2786063
move all files belonging to the legacy UI to legacy/
mf0102 <0102@gmx.at>
parents:
4675
diff
changeset
|
62 #include "legacy/ui_skin.h" |
2313 | 63 #include "util.h" |
4671
414966b3a933
clean up some parts that have been made obsolete by nenolod's great work:
mf0102 <0102@gmx.at>
parents:
4670
diff
changeset
|
64 #include "vfs.h" |
2313 | 65 |
66 #include "icons-stock.h" | |
67 #include "images/audacious_player.xpm" | |
68 | |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
4662
diff
changeset
|
69 #include "ui_new.h" |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
70 #include "ui_legacy.h" |
4670 | 71 #include "ui_headless.h" |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
4662
diff
changeset
|
72 |
4517 | 73 static const gchar *application_name = N_("Audacious"); |
2313 | 74 |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
75 struct _AudCmdLineOpt { |
2411 | 76 gchar **filenames; |
2313 | 77 gint session; |
3351
7a4fcf84a34f
Removed the hardcoded Add/Play CD menu entry
Calin Crisan ccrisan@gmail.com
parents:
3346
diff
changeset
|
78 gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box; |
2313 | 79 gboolean enqueue, mainwin, remote, activate; |
80 gboolean load_skins; | |
81 gboolean no_log; | |
82 gboolean enqueue_to_temp; | |
2411 | 83 gboolean version; |
2313 | 84 gchar *previous_session_id; |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
85 gchar *interface; |
4355 | 86 gboolean macpack; |
2313 | 87 }; |
4350
8071e599916d
renamed BmpCmdLineOpt to AudCmdLineOpt (greatest commit EVAR! ;-)
mf0102 <0102@gmx.at>
parents:
4347
diff
changeset
|
88 typedef struct _AudCmdLineOpt AudCmdLineOpt; |
2313 | 89 |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
90 static AudCmdLineOpt options = {}; |
2313 | 91 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
92 gchar *aud_paths[BMP_PATH_COUNT] = {}; |
2313 | 93 |
94 GCond *cond_scan; | |
95 GMutex *mutex_scan; | |
3346
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
96 #ifdef USE_DBUS |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
97 MprisPlayer *mpris; |
71d8d93f1bad
Implemented TrackChange, StatusChange signals, with a stub for CapsChange.
Ben Tucker <ben.tucker@gmail.com>
parents:
3334
diff
changeset
|
98 #endif |
2313 | 99 |
100 static void | |
4542 | 101 print_version(void) |
2313 | 102 { |
4450
413d80f7b011
remove the strange feature list feature, which was used for GConf only
mf0102 <0102@gmx.at>
parents:
4449
diff
changeset
|
103 g_printf("%s %s [%s]\n", _(application_name), VERSION, svn_stamp); |
2313 | 104 } |
105 | |
106 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
107 aud_make_user_dir(void) |
2313 | 108 { |
109 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
110 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
111 make_directory(aud_paths[BMP_PATH_USER_DIR], mode755); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
112 make_directory(aud_paths[BMP_PATH_USER_PLUGIN_DIR], mode755); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
113 make_directory(aud_paths[BMP_PATH_USER_SKIN_DIR], mode755); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
114 make_directory(aud_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
115 make_directory(aud_paths[BMP_PATH_PLAYLISTS_DIR], mode755); |
2313 | 116 } |
117 | |
118 static void | |
4543
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
119 aud_free_paths(void) |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
120 { |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
121 int i; |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
122 |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
123 for (i = 0; i < BMP_PATH_COUNT; i++) |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
124 { |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
125 g_free(aud_paths[i]); |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
126 aud_paths[i] = 0; |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
127 } |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
128 } |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
129 |
ed94ac6182df
whoops, too much cosmetics is bad for the overall appearance
mf0102 <0102@gmx.at>
parents:
4542
diff
changeset
|
130 static void |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
131 aud_init_paths() |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
132 { |
2364 | 133 char *xdg_config_home; |
134 char *xdg_data_home; | |
135 char *xdg_cache_home; | |
2313 | 136 |
2364 | 137 xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL |
138 ? g_build_filename(g_get_home_dir(), ".config", NULL) | |
139 : g_strdup(getenv("XDG_CONFIG_HOME"))); | |
140 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL | |
141 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) | |
142 : g_strdup(getenv("XDG_DATA_HOME"))); | |
143 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL | |
144 ? g_build_filename(g_get_home_dir(), ".cache", NULL) | |
145 : g_strdup(getenv("XDG_CACHE_HOME"))); | |
2313 | 146 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
147 aud_paths[BMP_PATH_USER_DIR] = |
2364 | 148 g_build_filename(xdg_config_home, "audacious", NULL); |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
149 aud_paths[BMP_PATH_USER_SKIN_DIR] = |
2364 | 150 g_build_filename(xdg_data_home, "audacious", "Skins", NULL); |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
151 aud_paths[BMP_PATH_USER_PLUGIN_DIR] = |
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
152 g_build_filename(xdg_data_home, "audacious", "Plugins", NULL); |
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
153 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
154 aud_paths[BMP_PATH_SKIN_THUMB_DIR] = |
2364 | 155 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); |
2313 | 156 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
157 aud_paths[BMP_PATH_PLAYLISTS_DIR] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
158 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "playlists", NULL); |
3400
8764498b75ed
Add new playlists directory to paths
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3351
diff
changeset
|
159 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
160 aud_paths[BMP_PATH_CONFIG_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
161 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "config", NULL); |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
162 #ifdef HAVE_XSPF_PLAYLIST |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
163 aud_paths[BMP_PATH_PLAYLIST_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
164 g_build_filename(aud_paths[BMP_PATH_USER_DIR], |
2364 | 165 "playlist.xspf", NULL); |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
166 #else |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
167 aud_paths[BMP_PATH_PLAYLIST_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
168 g_build_filename(aud_paths[BMP_PATH_USER_DIR], |
2364 | 169 "playlist.m3u", NULL); |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
170 #endif |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
171 aud_paths[BMP_PATH_ACCEL_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
172 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "accels", NULL); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
173 aud_paths[BMP_PATH_LOG_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
174 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "log", NULL); |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
175 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
176 aud_paths[BMP_PATH_GTKRC_FILE] = |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
177 g_build_filename(aud_paths[BMP_PATH_USER_DIR], "gtkrc", NULL); |
2463 | 178 |
2364 | 179 g_free(xdg_config_home); |
180 g_free(xdg_data_home); | |
181 g_free(xdg_cache_home); | |
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
182 |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
183 g_atexit(aud_free_paths); |
2313 | 184 } |
185 | |
4542 | 186 static void |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
187 aud_set_default_icon(void) |
2313 | 188 { |
189 GdkPixbuf *icon; | |
190 | |
191 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); | |
192 gtk_window_set_default_icon(icon); | |
193 g_object_unref(icon); | |
194 } | |
195 | |
2411 | 196 static GOptionEntry cmd_entries[] = { |
2448
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
197 {"rew", 'r', 0, G_OPTION_ARG_NONE, &options.rew, N_("Skip backwards in playlist"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
198 {"play", 'p', 0, G_OPTION_ARG_NONE, &options.play, N_("Start playing current playlist"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
199 {"pause", 'u', 0, G_OPTION_ARG_NONE, &options.pause, N_("Pause current song"), NULL}, |
2475 | 200 {"stop", 's', 0, G_OPTION_ARG_NONE, &options.stop, N_("Stop current song"), NULL}, |
2551
cea3528b2996
[svn] Fix --play-pause commandline option, by Alex "Monkey" Maclean in #gentoo-x86
chainsaw
parents:
2530
diff
changeset
|
201 {"play-pause", 't', 0, G_OPTION_ARG_NONE, &options.play_pause, N_("Pause if playing, play otherwise"), NULL}, |
2448
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
202 {"fwd", 'f', 0, G_OPTION_ARG_NONE, &options.fwd, N_("Skip forward in playlist"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
203 {"show-jump-box", 'j', 0, G_OPTION_ARG_NONE, &options.show_jump_box, N_("Display Jump to File dialog"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
204 {"enqueue", 'e', 0, G_OPTION_ARG_NONE, &options.enqueue, N_("Don't clear the playlist"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
205 {"enqueue-to-temp", 'E', 0, G_OPTION_ARG_NONE, &options.enqueue_to_temp, N_("Add new files to a temporary playlist"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
206 {"show-main-window", 'm', 0, G_OPTION_ARG_NONE, &options.mainwin, N_("Display the main window"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
207 {"activate", 'a', 0, G_OPTION_ARG_NONE, &options.activate, N_("Display all open Audacious windows"), NULL}, |
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
208 {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL}, |
4545
c9be7256db08
we don't show builtin features anymore
mf0102 <0102@gmx.at>
parents:
4544
diff
changeset
|
209 {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version"), NULL}, |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
210 {"interface", 'i', 0, G_OPTION_ARG_STRING, &options.interface, N_("Interface to use"), NULL}, |
4355 | 211 #ifdef GDK_WINDOWING_QUARTZ |
212 {"macpack", 'n', 0, G_OPTION_ARG_NONE, &options.macpack, N_("Used in macpacking"), NULL}, /* Make this hidden */ | |
213 #endif | |
2411 | 214 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, N_("FILE..."), NULL}, |
215 {NULL}, | |
216 }; | |
2313 | 217 |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
218 static gboolean |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
219 aud_start_playback(gpointer unused) |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
220 { |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
221 drct_play(); |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
222 return FALSE; |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
223 } |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
224 |
2313 | 225 static void |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
226 parse_cmd_line_options(gint *argc, gchar ***argv) |
2313 | 227 { |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
228 GOptionContext *context; |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
229 GError *error = NULL; |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
230 |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
231 memset(&options, '\0', sizeof(AudCmdLineOpt)); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
232 options.session = -1; |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
233 |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
234 context = g_option_context_new(_("- play multimedia files")); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
235 g_option_context_add_main_entries(context, cmd_entries, PACKAGE_NAME); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
236 g_option_context_add_group(context, gtk_get_option_group(FALSE)); |
4492
55262ebeba2d
Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents:
4467
diff
changeset
|
237 #ifdef USE_EGGSM |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
238 g_option_context_add_group(context, egg_sm_client_get_option_group()); |
4492
55262ebeba2d
Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents:
4467
diff
changeset
|
239 #endif |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
240 if (!g_option_context_parse(context, argc, argv, &error)) |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
241 /* checking for MacOS X -psn_0_* errors*/ |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
242 if (error->message && !g_strrstr(error->message,"-psn_0_")) |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
243 { |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
244 g_printerr(_("%s: %s\nTry `%s --help' for more information.\n"), |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
245 (*argv)[0], error->message, (*argv)[0]); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
246 exit(EXIT_FAILURE); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
247 } |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
248 } |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
249 |
4575
92952061147d
Fix the initialization after messing it up myself - commandline argument handling was happening twice.
Matti Hamalainen <ccr@tnsp.org>
parents:
4563
diff
changeset
|
250 static void |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
251 handle_cmd_line_filenames(gboolean is_running) |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
252 { |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
253 gchar **filenames = options.filenames; |
2785 | 254 #ifdef USE_DBUS |
255 DBusGProxy *session = audacious_get_dbus_proxy(); | |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
256 #endif |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
257 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
258 if (filenames == NULL) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
259 return; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
260 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
261 gint pos = 0; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
262 gint i = 0; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
263 GList *fns = NULL; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
264 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
265 for (i = 0; filenames[i] != NULL; i++) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
266 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
267 gchar *filename; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
268 gchar *current_dir = g_get_current_dir(); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
269 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
270 if (!strstr(filenames[i], "://")) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
271 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
272 if (filenames[i][0] == '/') |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
273 filename = g_strdup_printf("file:///%s", filenames[i]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
274 else |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
275 filename = g_strdup_printf("file:///%s/%s", current_dir, |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
276 filenames[i]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
277 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
278 else |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
279 filename = g_strdup(filenames[i]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
280 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
281 fns = g_list_prepend(fns, filename); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
282 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
283 g_free(current_dir); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
284 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
285 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
286 fns = g_list_reverse(fns); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
287 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
288 #ifdef USE_DBUS |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
289 if (is_running) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
290 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
291 if (options.load_skins) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
292 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
293 audacious_remote_set_skin(session, filenames[0]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
294 skin_install_skin(filenames[0]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
295 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
296 else |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
297 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
298 GList *i; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
299 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
300 if (options.enqueue_to_temp) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
301 audacious_remote_playlist_enqueue_to_temp(session, filenames[0]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
302 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
303 if (options.enqueue && options.play) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
304 pos = audacious_remote_get_playlist_length(session); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
305 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
306 if (!options.enqueue) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
307 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
308 audacious_remote_playlist_clear(session); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
309 audacious_remote_stop(session); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
310 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
311 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
312 for (i = fns; i != NULL; i = i->next) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
313 audacious_remote_playlist_add_url_string(session, i->data); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
314 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
315 if (options.enqueue && options.play && |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
316 audacious_remote_get_playlist_length(session) > pos) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
317 audacious_remote_set_playlist_pos(session, pos); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
318 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
319 if (!options.enqueue) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
320 audacious_remote_play(session); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
321 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
322 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
323 else /* !is_running */ |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
324 #endif |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
325 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
326 if (options.enqueue_to_temp) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
327 drct_pl_enqueue_to_temp(filenames[0]); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
328 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
329 if (options.enqueue && options.play) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
330 pos = drct_pl_get_length(); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
331 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
332 if (!options.enqueue) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
333 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
334 drct_pl_clear(); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
335 drct_stop(); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
336 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
337 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
338 drct_pl_add(fns); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
339 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
340 if (options.enqueue && options.play && |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
341 drct_pl_get_length() > pos) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
342 drct_pl_set_pos(pos); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
343 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
344 if (!options.enqueue) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
345 g_idle_add(aud_start_playback, NULL); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
346 } /* !is_running */ |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
347 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
348 g_list_foreach(fns, (GFunc) g_free, NULL); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
349 g_list_free(fns); |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
350 } |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
351 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
352 static void |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
353 handle_cmd_line_options(gboolean skip) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
354 { |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
355 gboolean is_running = FALSE; |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
356 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
357 #ifdef USE_DBUS |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
358 DBusGProxy *session = audacious_get_dbus_proxy(); |
4661
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
359 |
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
360 if (skip) |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
361 is_running = audacious_remote_is_running(session); |
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
362 #endif |
2313 | 363 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
364 if (options.version) |
2411 | 365 { |
4542 | 366 print_version(); |
2411 | 367 exit(EXIT_SUCCESS); |
368 } | |
369 | |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
370 if (options.interface == NULL) |
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
371 options.interface = g_strdup("default"); |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
372 |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
373 handle_cmd_line_filenames(is_running); |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
374 |
2788
b2b920b165ad
[svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents:
2786
diff
changeset
|
375 #ifdef USE_DBUS |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
376 if (is_running) |
2411 | 377 { |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
378 if (options.rew) |
2832 | 379 audacious_remote_playlist_prev(session); |
2313 | 380 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
381 if (options.play) |
2832 | 382 audacious_remote_play(session); |
2313 | 383 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
384 if (options.pause) |
2832 | 385 audacious_remote_pause(session); |
2313 | 386 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
387 if (options.stop) |
2832 | 388 audacious_remote_stop(session); |
2313 | 389 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
390 if (options.fwd) |
2832 | 391 audacious_remote_playlist_next(session); |
2313 | 392 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
393 if (options.play_pause) |
2832 | 394 audacious_remote_play_pause(session); |
2313 | 395 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
396 if (options.show_jump_box) |
2832 | 397 audacious_remote_show_jtf_box(session); |
2313 | 398 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
399 if (options.mainwin) |
2832 | 400 audacious_remote_main_win_toggle(session, TRUE); |
2313 | 401 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
402 if (options.activate) |
2832 | 403 audacious_remote_activate(session); |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
404 |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
405 exit(EXIT_SUCCESS); |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
406 } /* is_running */ |
3883
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
407 else |
6aaf5476b765
commandline handling rewrite. should be fine, it passed all of my tests. ;)
William Pitcock <nenolod@atheme.org>
parents:
3753
diff
changeset
|
408 #endif |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
409 { |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
410 if (options.rew) |
3753 | 411 drct_pl_prev(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
412 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
413 if (options.play) |
3753 | 414 drct_play(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
415 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
416 if (options.pause) |
3753 | 417 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
418 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
419 if (options.stop) |
3753 | 420 drct_stop(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
421 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
422 if (options.fwd) |
3753 | 423 drct_pl_next(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
424 |
4672
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
425 if (options.play_pause) |
8dc3b3af74a9
removed code duplication via new function handle_cmd_line_filenames()
mf0102 <0102@gmx.at>
parents:
4671
diff
changeset
|
426 { |
3753 | 427 if (drct_get_paused()) |
428 drct_play(); | |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
429 else |
3753 | 430 drct_pause(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
431 } |
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
432 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
433 if (options.show_jump_box) |
3753 | 434 drct_jtf_show(); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
435 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
436 if (options.mainwin) |
3753 | 437 drct_main_win_toggle(TRUE); |
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
438 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
439 if (options.activate) |
3753 | 440 drct_activate(); |
4026
17bf734f8187
avoid crash when audacious is launched with -p option.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3978
diff
changeset
|
441 } /* !is_running */ |
2313 | 442 } |
443 | |
444 static void | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
445 aud_setup_logger(void) |
2313 | 446 { |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
447 if (!aud_logger_start(aud_paths[BMP_PATH_LOG_FILE])) |
2313 | 448 return; |
449 | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
450 g_atexit(aud_logger_stop); |
2313 | 451 } |
452 | |
2369 | 453 static gboolean |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
454 load_extra_playlist(const gchar * path, const gchar * basename, |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
455 gpointer def) |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
456 { |
4644
23e712435e3e
Remove an unused variable.
Matti Hamalainen <ccr@tnsp.org>
parents:
4635
diff
changeset
|
457 Playlist *playlist = playlist_new(); |
23e712435e3e
Remove an unused variable.
Matti Hamalainen <ccr@tnsp.org>
parents:
4635
diff
changeset
|
458 |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
459 if (!playlist) { |
4635 | 460 g_warning("Couldn't create new playlist for %s / %s\n", path, basename); |
3480
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
461 return FALSE; |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
462 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
463 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
464 playlist_add_playlist(playlist); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
465 playlist_load(playlist, path); |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
466 |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
467 return FALSE; /* keep loading other playlists */ |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
468 } |
3f4ad59a5c02
Load extra playlists on startup
Kieran Clancy <clancy.kieran+audacious@gmail.com>
parents:
3443
diff
changeset
|
469 |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
470 static void |
4448 | 471 playlist_system_init() |
472 { | |
473 Playlist *playlist; | |
474 | |
475 playlist_init(); | |
476 playlist = playlist_get_active(); | |
477 playlist_load(playlist, aud_paths[BMP_PATH_PLAYLIST_FILE]); | |
478 playlist_set_position(playlist, cfg.playlist_position); | |
479 | |
480 /* Load extra playlists */ | |
481 if (!dir_foreach(aud_paths[BMP_PATH_PLAYLISTS_DIR], load_extra_playlist, | |
482 playlist, NULL)) | |
483 g_warning("Could not load extra playlists\n"); | |
484 } | |
485 | |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
486 void |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
487 aud_quit(void) |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
488 { |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
489 GList *playlists = NULL, *playlists_top = NULL; |
4675 | 490 Interface *i = interface_get(options.interface); |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
491 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
492 playlist_stop_get_info_thread(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
493 |
4494
0f43f3a5eb12
Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents:
4492
diff
changeset
|
494 aud_config_save(); |
0f43f3a5eb12
Fix the "skin path is fucked up" bug.
William Pitcock <nenolod@atheme.org>
parents:
4492
diff
changeset
|
495 |
4675 | 496 interface_destroy(i); |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
497 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
498 plugin_system_cleanup(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
499 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
500 /* free and clear each playlist */ |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
501 playlists = playlist_get_playlists(); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
502 playlists_top = playlists; |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
503 while ( playlists != NULL ) |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
504 { |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
505 playlist_clear((Playlist*)playlists->data); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
506 playlist_free((Playlist*)playlists->data); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
507 playlists = g_list_next(playlists); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
508 } |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
509 g_list_free( playlists_top ); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
510 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
511 g_cond_free(cond_scan); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
512 g_mutex_free(mutex_scan); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
513 |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
514 exit(EXIT_SUCCESS); |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
515 } |
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
516 |
2313 | 517 gint |
518 main(gint argc, gchar ** argv) | |
519 { | |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
520 Interface *i; |
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
521 |
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
522 /* glib-2.13.0 requires g_thread_init() to be called before all |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
523 other GLib functions */ |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
524 g_thread_init(NULL); |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
525 if (!g_thread_supported()) { |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
526 g_printerr(_("Sorry, threads aren't supported on your platform.\n")); |
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
527 exit(EXIT_FAILURE); |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
528 } |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
529 |
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
530 gdk_threads_init(); |
4562
a6d0f9d6198a
Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents:
4545
diff
changeset
|
531 mowgli_init(); |
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
532 |
2313 | 533 /* Setup l10n early so we can print localized error messages */ |
534 gtk_set_locale(); | |
535 bindtextdomain(PACKAGE_NAME, LOCALEDIR); | |
536 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | |
2388
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
537 bindtextdomain(PACKAGE_NAME "-plugins", LOCALEDIR); |
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
538 bind_textdomain_codeset(PACKAGE_NAME "-plugins", "UTF-8"); |
2313 | 539 textdomain(PACKAGE_NAME); |
540 | |
4492
55262ebeba2d
Conditional support for SM (libeggsmclient).
Matti Hamalainen <ccr@tnsp.org>
parents:
4467
diff
changeset
|
541 #if !defined(_WIN32) && defined(USE_EGGSM) |
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
542 egg_set_desktop_file(AUDACIOUS_DESKTOP_FILE); |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
4286
diff
changeset
|
543 #endif |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
544 aud_init_paths(); |
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
545 aud_make_user_dir(); |
2313 | 546 |
547 cond_scan = g_cond_new(); | |
548 mutex_scan = g_mutex_new(); | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
549 gtk_rc_add_default_file(aud_paths[BMP_PATH_GTKRC_FILE]); |
2463 | 550 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
551 parse_cmd_line_options(&argc, &argv); |
2313 | 552 |
553 if (options.no_log == FALSE) | |
4413
de33c83aa06f
Huge renaming patch, changing BMP references to Audacious.
Matti Hamalainen <ccr@tnsp.org>
parents:
4412
diff
changeset
|
554 aud_setup_logger(); |
2313 | 555 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
556 g_message("Initializing Gtk+"); |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
557 if (!gtk_init_check(&argc, &argv)) { /* XXX */ |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
558 /* GTK check failed, and no arguments passed to indicate |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
559 that user is intending to only remote control a running |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
560 session */ |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
561 g_printerr(_("%s: Unable to open display, exiting.\n"), argv[0]); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
562 exit(EXIT_FAILURE); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
563 } |
2313 | 564 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
565 g_message("Setting up libSAD"); |
2313 | 566 g_random_set_seed(time(NULL)); |
4234 | 567 SAD_dither_init_rand((gint32)time(NULL)); |
2313 | 568 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
569 g_message("Loading configuration"); |
4412
180996fcf12a
bmp_config_* -> aud_config_*
Matti Hamalainen <ccr@tnsp.org>
parents:
4411
diff
changeset
|
570 aud_config_load(); |
2313 | 571 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
572 g_message("Initializing signal handlers"); |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
573 signal_handlers_init(); |
4562
a6d0f9d6198a
Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents:
4545
diff
changeset
|
574 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
575 g_message("Handling commandline options, part #1"); |
4593
bc29f566be02
Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents:
4587
diff
changeset
|
576 handle_cmd_line_options(TRUE); |
3306
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3296
diff
changeset
|
577 |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
578 if (g_ascii_strcasecmp(options.interface, "headless")) /* XXX */ |
3306
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3296
diff
changeset
|
579 { |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
580 g_message("Non-headless operation setup"); |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
581 ui_main_check_theme_engine(); |
3965
aea8b763b134
Work around the issues with broken Gtk-Qt-Engine and Modern skins with inline GTK.
William Pitcock <nenolod@atheme.org>
parents:
3959
diff
changeset
|
582 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
583 /* register icons in stock |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
584 NOTE: should be called before UIManager */ |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
585 register_aud_stock_icons(); |
3978
40db2fe8d073
- fixed custom stock icons that were not displayed
Giacomo Lozito <james@develia.org>
parents:
3965
diff
changeset
|
586 |
4356
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
587 /* UIManager |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
588 NOTE: this needs to be called before plugin init, cause |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
589 plugin init functions may want to add custom menu entries */ |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
590 ui_manager_init(); |
87cb9d3402d4
rolling away some more stones on the hard way to real headless operation
mf0102 <0102@gmx.at>
parents:
4355
diff
changeset
|
591 ui_manager_create_menus(); |
3306
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3296
diff
changeset
|
592 } |
404ffedef3e1
added support for plugin-customizable menus; plugins can add their own entries (and even submenus) in main and playlist popup menus
Giacomo Lozito <james@develia.org>
parents:
3296
diff
changeset
|
593 |
4661
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
594 #ifdef USE_DBUS |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
595 g_message("Initializing D-Bus"); |
4661
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
596 init_dbus(); |
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
597 #endif |
e4e7999a21bc
Move D-Bus initialization before plugin system and playlist initialization.
Matti Hamalainen <ccr@tnsp.org>
parents:
4644
diff
changeset
|
598 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
599 g_message("Initializing plugin subsystems..."); |
2313 | 600 plugin_system_init(); |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
601 |
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
602 g_message("Setting up playlists"); |
4448 | 603 playlist_system_init(); |
4562
a6d0f9d6198a
Made handling of commandline options to happen before plugin and playlist
Matti Hamalainen <ccr@tnsp.org>
parents:
4545
diff
changeset
|
604 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
605 g_message("Handling commandline options, part #2"); |
4593
bc29f566be02
Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents:
4587
diff
changeset
|
606 handle_cmd_line_options(FALSE); |
bc29f566be02
Handle properly the situation when player is not running and files are added from commandline.
Matti Hamalainen <ccr@tnsp.org>
parents:
4587
diff
changeset
|
607 |
4662
8a783f826316
Added some debugging / startup messages (visible via 'audacious -N') to make
Matti Hamalainen <ccr@tnsp.org>
parents:
4661
diff
changeset
|
608 g_message("Playlist scanner thread startup"); |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
609 playlist_start_get_info_thread(); |
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
610 |
4448 | 611 output_set_volume((cfg.saved_volume & 0xff00) >> 8, |
612 (cfg.saved_volume & 0x00ff)); | |
613 | |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
614 g_message("Setting default icon"); |
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
615 aud_set_default_icon(); |
2313 | 616 |
4668
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
617 g_message("Populating included interfaces"); |
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
618 ui_populate_default_interface(); |
fdcbbfdd428e
Split out a lot of stuff in main.c to ui_legacy.c.
William Pitcock <nenolod@atheme.org>
parents:
4667
diff
changeset
|
619 ui_populate_legacy_interface(); |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
620 ui_populate_headless_interface(); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
4662
diff
changeset
|
621 |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
622 g_message("Selecting interface %s", options.interface); |
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
623 i = interface_get(options.interface); |
2313 | 624 |
4669
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
625 g_message("Running interface %s@%p", options.interface, i); |
ec88df86deef
Split out headless specific interface code (mostly).
William Pitcock <nenolod@atheme.org>
parents:
4668
diff
changeset
|
626 interface_run(i); |
2313 | 627 |
4449
19e3f3c5fe7f
introduce function aud_quit(), which is basically mainwin_quit_cb(), but
mf0102 <0102@gmx.at>
parents:
4448
diff
changeset
|
628 aud_quit(); |
4385
88d8f699359a
moved some stuff around to increase headless support
mf0102 <0102@gmx.at>
parents:
4374
diff
changeset
|
629 return EXIT_SUCCESS; |
2313 | 630 } |