Mercurial > audlegacy
annotate src/audacious/main.c @ 2935:fc8a2ebb2e13 trunk
Fix display of help system.
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Fri, 29 Jun 2007 08:38:29 -0500 |
| parents | 22c940e0d2dc |
| children | 1cdfc508d758 |
| 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 | |
| 12 * the Free Software Foundation; under version 2 of the License. | |
| 13 * | |
| 14 * This program is distributed in the hope that it will be useful, | |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 * GNU General Public License for more details. | |
| 18 * | |
| 19 * You should have received a copy of the GNU General Public License | |
| 20 * along with this program; if not, write to the Free Software | |
| 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 22 */ | |
| 23 | |
| 24 #ifdef HAVE_CONFIG_H | |
| 25 # include "config.h" | |
| 26 #endif | |
| 27 | |
| 28 #include "main.h" | |
| 29 | |
| 30 #include <glib.h> | |
| 31 #include <glib/gi18n.h> | |
| 32 #include <glib/gprintf.h> | |
| 33 #include <gdk/gdk.h> | |
| 34 #include <stdlib.h> | |
| 35 #include <string.h> | |
| 36 #include <getopt.h> | |
| 37 #include <ctype.h> | |
| 38 #include <time.h> | |
| 39 | |
| 40 #include <unistd.h> | |
| 41 #include <errno.h> | |
| 42 #include <sys/types.h> | |
| 43 #include <sys/stat.h> | |
| 44 #include <signal.h> | |
| 45 | |
| 46 #include "platform/smartinclude.h" | |
| 47 | |
| 2717 | 48 #include "configdb.h" |
| 2313 | 49 #include "vfs.h" |
| 50 | |
|
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
|
51 #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
|
52 # include "dbus-service.h" |
| 2785 | 53 # 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
|
54 #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
|
55 |
|
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
56 #include "auddrct.h" |
| 2313 | 57 #include "dnd.h" |
| 58 #include "effect.h" | |
| 59 #include "ui_equalizer.h" | |
| 60 #include "general.h" | |
| 61 #include "genevent.h" | |
| 62 #include "hints.h" | |
| 63 #include "input.h" | |
| 64 #include "logger.h" | |
| 65 #include "ui_main.h" | |
| 66 #include "ui_manager.h" | |
| 67 #include "output.h" | |
| 68 #include "playback.h" | |
| 69 #include "playlist.h" | |
| 70 #include "ui_playlist.h" | |
| 71 #include "ui_preferences.h" | |
| 72 #include "pluginenum.h" | |
| 73 #include "ui_skinselector.h" | |
| 74 #include "util.h" | |
| 75 #include "visualization.h" | |
| 76 #include "build_stamp.h" | |
| 77 #include "ui_fileinfo.h" | |
| 78 #include "signals.h" | |
| 2530 | 79 #include "ui_skinned_window.h" |
| 2313 | 80 |
| 81 #include "icons-csource.h" | |
| 82 #include "icons-stock.h" | |
| 83 #include "images/audacious_player.xpm" | |
| 84 | |
| 2364 | 85 gboolean has_x11_connection = FALSE; /* do we have an X11 connection? */ |
| 2313 | 86 |
| 87 /* Translatable string for beep.desktop's comment field */ | |
| 88 const gchar *desktop_comment = N_("Audacious"); | |
| 89 | |
| 90 const gchar *application_name = N_("Audacious"); | |
| 91 | |
| 92 | |
| 93 struct _BmpCmdLineOpt { | |
| 2411 | 94 gchar **filenames; |
| 2313 | 95 gint session; |
| 96 gboolean play, stop, pause, fwd, rew, play_pause, playcd, show_jump_box; | |
| 97 gboolean enqueue, mainwin, remote, activate; | |
| 98 gboolean load_skins; | |
| 99 gboolean headless; | |
| 100 gboolean no_log; | |
| 101 gboolean enqueue_to_temp; | |
| 2411 | 102 gboolean version; |
| 2313 | 103 gchar *previous_session_id; |
| 104 }; | |
| 105 | |
| 106 typedef struct _BmpCmdLineOpt BmpCmdLineOpt; | |
| 107 | |
| 108 BmpCmdLineOpt options; | |
| 109 | |
| 110 BmpConfig cfg; | |
| 111 | |
| 112 BmpConfig bmp_default_config = { | |
| 113 MAINWIN_DEFAULT_POS_X, /* mainwin x position */ | |
| 114 MAINWIN_DEFAULT_POS_Y, /* mainwin y position */ | |
| 115 EQUALIZER_DEFAULT_POS_X, /* equalizer x position */ | |
| 116 EQUALIZER_DEFAULT_POS_Y, /* equalizer y position */ | |
| 117 PLAYLISTWIN_DEFAULT_POS_X, /* playlistwin x position */ | |
| 118 PLAYLISTWIN_DEFAULT_POS_Y, /* playlistwin y position */ | |
| 119 PLAYLISTWIN_DEFAULT_WIDTH, /* playlistwin width */ | |
| 120 PLAYLISTWIN_DEFAULT_HEIGHT, /* playlistwin height */ | |
| 121 10, /* snap distance */ | |
| 122 FALSE, /* real-time priority */ | |
| 123 FALSE, FALSE, /* shuffle, repeat */ | |
| 124 FALSE, /* UNUSED (double size) */ | |
| 125 TRUE, /* autoscroll */ | |
| 126 TRUE, /* analyzer peaks */ | |
| 127 FALSE, /* equalizer autoload */ | |
| 128 FALSE, /* easy move */ | |
| 129 FALSE, /* equalizer active */ | |
| 130 FALSE, /* playlistwin visible */ | |
| 131 FALSE, /* equalizer visible */ | |
| 132 TRUE, /* player visible */ | |
| 133 FALSE, /* player shaded */ | |
| 134 FALSE, /* playlistwin shaded */ | |
| 135 FALSE, /* equalizer shaded */ | |
| 136 FALSE, /* allow multiple instances */ | |
| 137 TRUE, /* always show cb */ | |
| 138 TRUE, TRUE, TRUE, /* convert '_', %20 and '\' */ | |
| 139 TRUE, /* show numbers in playlist */ | |
| 140 TRUE, /* snap windows */ | |
| 141 TRUE, /* save window positions */ | |
| 142 TRUE, /* dim titlebar */ | |
| 143 FALSE, /* get playlist info on load */ | |
| 144 TRUE, /* get playlist info on demand */ | |
| 145 TRUE, /* UNUSED (equalizer doublesize linked) */ | |
| 146 FALSE, /* sort jump to file */ | |
| 147 FALSE, /* use effect plugins */ | |
| 148 FALSE, /* always on top */ | |
| 149 FALSE, /* sticky */ | |
| 150 FALSE, /* no playlist advance */ | |
| 151 FALSE, /* stop after current song */ | |
| 152 TRUE, /* refresh file list */ | |
| 153 TRUE, /* UNUSED (smooth title scrolling) */ | |
| 154 TRUE, /* use playlist metadata */ | |
|
2662
09b404d61ebd
[svn] - remove the unplayable files dialog. it is more annoying than useful.
nenolod
parents:
2651
diff
changeset
|
155 TRUE, /* deprecated */ |
|
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
156 TRUE, /* warn about windows visibility */ |
| 2313 | 157 FALSE, /* use \ as directory delimiter */ |
| 158 FALSE, /* random skin on play */ | |
| 159 FALSE, /* use fontsets */ | |
| 160 FALSE, /* use X font for mainwin */ | |
| 2364 | 161 TRUE, /* use custom cursors */ |
| 162 TRUE, /* close dialog on open */ | |
| 163 TRUE, /* close dialog on add */ | |
| 2313 | 164 0.0, /* equalizer preamp */ |
| 165 {0, 0, 0, 0, 0, /* equalizer bands */ | |
| 166 0, 0, 0, 0, 0}, | |
| 167 NULL, /* skin */ | |
| 168 NULL, /* output plugin */ | |
| 169 NULL, /* file selector path */ | |
| 170 NULL, /* playlist path */ | |
| 171 NULL, /* playlist font */ | |
| 172 NULL, /* mainwin font */ | |
| 173 NULL, /* disabled input plugins */ | |
| 174 NULL, /* enabled general plugins */ | |
| 175 NULL, /* enabled visualization plugins */ | |
| 176 NULL, /* enabled effect plugins */ | |
| 177 NULL, /* equalizer preset default file */ | |
| 178 NULL, /* equalizer preset extension */ | |
| 179 NULL, /* URL history */ | |
| 180 0, /* timer mode */ | |
| 181 VIS_ANALYZER, /* visualizer type */ | |
| 182 ANALYZER_NORMAL, /* analyzer mode */ | |
| 183 ANALYZER_BARS, /* analyzer type */ | |
| 184 SCOPE_DOT, /* scope mode */ | |
| 185 VOICEPRINT_NORMAL, /* voiceprint mode */ | |
| 186 VU_SMOOTH, /* VU mode */ | |
| 187 REFRESH_FULL, /* visualizer refresh rate */ | |
| 188 FALLOFF_FAST, /* analyzer fall off rate */ | |
| 189 FALLOFF_SLOW, /* peaks fall off rate */ | |
| 190 0, /* playlist position */ | |
| 191 2, /* pause between songs time */ | |
| 192 FALSE, /* pause between songs */ | |
| 193 FALSE, /* show window decorations */ | |
| 194 8, /* mouse wheel scroll step */ | |
| 195 FALSE, /* playlist transparent */ | |
| 196 2, /* 3rd preset (ARTIST - ALBUM - TITLE) */ | |
| 197 NULL, /* title format */ | |
| 198 FALSE, /* software volume control enabled */ | |
| 199 TRUE, /* UNUSED (XMMS compatibility mode) */ | |
| 200 TRUE, /* extra eq filtering */ | |
| 201 3, /* scroll pl by */ | |
| 202 FALSE, /* resume playback on startup */ | |
| 203 -1, /* resume playback on startup time */ | |
| 2364 | 204 TRUE, /* show seperators in pl */ |
| 2313 | 205 NULL, |
| 206 NULL, | |
| 2364 | 207 3000, /* audio buffer size */ |
| 208 FALSE, /* whether or not to postpone format detection on initial add */ | |
| 209 TRUE, /* show filepopup for tuple */ | |
| 210 NULL, /* words identifying covers */ | |
| 211 NULL, /* words that might not show up in cover names */ | |
| 2313 | 212 FALSE, |
| 213 0, | |
| 2364 | 214 NULL, /* default session uri base (non-NULL = custom session uri base) */ |
| 215 150, /* short side length of the picture in the filepopup */ | |
| 216 20, /* delay until the filepopup comes up */ | |
| 217 FALSE, /* use filename.jpg for coverart */ | |
| 218 FALSE, /* use XMMS-style file selection */ | |
| 219 TRUE, /* use extension probing */ | |
| 220 255, 255, 255, /* colorize r, g, b */ | |
| 221 FALSE, /* internal: whether or not to terminate */ | |
| 2405 | 222 TRUE, /* whether show progress bar in filepopup or not */ |
| 2806 | 223 TRUE, /* close jtf dialog on jump */ |
| 2313 | 224 }; |
| 225 | |
| 226 typedef struct bmp_cfg_boolent_t { | |
| 227 char const *be_vname; | |
| 228 gboolean *be_vloc; | |
| 229 gboolean be_wrt; | |
| 230 } bmp_cfg_boolent; | |
| 231 | |
| 232 typedef struct bmp_cfg_nument_t { | |
| 233 char const *ie_vname; | |
| 234 gint *ie_vloc; | |
| 235 gboolean ie_wrt; | |
| 236 } bmp_cfg_nument; | |
| 237 | |
| 238 typedef struct bmp_cfg_strent_t { | |
| 239 char const *se_vname; | |
| 240 char **se_vloc; | |
| 241 gboolean se_wrt; | |
| 242 } bmp_cfg_strent; | |
| 243 | |
| 244 const gchar *bmp_titlestring_presets[] = { | |
| 245 "%t", | |
| 246 "%{p:%p - %}%t", | |
| 247 "%{p:%p - %}%{a:%a - %}%t", | |
| 248 "%{p:%p - %}%{a:%a - %}%{n:%n. %}%t", | |
| 249 "%{p:%p %}%{a:[ %a ] %}%{p:- %}%{n:%n. %}%{t:%t%}", | |
| 250 "%{a:%a - %}%t" | |
| 251 }; | |
| 252 | |
| 253 const guint n_titlestring_presets = G_N_ELEMENTS(bmp_titlestring_presets); | |
| 254 | |
| 255 const gchar *chardet_detector_presets[] = { | |
| 2364 | 256 "None", |
| 257 "Japanese", | |
| 258 "Taiwanese", | |
| 259 "Chinese", | |
| 260 "Korean", | |
| 261 "Russian", | |
| 2313 | 262 #ifdef HAVE_UDET |
| 2364 | 263 "Universal" |
| 2313 | 264 #endif |
| 265 }; | |
| 266 | |
| 2364 | 267 const guint n_chardet_detector_presets = G_N_ELEMENTS(chardet_detector_presets); |
| 2313 | 268 |
| 269 static bmp_cfg_boolent bmp_boolents[] = { | |
| 270 {"allow_multiple_instances", &cfg.allow_multiple_instances, TRUE}, | |
| 271 {"use_realtime", &cfg.use_realtime, TRUE}, | |
| 272 {"always_show_cb", &cfg.always_show_cb, TRUE}, | |
| 273 {"convert_underscore", &cfg.convert_underscore, TRUE}, | |
| 274 {"convert_twenty", &cfg.convert_twenty, TRUE}, | |
| 275 {"convert_slash", &cfg.convert_slash, TRUE }, | |
| 276 {"show_numbers_in_pl", &cfg.show_numbers_in_pl, TRUE}, | |
| 277 {"show_separator_in_pl", &cfg.show_separator_in_pl, TRUE}, | |
| 278 {"snap_windows", &cfg.snap_windows, TRUE}, | |
| 279 {"save_window_positions", &cfg.save_window_position, TRUE}, | |
| 280 {"dim_titlebar", &cfg.dim_titlebar, TRUE}, | |
| 281 {"get_info_on_load", &cfg.get_info_on_load, TRUE}, | |
| 282 {"get_info_on_demand", &cfg.get_info_on_demand, TRUE}, | |
| 283 {"eq_doublesize_linked", &cfg.eq_doublesize_linked, TRUE}, | |
| 284 {"no_playlist_advance", &cfg.no_playlist_advance, TRUE}, | |
| 285 {"refresh_file_list", &cfg.refresh_file_list, TRUE}, | |
| 286 {"sort_jump_to_file", &cfg.sort_jump_to_file, TRUE}, | |
| 287 {"use_pl_metadata", &cfg.use_pl_metadata, TRUE}, | |
|
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
288 {"warn_about_win_visibility", &cfg.warn_about_win_visibility, TRUE}, |
| 2313 | 289 {"use_backslash_as_dir_delimiter", &cfg.use_backslash_as_dir_delimiter, TRUE}, |
| 290 {"player_shaded", &cfg.player_shaded, TRUE}, | |
| 291 {"player_visible", &cfg.player_visible, TRUE}, | |
| 292 {"shuffle", &cfg.shuffle, TRUE}, | |
| 293 {"repeat", &cfg.repeat, TRUE}, | |
| 294 {"doublesize", &cfg.doublesize, TRUE}, | |
| 295 {"autoscroll_songname", &cfg.autoscroll, TRUE}, | |
| 296 {"stop_after_current_song", &cfg.stopaftersong, TRUE}, | |
| 297 {"playlist_shaded", &cfg.playlist_shaded, TRUE}, | |
| 298 {"playlist_visible", &cfg.playlist_visible, TRUE}, | |
| 299 {"use_fontsets", &cfg.use_fontsets, TRUE}, | |
| 300 {"mainwin_use_xfont", &cfg.mainwin_use_xfont, FALSE}, | |
| 301 {"equalizer_visible", &cfg.equalizer_visible, TRUE}, | |
| 302 {"equalizer_active", &cfg.equalizer_active, TRUE}, | |
| 303 {"equalizer_shaded", &cfg.equalizer_shaded, TRUE}, | |
| 304 {"equalizer_autoload", &cfg.equalizer_autoload, TRUE}, | |
| 305 {"easy_move", &cfg.easy_move, TRUE}, | |
| 306 {"use_eplugins", &cfg.use_eplugins, TRUE}, | |
| 307 {"always_on_top", &cfg.always_on_top, TRUE}, | |
| 308 {"sticky", &cfg.sticky, TRUE}, | |
| 309 {"random_skin_on_play", &cfg.random_skin_on_play, TRUE}, | |
| 310 {"pause_between_songs", &cfg.pause_between_songs, TRUE}, | |
| 311 {"show_wm_decorations", &cfg.show_wm_decorations, TRUE}, | |
| 312 {"eq_extra_filtering", &cfg.eq_extra_filtering, TRUE}, | |
| 313 {"analyzer_peaks", &cfg.analyzer_peaks, TRUE}, | |
| 314 {"custom_cursors", &cfg.custom_cursors, TRUE}, | |
| 315 {"close_dialog_open", &cfg.close_dialog_open, TRUE}, | |
| 316 {"close_dialog_add", &cfg.close_dialog_add, TRUE}, | |
| 317 {"resume_playback_on_startup", &cfg.resume_playback_on_startup, TRUE}, | |
| 318 {"playlist_detect", &cfg.playlist_detect, TRUE}, | |
| 319 {"show_filepopup_for_tuple", &cfg.show_filepopup_for_tuple, TRUE}, | |
| 320 {"recurse_for_cover", &cfg.recurse_for_cover, TRUE}, | |
| 321 {"use_file_cover", &cfg.use_file_cover, TRUE}, | |
| 322 {"use_xmms_style_fileselector", &cfg.use_xmms_style_fileselector, TRUE}, | |
| 323 {"use_extension_probing", &cfg.use_extension_probing, TRUE}, | |
| 2405 | 324 {"filepopup_showprogressbar", &cfg.filepopup_showprogressbar, TRUE}, |
|
2805
6295535fbf49
[svn] - add toggle button to keep jtf dialog opened on jump.
yaz
parents:
2788
diff
changeset
|
325 {"close_jtf_dialog", &cfg.close_jtf_dialog, TRUE}, |
| 2313 | 326 }; |
| 327 | |
| 328 static gint ncfgbent = G_N_ELEMENTS(bmp_boolents); | |
| 329 | |
| 330 static bmp_cfg_nument bmp_numents[] = { | |
| 331 {"player_x", &cfg.player_x, TRUE}, | |
| 332 {"player_y", &cfg.player_y, TRUE}, | |
| 333 {"timer_mode", &cfg.timer_mode, TRUE}, | |
| 334 {"vis_type", &cfg.vis_type, TRUE}, | |
| 335 {"analyzer_mode", &cfg.analyzer_mode, TRUE}, | |
| 336 {"analyzer_type", &cfg.analyzer_type, TRUE}, | |
| 337 {"scope_mode", &cfg.scope_mode, TRUE}, | |
| 338 {"vu_mode", &cfg.vu_mode, TRUE}, | |
| 339 {"voiceprint_mode", &cfg.voiceprint_mode, TRUE}, | |
| 340 {"vis_refresh_rate", &cfg.vis_refresh, TRUE}, | |
| 341 {"analyzer_falloff", &cfg.analyzer_falloff, TRUE}, | |
| 342 {"peaks_falloff", &cfg.peaks_falloff, TRUE}, | |
| 343 {"playlist_x", &cfg.playlist_x, TRUE}, | |
| 344 {"playlist_y", &cfg.playlist_y, TRUE}, | |
| 345 {"playlist_width", &cfg.playlist_width, TRUE}, | |
| 346 {"playlist_height", &cfg.playlist_height, TRUE}, | |
| 347 {"playlist_position", &cfg.playlist_position, TRUE}, | |
| 348 {"equalizer_x", &cfg.equalizer_x, TRUE}, | |
| 349 {"equalizer_y", &cfg.equalizer_y, TRUE}, | |
| 350 {"snap_distance", &cfg.snap_distance, TRUE}, | |
| 351 {"pause_between_songs_time", &cfg.pause_between_songs_time, TRUE}, | |
| 352 {"mouse_wheel_change", &cfg.mouse_change, TRUE}, | |
| 353 {"scroll_pl_by", &cfg.scroll_pl_by, TRUE}, | |
| 354 {"titlestring_preset", &cfg.titlestring_preset, TRUE}, | |
| 355 {"resume_playback_on_startup_time", &cfg.resume_playback_on_startup_time, TRUE}, | |
| 356 {"output_buffer_size", &cfg.output_buffer_size, TRUE}, | |
| 357 {"recurse_for_cover_depth", &cfg.recurse_for_cover_depth, TRUE}, | |
| 358 {"filepopup_pixelsize", &cfg.filepopup_pixelsize, TRUE}, | |
| 359 {"filepopup_delay", &cfg.filepopup_delay, TRUE}, | |
| 360 {"colorize_r", &cfg.colorize_r, TRUE}, | |
| 361 {"colorize_g", &cfg.colorize_g, TRUE}, | |
| 362 {"colorize_b", &cfg.colorize_b, TRUE}, | |
| 363 }; | |
| 364 | |
| 365 static gint ncfgient = G_N_ELEMENTS(bmp_numents); | |
| 366 | |
| 367 static bmp_cfg_strent bmp_strents[] = { | |
| 368 {"playlist_font", &cfg.playlist_font, TRUE}, | |
| 369 {"mainwin_font", &cfg.mainwin_font, TRUE}, | |
| 370 {"eqpreset_default_file", &cfg.eqpreset_default_file, TRUE}, | |
| 371 {"eqpreset_extension", &cfg.eqpreset_extension, TRUE}, | |
| 372 {"skin", &cfg.skin, FALSE}, | |
| 373 {"output_plugin", &cfg.outputplugin, FALSE}, | |
| 374 {"disabled_iplugins", &cfg.disabled_iplugins, TRUE}, | |
| 375 {"enabled_gplugins", &cfg.enabled_gplugins, FALSE}, | |
| 376 {"enabled_vplugins", &cfg.enabled_vplugins, FALSE}, | |
| 377 {"enabled_eplugins", &cfg.enabled_eplugins, FALSE}, | |
| 378 {"filesel_path", &cfg.filesel_path, FALSE}, | |
| 379 {"playlist_path", &cfg.playlist_path, FALSE}, | |
| 380 {"generic_title_format", &cfg.gentitle_format, TRUE}, | |
| 381 {"chardet_detector", &cfg.chardet_detector, TRUE}, | |
| 382 {"chardet_fallback", &cfg.chardet_fallback, TRUE}, | |
| 383 {"cover_name_include", &cfg.cover_name_include, TRUE}, | |
| 384 {"cover_name_exclude", &cfg.cover_name_exclude, TRUE}, | |
| 385 {"session_uri_base", &cfg.session_uri_base, TRUE} | |
| 386 }; | |
| 387 | |
| 388 static gint ncfgsent = G_N_ELEMENTS(bmp_strents); | |
| 389 | |
| 390 gchar *bmp_paths[BMP_PATH_COUNT] = {}; | |
| 391 | |
| 392 GList *dock_window_list = NULL; | |
| 393 | |
| 394 /* XXX: case-sensitivity is bad for lazy nenolods. :( -nenolod */ | |
| 395 static gchar *pl_candidates[] = { | |
| 2364 | 396 PLUGIN_FILENAME("ALSA"), |
| 397 PLUGIN_FILENAME("coreaudio"), | |
| 398 PLUGIN_FILENAME("OSS"), | |
| 399 PLUGIN_FILENAME("sun"), | |
| 400 PLUGIN_FILENAME("ESD"), | |
| 401 PLUGIN_FILENAME("pulse_audio"), | |
| 402 PLUGIN_FILENAME("disk_writer"), | |
| 403 NULL | |
| 2313 | 404 }; |
| 405 | |
| 406 GCond *cond_scan; | |
| 407 GMutex *mutex_scan; | |
| 408 | |
| 409 static GSList * | |
| 410 get_feature_list(void) | |
| 411 { | |
| 412 GSList *features = NULL; | |
| 413 | |
| 414 #ifdef HAVE_GCONF | |
| 415 features = g_slist_append(features, "GConf"); | |
| 416 #endif | |
| 417 | |
| 418 return features; | |
| 419 } | |
| 420 | |
| 421 static void | |
| 422 dump_version(void) | |
| 423 { | |
| 424 GSList *features; | |
| 425 | |
| 426 g_printf("%s %s [%s]", _(application_name), VERSION, svn_stamp); | |
| 427 | |
| 428 features = get_feature_list(); | |
| 429 | |
| 430 if (features) { | |
| 431 GSList *item; | |
| 432 | |
| 433 g_printf(" ("); | |
| 434 | |
| 435 for (item = features; g_slist_next(item); item = g_slist_next(item)) | |
| 436 g_printf("%s, ", (const gchar *) item->data); | |
| 437 | |
| 438 g_printf("%s)", (const gchar *) item->data); | |
| 439 | |
| 440 g_slist_free(features); | |
| 441 } | |
| 442 | |
| 443 g_printf("\n"); | |
| 444 } | |
| 445 | |
| 446 const gchar * | |
| 447 xmms_get_gentitle_format(void) | |
| 448 { | |
| 449 guint titlestring_preset = cfg.titlestring_preset; | |
| 450 | |
| 451 if (titlestring_preset < n_titlestring_presets) | |
| 2364 | 452 return bmp_titlestring_presets[titlestring_preset]; |
| 2313 | 453 |
| 454 return cfg.gentitle_format; | |
| 455 } | |
| 456 | |
| 457 void | |
| 458 make_directory(const gchar * path, mode_t mode) | |
| 459 { | |
|
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
460 if (g_mkdir_with_parents(path, mode) == 0) |
| 2313 | 461 return; |
| 462 | |
|
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
463 g_printerr(_("Could not create directory (%s): %s\n"), path, |
| 2313 | 464 g_strerror(errno)); |
| 465 } | |
| 466 | |
| 467 static void | |
| 468 bmp_make_user_dir(void) | |
| 469 { | |
| 470 const mode_t mode755 = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; | |
| 471 | |
| 472 make_directory(bmp_paths[BMP_PATH_USER_DIR], mode755); | |
| 473 make_directory(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], mode755); | |
| 474 make_directory(bmp_paths[BMP_PATH_USER_SKIN_DIR], mode755); | |
| 475 make_directory(bmp_paths[BMP_PATH_SKIN_THUMB_DIR], mode755); | |
| 476 } | |
| 477 | |
| 478 static void | |
| 479 bmp_free_paths(void) | |
| 480 { | |
| 481 int i; | |
| 482 | |
| 483 for (i = 0; i < BMP_PATH_COUNT; i++) | |
| 484 { | |
| 485 g_free(bmp_paths[i]); | |
| 486 bmp_paths[i] = 0; | |
| 487 } | |
| 488 } | |
| 489 | |
|
2317
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
490 static void |
|
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
491 bmp_init_paths() |
|
49d285f6008b
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
js
parents:
2313
diff
changeset
|
492 { |
| 2364 | 493 char *xdg_config_home; |
| 494 char *xdg_data_home; | |
| 495 char *xdg_cache_home; | |
| 2313 | 496 |
| 2364 | 497 xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL |
| 498 ? g_build_filename(g_get_home_dir(), ".config", NULL) | |
| 499 : g_strdup(getenv("XDG_CONFIG_HOME"))); | |
| 500 xdg_data_home = (getenv("XDG_DATA_HOME") == NULL | |
| 501 ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) | |
| 502 : g_strdup(getenv("XDG_DATA_HOME"))); | |
| 503 xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL | |
| 504 ? g_build_filename(g_get_home_dir(), ".cache", NULL) | |
| 505 : g_strdup(getenv("XDG_CACHE_HOME"))); | |
| 2313 | 506 |
| 2364 | 507 bmp_paths[BMP_PATH_USER_DIR] = |
| 508 g_build_filename(xdg_config_home, "audacious", NULL); | |
| 509 bmp_paths[BMP_PATH_USER_SKIN_DIR] = | |
| 510 g_build_filename(xdg_data_home, "audacious", "Skins", NULL); | |
| 511 bmp_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
|
512 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
|
513 |
| 2364 | 514 bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = |
| 515 g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); | |
| 2313 | 516 |
| 2364 | 517 bmp_paths[BMP_PATH_CONFIG_FILE] = |
| 518 g_build_filename(bmp_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
|
519 #ifdef HAVE_XSPF_PLAYLIST |
| 2364 | 520 bmp_paths[BMP_PATH_PLAYLIST_FILE] = |
| 521 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], | |
| 522 "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
|
523 #else |
| 2364 | 524 bmp_paths[BMP_PATH_PLAYLIST_FILE] = |
| 525 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], | |
| 526 "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
|
527 #endif |
| 2364 | 528 bmp_paths[BMP_PATH_ACCEL_FILE] = |
| 529 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "accels", NULL); | |
| 530 bmp_paths[BMP_PATH_LOG_FILE] = | |
| 531 g_build_filename(bmp_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
|
532 |
| 2463 | 533 bmp_paths[BMP_PATH_GTKRC_FILE] = |
| 2570 | 534 g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "gtkrc", NULL); |
| 2463 | 535 |
| 2364 | 536 g_free(xdg_config_home); |
| 537 g_free(xdg_data_home); | |
| 538 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
|
539 |
| 2364 | 540 g_atexit(bmp_free_paths); |
| 2313 | 541 } |
| 542 | |
| 543 void | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
544 bmp_config_free(void) |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
545 { |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
546 gint i; |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
547 for (i = 0; i < ncfgsent; ++i) { |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
548 if ( *(bmp_strents[i].se_vloc) != NULL ) |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
549 { |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
550 g_free( *(bmp_strents[i].se_vloc) ); |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
551 *(bmp_strents[i].se_vloc) = NULL; |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
552 } |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
553 } |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
554 } |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
555 |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2662
diff
changeset
|
556 void |
| 2313 | 557 bmp_config_load(void) |
| 558 { | |
| 559 ConfigDb *db; | |
| 560 gint i, length; | |
| 561 | |
| 562 memcpy(&cfg, &bmp_default_config, sizeof(BmpConfig)); | |
| 563 | |
| 564 db = bmp_cfg_db_open(); | |
| 565 for (i = 0; i < ncfgbent; ++i) { | |
| 566 bmp_cfg_db_get_bool(db, NULL, | |
| 567 bmp_boolents[i].be_vname, | |
| 568 bmp_boolents[i].be_vloc); | |
| 569 } | |
| 570 | |
| 571 for (i = 0; i < ncfgient; ++i) { | |
| 572 bmp_cfg_db_get_int(db, NULL, | |
| 573 bmp_numents[i].ie_vname, | |
| 574 bmp_numents[i].ie_vloc); | |
| 575 } | |
| 576 | |
| 577 for (i = 0; i < ncfgsent; ++i) { | |
| 578 bmp_cfg_db_get_string(db, NULL, | |
| 579 bmp_strents[i].se_vname, | |
| 580 bmp_strents[i].se_vloc); | |
| 581 } | |
| 582 | |
| 583 /* Preset */ | |
| 584 bmp_cfg_db_get_float(db, NULL, "equalizer_preamp", &cfg.equalizer_preamp); | |
| 585 for (i = 0; i < 10; i++) { | |
| 586 gchar eqtext[18]; | |
| 587 | |
| 588 g_snprintf(eqtext, sizeof(eqtext), "equalizer_band%d", i); | |
| 589 bmp_cfg_db_get_float(db, NULL, eqtext, &cfg.equalizer_bands[i]); | |
| 590 } | |
| 591 | |
| 592 /* History */ | |
| 593 if (bmp_cfg_db_get_int(db, NULL, "url_history_length", &length)) { | |
| 594 for (i = 1; i <= length; i++) { | |
| 595 gchar str[19], *tmp; | |
| 596 | |
| 597 g_snprintf(str, sizeof(str), "url_history%d", i); | |
| 598 if (bmp_cfg_db_get_string(db, NULL, str, &tmp)) | |
| 599 cfg.url_history = g_list_append(cfg.url_history, tmp); | |
| 600 } | |
| 601 } | |
| 602 | |
| 603 bmp_cfg_db_close(db); | |
| 604 | |
| 605 | |
| 606 if (cfg.playlist_font && strlen(cfg.playlist_font) == 0) { | |
| 607 g_free(cfg.playlist_font); | |
| 608 cfg.playlist_font = NULL; | |
| 609 } | |
| 610 | |
| 611 if (cfg.mainwin_font && strlen(cfg.mainwin_font) == 0) { | |
| 612 g_free(cfg.mainwin_font); | |
| 613 cfg.mainwin_font = NULL; | |
| 614 } | |
| 615 | |
| 616 if (!cfg.playlist_font) | |
| 617 cfg.playlist_font = g_strdup(PLAYLISTWIN_DEFAULT_FONT); | |
| 618 | |
| 619 if (!cfg.mainwin_font) | |
| 620 cfg.mainwin_font = g_strdup(MAINWIN_DEFAULT_FONT); | |
| 621 | |
| 622 if (!cfg.gentitle_format) | |
| 623 cfg.gentitle_format = g_strdup("%{p:%p - %}%{a:%a - %}%t"); | |
| 624 | |
| 625 if (!cfg.outputplugin) { | |
| 2364 | 626 gint iter; |
| 2313 | 627 gchar *pl_path = g_build_filename(PLUGIN_DIR, plugin_dir_list[0], NULL); |
| 628 | |
| 629 for (iter = 0; pl_candidates[iter] != NULL && cfg.outputplugin == NULL; iter++) | |
| 2364 | 630 { |
| 631 cfg.outputplugin = find_file_recursively(pl_path, pl_candidates[iter]); | |
| 632 } | |
| 2313 | 633 |
| 634 g_free(pl_path); | |
| 635 } | |
| 636 | |
| 637 if (!cfg.eqpreset_default_file) | |
| 638 cfg.eqpreset_default_file = g_strdup(EQUALIZER_DEFAULT_DIR_PRESET); | |
| 639 | |
| 640 if (!cfg.eqpreset_extension) | |
| 641 cfg.eqpreset_extension = g_strdup(EQUALIZER_DEFAULT_PRESET_EXT); | |
| 642 | |
| 643 if (!cfg.chardet_detector) | |
| 644 cfg.chardet_detector = g_strdup(""); | |
| 645 | |
| 646 if (!cfg.chardet_fallback) | |
| 647 cfg.chardet_fallback = g_strdup(""); | |
| 648 | |
| 649 if (!cfg.cover_name_include) | |
| 2364 | 650 cfg.cover_name_include = g_strdup(""); |
| 2313 | 651 |
| 652 if (!cfg.cover_name_exclude) | |
| 2364 | 653 cfg.cover_name_exclude = g_strdup("back"); |
| 2313 | 654 |
| 655 if (!cfg.session_uri_base) | |
| 656 cfg.session_uri_base = g_strdup(""); | |
| 657 | |
| 658 /* at least one of these should be true */ | |
| 659 if ((!cfg.get_info_on_demand) && (!cfg.get_info_on_load)) | |
| 660 cfg.get_info_on_demand = TRUE; | |
| 661 } | |
| 662 | |
| 663 | |
| 664 void | |
| 665 bmp_config_save(void) | |
| 666 { | |
| 667 GList *node; | |
| 668 gchar *str; | |
| 669 gint i, cur_pb_time; | |
| 670 ConfigDb *db; | |
| 671 Playlist *playlist = playlist_get_active(); | |
| 672 | |
| 673 cfg.disabled_iplugins = input_stringify_disabled_list(); | |
| 674 | |
| 675 | |
| 676 db = bmp_cfg_db_open(); | |
| 677 | |
| 678 for (i = 0; i < ncfgbent; ++i) | |
| 679 if (bmp_boolents[i].be_wrt) | |
| 680 bmp_cfg_db_set_bool(db, NULL, | |
| 681 bmp_boolents[i].be_vname, | |
| 682 *bmp_boolents[i].be_vloc); | |
| 683 | |
| 684 for (i = 0; i < ncfgient; ++i) | |
| 685 if (bmp_numents[i].ie_wrt) | |
| 686 bmp_cfg_db_set_int(db, NULL, | |
| 687 bmp_numents[i].ie_vname, | |
| 688 *bmp_numents[i].ie_vloc); | |
| 689 | |
| 690 /* This is a bit lame .. it'll end up being written twice, | |
| 691 * could do with being done a bit neater. -larne */ | |
| 692 bmp_cfg_db_set_int(db, NULL, "playlist_position", | |
| 693 playlist_get_position(playlist)); | |
| 694 | |
| 2530 | 695 /* FIXME: we're looking up SkinnedWindow::x &c ourselves here. |
| 696 * this isn't exactly right. -nenolod | |
| 697 */ | |
|
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
698 if ( SKINNED_WINDOW(playlistwin)->x != -1 && |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
699 SKINNED_WINDOW(playlistwin)->y != -1 ) |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
700 { |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
701 bmp_cfg_db_set_int(db, NULL, "playlist_x", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
702 SKINNED_WINDOW(playlistwin)->x); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
703 bmp_cfg_db_set_int(db, NULL, "playlist_y", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
704 SKINNED_WINDOW(playlistwin)->y); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
705 } |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
706 |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
707 if ( SKINNED_WINDOW(mainwin)->x != -1 && |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
708 SKINNED_WINDOW(mainwin)->y != -1 ) |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
709 { |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
710 bmp_cfg_db_set_int(db, NULL, "player_x", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
711 SKINNED_WINDOW(mainwin)->x); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
712 bmp_cfg_db_set_int(db, NULL, "player_y", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
713 SKINNED_WINDOW(mainwin)->y); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
714 } |
| 2530 | 715 |
|
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
716 if ( SKINNED_WINDOW(equalizerwin)->x != -1 && |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
717 SKINNED_WINDOW(equalizerwin)->y != -1 ) |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
718 { |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
719 bmp_cfg_db_set_int(db, NULL, "equalizer_x", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
720 SKINNED_WINDOW(equalizerwin)->x); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
721 bmp_cfg_db_set_int(db, NULL, "equalizer_y", |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
722 SKINNED_WINDOW(equalizerwin)->y); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
723 } |
| 2530 | 724 |
| 2313 | 725 bmp_cfg_db_set_bool(db, NULL, "mainwin_use_xfont", |
| 2364 | 726 cfg.mainwin_use_xfont); |
| 2313 | 727 |
| 728 for (i = 0; i < ncfgsent; ++i) { | |
| 729 if (bmp_strents[i].se_wrt) | |
| 730 bmp_cfg_db_set_string(db, NULL, | |
| 731 bmp_strents[i].se_vname, | |
| 732 *bmp_strents[i].se_vloc); | |
| 733 } | |
| 734 | |
| 735 bmp_cfg_db_set_float(db, NULL, "equalizer_preamp", cfg.equalizer_preamp); | |
| 736 | |
| 737 for (i = 0; i < 10; i++) { | |
| 738 str = g_strdup_printf("equalizer_band%d", i); | |
| 739 bmp_cfg_db_set_float(db, NULL, str, cfg.equalizer_bands[i]); | |
| 740 g_free(str); | |
| 741 } | |
| 742 | |
| 743 if (bmp_active_skin != NULL) | |
| 744 { | |
| 745 if (bmp_active_skin->path) | |
| 746 bmp_cfg_db_set_string(db, NULL, "skin", bmp_active_skin->path); | |
| 747 else | |
| 748 bmp_cfg_db_unset_key(db, NULL, "skin"); | |
| 749 } | |
| 750 | |
| 751 if (get_current_output_plugin()) | |
| 752 bmp_cfg_db_set_string(db, NULL, "output_plugin", | |
| 753 get_current_output_plugin()->filename); | |
| 754 else | |
| 755 bmp_cfg_db_unset_key(db, NULL, "output_plugin"); | |
| 756 | |
| 757 str = general_stringify_enabled_list(); | |
| 758 if (str) { | |
| 759 bmp_cfg_db_set_string(db, NULL, "enabled_gplugins", str); | |
| 760 g_free(str); | |
| 761 } | |
| 762 else | |
| 763 bmp_cfg_db_unset_key(db, NULL, "enabled_gplugins"); | |
| 764 | |
| 765 str = vis_stringify_enabled_list(); | |
| 766 if (str) { | |
| 767 bmp_cfg_db_set_string(db, NULL, "enabled_vplugins", str); | |
| 768 g_free(str); | |
| 769 } | |
| 770 else | |
| 771 bmp_cfg_db_unset_key(db, NULL, "enabled_vplugins"); | |
| 772 | |
| 773 str = effect_stringify_enabled_list(); | |
| 774 if (str) { | |
| 775 bmp_cfg_db_set_string(db, NULL, "enabled_eplugins", str); | |
| 776 g_free(str); | |
| 777 } | |
| 778 else | |
| 779 bmp_cfg_db_unset_key(db, NULL, "enabled_eplugins"); | |
| 780 | |
| 781 if (cfg.filesel_path) | |
| 782 bmp_cfg_db_set_string(db, NULL, "filesel_path", cfg.filesel_path); | |
| 783 | |
| 784 if (cfg.playlist_path) | |
| 785 bmp_cfg_db_set_string(db, NULL, "playlist_path", cfg.playlist_path); | |
| 786 | |
| 787 bmp_cfg_db_set_int(db, NULL, "url_history_length", | |
| 788 g_list_length(cfg.url_history)); | |
| 789 | |
| 790 for (node = cfg.url_history, i = 1; node; node = g_list_next(node), i++) { | |
| 791 str = g_strdup_printf("url_history%d", i); | |
| 792 bmp_cfg_db_set_string(db, NULL, str, node->data); | |
| 793 g_free(str); | |
| 794 } | |
| 795 | |
| 796 if (playback_get_playing()) { | |
| 2364 | 797 cur_pb_time = playback_get_time(); |
| 2313 | 798 } else |
| 2364 | 799 cur_pb_time = -1; |
| 2313 | 800 cfg.resume_playback_on_startup_time = cur_pb_time; |
| 801 bmp_cfg_db_set_int(db, NULL, "resume_playback_on_startup_time", | |
| 2364 | 802 cfg.resume_playback_on_startup_time); |
| 2313 | 803 |
| 804 bmp_cfg_db_close(db); | |
| 805 | |
| 806 playlist_save(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
| 807 } | |
| 808 | |
| 809 static void | |
| 810 bmp_set_default_icon(void) | |
| 811 { | |
| 812 GdkPixbuf *icon; | |
| 813 | |
| 814 icon = gdk_pixbuf_new_from_xpm_data((const gchar **) audacious_player_xpm); | |
| 815 gtk_window_set_default_icon(icon); | |
| 816 g_object_unref(icon); | |
| 817 } | |
| 818 | |
| 819 static void | |
| 820 register_aud_stock_icons(void) | |
| 821 { | |
| 822 GtkIconFactory *iconfactory = gtk_icon_factory_new(); | |
| 823 GtkIconSet *iconset; | |
| 824 GdkPixbuf *pixbuf; | |
| 825 | |
| 826 /* pick images in icons-csource.h */ | |
| 827 pixbuf = gdk_pixbuf_new_from_inline( -1 , removedups_pixbuf , FALSE , NULL ); | |
| 828 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 829 gtk_icon_factory_add( iconfactory , AUD_STOCK_REMOVEDUPS , iconset ); | |
| 830 pixbuf = gdk_pixbuf_new_from_inline( -1 , removeunavail_pixbuf , FALSE , NULL ); | |
| 831 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 832 gtk_icon_factory_add( iconfactory , AUD_STOCK_REMOVEUNAVAIL , iconset ); | |
| 833 pixbuf = gdk_pixbuf_new_from_inline( -1 , randomizepl_pixbuf , FALSE , NULL ); | |
| 834 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 835 gtk_icon_factory_add( iconfactory , AUD_STOCK_RANDOMIZEPL , iconset ); | |
| 836 pixbuf = gdk_pixbuf_new_from_inline( -1 , sortbytitle_pixbuf , FALSE , NULL ); | |
| 837 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 838 gtk_icon_factory_add( iconfactory , AUD_STOCK_SORTBYTITLE , iconset ); | |
| 839 pixbuf = gdk_pixbuf_new_from_inline( -1 , sortbyfilename_pixbuf , FALSE , NULL ); | |
| 840 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 841 gtk_icon_factory_add( iconfactory , AUD_STOCK_SORTBYFILENAME , iconset ); | |
| 842 pixbuf = gdk_pixbuf_new_from_inline( -1 , sortbyartist_pixbuf , FALSE , NULL ); | |
| 843 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 844 gtk_icon_factory_add( iconfactory , AUD_STOCK_SORTBYARTIST , iconset ); | |
| 845 pixbuf = gdk_pixbuf_new_from_inline( -1 , sortbypathfile_pixbuf , FALSE , NULL ); | |
| 846 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 847 gtk_icon_factory_add( iconfactory , AUD_STOCK_SORTBYPATHFILE , iconset ); | |
| 848 pixbuf = gdk_pixbuf_new_from_inline( -1 , selectnone_pixbuf , FALSE , NULL ); | |
| 849 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 850 gtk_icon_factory_add( iconfactory , AUD_STOCK_SELECTNONE , iconset ); | |
| 851 pixbuf = gdk_pixbuf_new_from_inline( -1 , selectall_pixbuf , FALSE , NULL ); | |
| 852 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 853 gtk_icon_factory_add( iconfactory , AUD_STOCK_SELECTALL , iconset ); | |
| 854 pixbuf = gdk_pixbuf_new_from_inline( -1 , selectinvert_pixbuf , FALSE , NULL ); | |
| 855 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 856 gtk_icon_factory_add( iconfactory , AUD_STOCK_SELECTINVERT , iconset ); | |
| 857 pixbuf = gdk_pixbuf_new_from_inline( -1 , invertpl_pixbuf , FALSE , NULL ); | |
| 858 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 859 gtk_icon_factory_add( iconfactory , AUD_STOCK_INVERTPL , iconset ); | |
| 860 pixbuf = gdk_pixbuf_new_from_inline( -1 , queuetoggle_pixbuf , FALSE , NULL ); | |
| 861 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 862 gtk_icon_factory_add( iconfactory , AUD_STOCK_QUEUETOGGLE , iconset ); | |
| 863 pixbuf = gdk_pixbuf_new_from_inline( -1 , info_pixbuf , FALSE , NULL ); | |
| 864 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 865 gtk_icon_factory_add( iconfactory , AUD_STOCK_INFO , iconset ); | |
| 866 pixbuf = gdk_pixbuf_new_from_inline( -1 , playlist_pixbuf , FALSE , NULL ); | |
| 867 iconset = gtk_icon_set_new_from_pixbuf( pixbuf ); g_object_unref( pixbuf ); | |
| 868 gtk_icon_factory_add( iconfactory , AUD_STOCK_PLAYLIST , iconset ); | |
| 869 | |
| 870 gtk_icon_factory_add_default( iconfactory ); | |
| 871 g_object_unref( iconfactory ); | |
| 872 } | |
| 873 | |
| 2411 | 874 static GOptionEntry cmd_entries[] = { |
|
2448
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
875 {"session", 'n', 0, G_OPTION_ARG_INT, &options.session, N_("Select which Audacious session ID to use"), NULL}, |
|
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
876 {"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
|
877 {"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
|
878 {"pause", 'u', 0, G_OPTION_ARG_NONE, &options.pause, N_("Pause current song"), NULL}, |
| 2475 | 879 {"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
|
880 {"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
|
881 {"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
|
882 {"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
|
883 {"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
|
884 {"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
|
885 {"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
|
886 {"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
|
887 {"headless", 'H', 0, G_OPTION_ARG_NONE, &options.headless, N_("Enable headless operation"), NULL}, |
|
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
888 {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL}, |
|
ff135e2ba10e
[svn] - mark some strings used by GOption as translatable
nenolod
parents:
2420
diff
changeset
|
889 {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version and builtin features"), NULL}, |
| 2411 | 890 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &options.filenames, N_("FILE..."), NULL}, |
| 891 {NULL}, | |
| 892 }; | |
| 2313 | 893 |
| 894 static void | |
| 895 handle_cmd_line_options(BmpCmdLineOpt * options, | |
| 896 gboolean remote) | |
| 897 { | |
| 2411 | 898 gchar **filenames = options->filenames; |
| 2785 | 899 #ifdef USE_DBUS |
| 900 DBusGProxy *session = audacious_get_dbus_proxy(); | |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
901 #endif |
| 2313 | 902 |
| 2411 | 903 if (options->version) |
| 904 { | |
| 905 dump_version(); | |
| 906 exit(EXIT_SUCCESS); | |
| 907 } | |
| 908 | |
|
2788
b2b920b165ad
[svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents:
2786
diff
changeset
|
909 #ifdef USE_DBUS |
| 2411 | 910 if (filenames != NULL) |
| 911 { | |
| 2313 | 912 gint pos = 0; |
| 2411 | 913 gint i = 0; |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
914 GList *fns = NULL; |
| 2313 | 915 |
| 2411 | 916 for (i = 0; filenames[i] != NULL; i++) |
| 917 { | |
| 2570 | 918 gchar *filename; |
|
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
919 gchar *current_dir = g_get_current_dir(); |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
920 |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
921 if (filenames[i][0] == '/' || strstr(filenames[i], "://")) |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
922 filename = g_strdup(filenames[i]); |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
923 else |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
924 filename = g_build_filename(current_dir, filenames[i], NULL); |
|
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
925 |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
926 fns = g_list_prepend(fns, filename); |
| 2313 | 927 |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
928 g_free(current_dir); |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
929 } |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
930 |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
931 fns = g_list_reverse(fns); |
| 2411 | 932 |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
933 if (options->load_skins) |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
934 { |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
935 audacious_remote_set_skin(session, filenames[0]); |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
936 skin_install_skin(filenames[0]); |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
937 } |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
938 else |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
939 { |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
940 if (options->enqueue_to_temp) |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
941 audacious_remote_playlist_enqueue_to_temp(session, filenames[0]); |
| 2411 | 942 |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
943 if (options->enqueue && options->play) |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
944 pos = audacious_remote_get_playlist_length(session); |
| 2313 | 945 |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
946 if (!options->enqueue) |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
947 { |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
948 audacious_remote_playlist_clear(session); |
|
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
949 audacious_remote_stop(session); |
| 2411 | 950 } |
|
2512
3a1fc6f7c187
[svn] - unbreak relative path support. closes #791.
nenolod
parents:
2506
diff
changeset
|
951 |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
952 audacious_remote_playlist_add(session, fns); |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
953 |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
954 if (options->enqueue && options->play && |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
955 audacious_remote_get_playlist_length(session) > pos) |
|
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
956 audacious_remote_set_playlist_pos(session, pos); |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
957 |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
958 if (!options->enqueue) |
|
2727
14f9a629ba9c
[svn] - rename xmms_remote namespace to audacious_remote namespace
nenolod
parents:
2717
diff
changeset
|
959 audacious_remote_play(session); |
| 2313 | 960 } |
| 961 | |
|
2605
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
962 g_list_foreach(fns, (GFunc) g_free, NULL); |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
963 g_list_free(fns); |
|
1ceaf00f9c6d
[svn] - fix handling of multiple files on the command line.
nenolod
parents:
2574
diff
changeset
|
964 |
| 2411 | 965 g_strfreev(filenames); |
| 2786 | 966 } /* filename */ |
| 2313 | 967 |
| 2832 | 968 if (remote) { |
| 969 if (options->rew) | |
| 970 audacious_remote_playlist_prev(session); | |
| 2313 | 971 |
| 2832 | 972 if (options->play) |
| 973 audacious_remote_play(session); | |
| 2313 | 974 |
| 2832 | 975 if (options->pause) |
| 976 audacious_remote_pause(session); | |
| 2313 | 977 |
| 2832 | 978 if (options->stop) |
| 979 audacious_remote_stop(session); | |
| 2313 | 980 |
| 2832 | 981 if (options->fwd) |
| 982 audacious_remote_playlist_next(session); | |
| 2313 | 983 |
| 2832 | 984 if (options->play_pause) |
| 985 audacious_remote_play_pause(session); | |
| 2313 | 986 |
| 2832 | 987 if (options->show_jump_box) |
| 988 audacious_remote_show_jtf_box(session); | |
| 2313 | 989 |
| 2832 | 990 if (options->mainwin) |
| 991 audacious_remote_main_win_toggle(session, TRUE); | |
| 2313 | 992 |
| 2832 | 993 if (options->activate) |
| 994 audacious_remote_activate(session); | |
| 2313 | 995 |
| 2832 | 996 if (options->playcd) |
| 997 play_medium(); | |
|
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
998 } else { |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
999 if (options->rew) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1000 audacious_drct_playlist_prev(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1001 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1002 if (options->play) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1003 audacious_drct_play(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1004 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1005 if (options->pause) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1006 audacious_drct_pause(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1007 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1008 if (options->stop) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1009 audacious_drct_stop(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1010 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1011 if (options->fwd) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1012 audacious_drct_playlist_next(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1013 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1014 if (options->play_pause) { |
|
2846
89c3fef7ae1f
evaluate return value of audacious_drct_get_paused() instead of its address.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2845
diff
changeset
|
1015 if (audacious_drct_get_paused()) |
|
2845
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1016 audacious_drct_play(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1017 else |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1018 audacious_drct_pause(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1019 } |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1020 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1021 if (options->show_jump_box) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1022 audacious_drct_show_jtf_box(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1023 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1024 if (options->mainwin) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1025 audacious_drct_main_win_toggle(TRUE); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1026 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1027 if (options->activate) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1028 audacious_drct_activate(); |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1029 |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1030 if (options->playcd) |
|
a124656d4423
added handlers for cmd line args when remote == false
Ben Tucker <ben.tucker@gmail.com>
parents:
2838
diff
changeset
|
1031 play_medium(); |
| 2832 | 1032 } |
| 2785 | 1033 |
| 2786 | 1034 if(remote) { |
| 2785 | 1035 gboolean is_running = audacious_remote_is_running(session); |
| 1036 if (is_running) | |
| 1037 exit(EXIT_SUCCESS); | |
| 1038 } | |
|
2788
b2b920b165ad
[svn] - exclude codes which use session if USE_DBUS is not defined.
yaz
parents:
2786
diff
changeset
|
1039 #endif |
| 2313 | 1040 } |
| 1041 | |
| 1042 static void | |
| 1043 bmp_setup_logger(void) | |
| 1044 { | |
| 1045 if (!bmp_logger_start(bmp_paths[BMP_PATH_LOG_FILE])) | |
| 1046 return; | |
| 1047 | |
| 1048 g_atexit(bmp_logger_stop); | |
| 1049 } | |
| 1050 | |
| 1051 static void | |
| 1052 run_load_skin_error_dialog(const gchar * skin_path) | |
| 1053 { | |
| 1054 const gchar *markup = | |
| 1055 N_("<b><big>Unable to load skin.</big></b>\n" | |
| 1056 "\n" | |
| 1057 "Check that skin at '%s' is usable and default skin is properly " | |
| 1058 "installed at '%s'\n"); | |
| 1059 | |
| 1060 GtkWidget *dialog = | |
| 1061 gtk_message_dialog_new_with_markup(NULL, | |
| 1062 GTK_DIALOG_MODAL, | |
| 1063 GTK_MESSAGE_ERROR, | |
| 1064 GTK_BUTTONS_CLOSE, | |
| 1065 _(markup), | |
| 1066 skin_path, | |
| 1067 BMP_DEFAULT_SKIN_PATH); | |
| 1068 gtk_dialog_run(GTK_DIALOG(dialog)); | |
| 1069 gtk_widget_destroy(dialog); | |
| 1070 } | |
| 1071 | |
|
2908
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1072 void report_error(const gchar *error_message, ...) |
| 2313 | 1073 { |
|
2908
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1074 gchar *buf; |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1075 va_list va; |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1076 |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1077 va_start(va, error_message); |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1078 buf = g_strdup_vprintf(error_message, va); |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1079 va_end(va); |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1080 |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1081 fprintf(stderr, buf); |
| 2570 | 1082 |
| 1083 if (options.headless != 1) | |
| 1084 { | |
| 2313 | 1085 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(err), |
|
2908
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1086 buf); |
| 2313 | 1087 gtk_dialog_run(GTK_DIALOG(err)); |
| 1088 gtk_widget_hide(err); | |
| 1089 } | |
|
2908
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1090 |
|
6a474a7954a0
Allow for printf-style format strings to be passed to report_error() via g_strdup_vprintf().
William Pitcock <nenolod@atheme.org>
parents:
2907
diff
changeset
|
1091 g_free(buf); |
| 2313 | 1092 } |
| 1093 | |
| 2369 | 1094 static gboolean |
| 1095 aud_headless_iteration(gpointer unused) | |
| 1096 { | |
|
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1097 audcore_generic_events(); |
|
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1098 free_vis_data(); |
|
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1099 return TRUE; |
| 2369 | 1100 } |
| 1101 | |
| 2313 | 1102 gint |
| 1103 main(gint argc, gchar ** argv) | |
| 1104 { | |
| 1105 gboolean gtk_init_check_ok; | |
| 1106 Playlist *playlist; | |
| 2411 | 1107 GOptionContext *context; |
| 1108 GError *error = NULL; | |
| 2313 | 1109 |
|
2644
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1110 /* 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
|
1111 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
|
1112 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
|
1113 if (!g_thread_supported()) { |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1114 g_printerr(_("Sorry, threads isn't supported on your platform.\n\n" |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1115 "If you're on a libc5 based linux system and installed Glib & GTK+ before you\n" |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1116 "installed LinuxThreads you need to recompile Glib & GTK+.\n")); |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1117 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
|
1118 } |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1119 |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1120 gdk_threads_init(); |
|
67082557b2c4
[svn] - glib-2.13.0 requires g_thread_init() to be called before all other GLib functions.
yaz
parents:
2605
diff
changeset
|
1121 |
| 2313 | 1122 /* Setup l10n early so we can print localized error messages */ |
| 1123 gtk_set_locale(); | |
| 1124 bindtextdomain(PACKAGE_NAME, LOCALEDIR); | |
| 1125 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); | |
|
2388
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
1126 bindtextdomain(PACKAGE_NAME "-plugins", LOCALEDIR); |
|
52bcc18eb8bb
[svn] - attempt to bind the audacious-plugins domain
nenolod
parents:
2369
diff
changeset
|
1127 bind_textdomain_codeset(PACKAGE_NAME "-plugins", "UTF-8"); |
| 2313 | 1128 textdomain(PACKAGE_NAME); |
| 1129 | |
| 1130 bmp_init_paths(); | |
| 1131 bmp_make_user_dir(); | |
| 1132 | |
| 1133 /* Check GTK version. Really, this is only needed for binary | |
| 1134 * distribution since configure already checks. */ | |
| 1135 if (!GTK_CHECK_VERSION(2, 6, 0)) { | |
| 1136 g_printerr(_("Sorry, your GTK+ version (%d.%d.%d) does not work with Audacious.\n" | |
| 1137 "Please use GTK+ %s or newer.\n"), | |
| 1138 gtk_major_version, gtk_minor_version, gtk_micro_version, | |
| 1139 "2.6.0"); | |
| 1140 exit(EXIT_FAILURE); | |
| 1141 } | |
| 1142 | |
| 1143 g_set_application_name(_(application_name)); | |
| 1144 | |
| 1145 cond_scan = g_cond_new(); | |
| 1146 mutex_scan = g_mutex_new(); | |
| 1147 | |
| 2463 | 1148 gtk_rc_add_default_file(bmp_paths[BMP_PATH_GTKRC_FILE]); |
| 1149 | |
| 2313 | 1150 gtk_init_check_ok = gtk_init_check(&argc, &argv); |
| 2411 | 1151 |
| 2413 | 1152 memset(&options, '\0', sizeof(BmpCmdLineOpt)); |
| 1153 options.session = -1; | |
| 1154 | |
| 2411 | 1155 context = g_option_context_new(_("- play multimedia files")); |
| 1156 g_option_context_add_main_entries(context, cmd_entries, PACKAGE_NAME); | |
| 1157 g_option_context_add_group(context, gtk_get_option_group(TRUE)); | |
| 1158 g_option_context_parse(context, &argc, &argv, &error); | |
| 1159 | |
| 2412 | 1160 if (error != NULL) |
| 1161 { | |
| 1162 g_printerr(_("%s: %s\nTry `%s --help' for more information.\n"), argv[0], error->message, argv[0]); | |
| 1163 exit(EXIT_FAILURE); | |
| 1164 } | |
| 1165 | |
| 2313 | 1166 if (!gtk_init_check_ok) { |
| 1167 if (argc < 2) { | |
| 1168 /* GTK check failed, and no arguments passed to indicate | |
| 1169 that user is intending to only remote control a running | |
| 1170 session */ | |
| 2412 | 1171 g_printerr(_("%s: Unable to open display, exiting.\n"), argv[0]); |
| 2313 | 1172 exit(EXIT_FAILURE); |
| 1173 } | |
| 1174 | |
| 1175 handle_cmd_line_options(&options, TRUE); | |
| 1176 | |
| 1177 /* we could be running headless, so GTK probably wont matter */ | |
| 1178 if (options.headless != 1) | |
| 1179 exit(EXIT_SUCCESS); | |
| 1180 } | |
| 1181 | |
| 1182 if (options.no_log == FALSE) | |
| 1183 bmp_setup_logger(); | |
| 1184 | |
| 1185 signal_handlers_init(); | |
| 1186 | |
| 1187 g_random_set_seed(time(NULL)); | |
| 1188 | |
| 1189 bmp_config_load(); | |
| 1190 | |
| 2736 | 1191 handle_cmd_line_options(&options, TRUE); |
| 2313 | 1192 |
|
2733
cf080b11c3fa
[svn] Implemented more of the stubs in audctrl; Added more methods to objects.xml with implementations in dbus.c. I'm still trying to get plugins working with libaudclient.
magma
parents:
2727
diff
changeset
|
1193 #ifdef USE_DBUS |
|
cf080b11c3fa
[svn] Implemented more of the stubs in audctrl; Added more methods to objects.xml with implementations in dbus.c. I'm still trying to get plugins working with libaudclient.
magma
parents:
2727
diff
changeset
|
1194 init_dbus(); |
|
cf080b11c3fa
[svn] Implemented more of the stubs in audctrl; Added more methods to objects.xml with implementations in dbus.c. I'm still trying to get plugins working with libaudclient.
magma
parents:
2727
diff
changeset
|
1195 #endif |
|
2856
c4d07471f647
Added a mowgli_init() call
Cristi Magherusan <majeru@gentoo.ro>
parents:
2846
diff
changeset
|
1196 mowgli_init(); |
| 2313 | 1197 plugin_system_init(); |
| 1198 | |
| 1199 /* Initialize the playlist system. */ | |
| 1200 playlist_init(); | |
| 1201 | |
| 1202 if (options.headless != 1) | |
| 1203 { | |
| 1204 /* register icons in stock */ | |
| 1205 register_aud_stock_icons(); | |
| 1206 | |
| 1207 bmp_set_default_icon(); | |
| 1208 | |
| 1209 gtk_accel_map_load(bmp_paths[BMP_PATH_ACCEL_FILE]); | |
| 1210 | |
| 1211 /* uimanager */ | |
| 1212 ui_manager_init(); | |
| 1213 ui_manager_create_menus(); | |
| 1214 | |
| 1215 if (!init_skins(cfg.skin)) { | |
| 1216 run_load_skin_error_dialog(cfg.skin); | |
| 1217 exit(EXIT_FAILURE); | |
| 1218 } | |
| 1219 | |
| 1220 GDK_THREADS_ENTER(); | |
| 1221 } | |
| 1222 | |
| 1223 /* Load the default playlist in. */ | |
| 1224 playlist = playlist_get_active(); | |
| 1225 playlist_load(playlist, bmp_paths[BMP_PATH_PLAYLIST_FILE]); | |
| 1226 playlist_set_position(playlist, cfg.playlist_position); | |
| 1227 | |
| 1228 /* this needs to be called after all 3 windows are created and | |
| 1229 * input plugins are setup'ed | |
| 1230 * but not if we're running headless --nenolod | |
| 1231 */ | |
| 1232 mainwin_setup_menus(); | |
| 1233 | |
| 1234 if (options.headless != 1) | |
| 1235 { | |
| 1236 read_volume(VOLSET_STARTUP); | |
| 1237 mainwin_set_info_text(); | |
| 1238 | |
| 1239 /* FIXME: delayed, because it deals directly with the plugin | |
| 1240 * interface to set menu items */ | |
| 1241 create_prefs_window(); | |
| 1242 | |
| 2364 | 1243 create_fileinfo_window(); |
| 1244 | |
| 2313 | 1245 |
| 1246 if (cfg.player_visible) | |
| 1247 mainwin_show(TRUE); | |
| 1248 else if (!cfg.playlist_visible && !cfg.equalizer_visible) | |
|
2651
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
1249 { |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
1250 /* all of the windows are hidden... warn user about this */ |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
1251 mainwin_show_visibility_warning(); |
|
4d5e6a8717dd
[svn] - allow the player to start with all of its windows hidden (but give a warning to the user, whose display can be disabled); also, try to remember player windows positions when they stay hidden between sessions
giacomo
parents:
2644
diff
changeset
|
1252 } |
| 2313 | 1253 |
| 1254 if (cfg.equalizer_visible) | |
| 1255 equalizerwin_show(TRUE); | |
| 1256 | |
| 1257 if (cfg.playlist_visible) | |
| 1258 playlistwin_show(); | |
| 1259 | |
| 1260 hint_set_always(cfg.always_on_top); | |
| 1261 | |
| 1262 playlist_start_get_info_thread(); | |
| 1263 mainwin_attach_idle_func(); | |
| 1264 | |
| 2364 | 1265 has_x11_connection = TRUE; |
| 2313 | 1266 |
| 2364 | 1267 if (cfg.resume_playback_on_startup) |
| 1268 { | |
| 1269 if (cfg.resume_playback_on_startup_time != -1 && | |
| 1270 playlist_get_length(playlist) > 0) | |
| 1271 { | |
| 1272 int i; | |
| 1273 gint l = 0, r = 0; | |
| 1274 while (gtk_events_pending()) gtk_main_iteration(); | |
| 1275 output_get_volume(&l, &r); | |
| 1276 output_set_volume(0,0); | |
| 1277 playback_initiate(); | |
| 2313 | 1278 |
| 2364 | 1279 /* Busy wait; loop is fairly tight to minimize duration of |
| 1280 * "frozen" GUI. Feel free to tune. --chainsaw */ | |
| 1281 for (i = 0; i < 20; i++) | |
| 1282 { | |
| 1283 g_usleep(1000); | |
| 1284 if (!ip_data.playing) | |
| 1285 break; | |
| 1286 } | |
| 1287 playback_seek(cfg.resume_playback_on_startup_time / 1000); | |
| 1288 output_set_volume(l, r); | |
| 1289 } | |
| 1290 } | |
| 1291 | |
| 2313 | 1292 gtk_main(); |
| 1293 | |
| 1294 GDK_THREADS_LEAVE(); | |
| 1295 | |
| 1296 g_cond_free(cond_scan); | |
| 1297 g_mutex_free(mutex_scan); | |
| 1298 | |
| 1299 return EXIT_SUCCESS; | |
| 1300 } | |
| 2364 | 1301 // if we are running headless |
| 2313 | 1302 else |
| 1303 { | |
|
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1304 GMainLoop *loop; |
| 2369 | 1305 |
| 2313 | 1306 mainwin_set_info_text(); |
| 1307 playlist_start_get_info_thread(); | |
| 1308 | |
|
2506
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1309 loop = g_main_loop_new(NULL, TRUE); |
|
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1310 g_timeout_add(10, aud_headless_iteration, NULL); |
|
630910fd140f
[svn] - changed plugin directory to ~/.local/share/audacious/Plugins (seems more logical to me)
mf0102
parents:
2475
diff
changeset
|
1311 g_main_loop_run(loop); |
| 2313 | 1312 |
| 1313 return EXIT_SUCCESS; | |
| 1314 } | |
| 1315 } |
