Mercurial > audlegacy
changeset 2317:49d285f6008b trunk
[svn] Full support for XDG basedir added. The old config doesn't get automatically converted yet.
author | js |
---|---|
date | Sat, 13 Jan 2007 09:19:52 -0800 |
parents | c22fe69a842d |
children | ac9f4d42d848 |
files | ChangeLog src/audacious/main.c src/audacious/main.h src/audacious/ui_skinselector.c |
diffstat | 4 files changed, 56 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jan 12 12:33:07 2007 -0800 +++ b/ChangeLog Sat Jan 13 09:19:52 2007 -0800 @@ -1,3 +1,10 @@ +2007-01-12 20:33:07 +0000 Jonathan Schleifer <js@h3c.de> + revision [3642] + Same for -pipe. + trunk/configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-01-12 20:32:12 +0000 Jonathan Schleifer <js@h3c.de> revision [3640] Add -Wall to CFLAGS by default if the CC is gcc
--- a/src/audacious/main.c Fri Jan 12 12:33:07 2007 -0800 +++ b/src/audacious/main.c Sat Jan 13 09:19:52 2007 -0800 @@ -452,13 +452,10 @@ void make_directory(const gchar * path, mode_t mode) { - if (mkdir(path, mode) == 0) + if (g_mkdir_with_parents(path, mode) == 0) return; - if (errno == EEXIST) - return; - - g_printerr(_("Could not create directory (%s): %s"), path, + g_printerr(_("Could not create directory (%s): %s\n"), path, g_strerror(errno)); } @@ -485,27 +482,56 @@ } } - -#define USER_PATH(path) \ - g_build_filename(bmp_paths[BMP_PATH_USER_DIR], path, NULL); +static void +bmp_init_paths() +{ + char *xdg_config_home; + char *xdg_data_home; + char *xdg_cache_home; -static void -bmp_init_paths(void) -{ - bmp_paths[BMP_PATH_USER_DIR] = g_build_filename(g_get_home_dir(), BMP_RCPATH, NULL); + xdg_config_home = (getenv("XDG_CONFIG_HOME") == NULL + ? g_build_filename(g_get_home_dir(), ".config", NULL) + : g_strdup(getenv("XDG_CONFIG_HOME"))); + xdg_data_home = (getenv("XDG_DATA_HOME") == NULL + ? g_build_filename(g_get_home_dir(), ".local", "share", NULL) + : g_strdup(getenv("XDG_DATA_HOME"))); + xdg_cache_home = (getenv("XDG_CACHE_HOME") == NULL + ? g_build_filename(g_get_home_dir(), ".cache", NULL) + : g_strdup(getenv("XDG_CACHE_HOME"))); - bmp_paths[BMP_PATH_USER_PLUGIN_DIR] = USER_PATH(BMP_USER_PLUGIN_DIR_BASENAME); - bmp_paths[BMP_PATH_USER_SKIN_DIR] = USER_PATH(BMP_SKIN_DIR_BASENAME); - bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = USER_PATH(BMP_SKIN_THUMB_DIR_BASENAME); - bmp_paths[BMP_PATH_CONFIG_FILE] = USER_PATH(BMP_CONFIG_BASENAME); - bmp_paths[BMP_PATH_PLAYLIST_FILE] = USER_PATH(BMP_PLAYLIST_BASENAME); - bmp_paths[BMP_PATH_ACCEL_FILE] = USER_PATH(BMP_ACCEL_BASENAME); - bmp_paths[BMP_PATH_LOG_FILE] = USER_PATH(BMP_LOG_BASENAME); + bmp_paths[BMP_PATH_USER_DIR] = + g_build_filename(xdg_config_home, "audacious", NULL); + bmp_paths[BMP_PATH_USER_SKIN_DIR] = + g_build_filename(xdg_data_home, "audacious", "Skins", NULL); + // FIXME: Think of something better for Plugins, XDG is missing this + bmp_paths[BMP_PATH_USER_PLUGIN_DIR] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "Plugins", NULL); + bmp_paths[BMP_PATH_SKIN_THUMB_DIR] = + g_build_filename(xdg_cache_home, "audacious", "thumbs", NULL); - g_atexit(bmp_free_paths); + bmp_paths[BMP_PATH_CONFIG_FILE] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "config", NULL); +#ifdef HAVE_XSPF_PLAYLIST + bmp_paths[BMP_PATH_PLAYLIST_FILE] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], + "playlist.xspf", NULL); +#else + bmp_paths[BMP_PATH_PLAYLIST_FILE] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], + "playlist.m3u", NULL); +#endif + bmp_paths[BMP_PATH_ACCEL_FILE] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "accel", NULL); + bmp_paths[BMP_PATH_LOG_FILE] = + g_build_filename(bmp_paths[BMP_PATH_USER_DIR], "log", NULL); + + g_free(xdg_config_home); + g_free(xdg_data_home); + g_free(xdg_cache_home); + + g_atexit(bmp_free_paths); } - void bmp_config_load(void) {
--- a/src/audacious/main.h Fri Jan 12 12:33:07 2007 -0800 +++ b/src/audacious/main.h Sat Jan 13 09:19:52 2007 -0800 @@ -34,18 +34,6 @@ G_BEGIN_DECLS -#define BMP_USER_PLUGIN_DIR_BASENAME "Plugins" -#define BMP_SKIN_DIR_BASENAME "Skins" -#define BMP_SKIN_THUMB_DIR_BASENAME ".thumbs" -#define BMP_ACCEL_BASENAME "accels" -#define BMP_CONFIG_BASENAME "config" -#ifndef HAVE_XSPF_PLAYLIST -# define BMP_PLAYLIST_BASENAME "playlist.m3u" -#else -# define BMP_PLAYLIST_BASENAME "playlist.xspf" -#endif -#define BMP_LOG_BASENAME "log" - #define PLAYER_HEIGHT \ ((cfg.player_shaded ? MAINWIN_SHADED_HEIGHT : MAINWIN_HEIGHT) * (cfg.doublesize + 1)) #define PLAYER_WIDTH \
--- a/src/audacious/ui_skinselector.c Fri Jan 12 12:33:07 2007 -0800 +++ b/src/audacious/ui_skinselector.c Sat Jan 13 09:19:52 2007 -0800 @@ -131,7 +131,7 @@ g_return_val_if_fail(path != NULL, NULL); - if (g_str_has_suffix(path, BMP_SKIN_THUMB_DIR_BASENAME)) + if (g_str_has_suffix(path, "thumbs")) return NULL; thumbname = get_thumbnail_filename(path); @@ -253,7 +253,7 @@ skinlist_clear(); scan_skindir(bmp_paths[BMP_PATH_USER_SKIN_DIR]); - scan_skindir(DATA_DIR G_DIR_SEPARATOR_S BMP_SKIN_DIR_BASENAME); + scan_skindir(DATA_DIR G_DIR_SEPARATOR_S "Skins"); skinsdir = getenv("SKINSDIR"); if (skinsdir) {