diff options
author | waker <wakeroid@gmail.com> | 2010-10-20 22:04:31 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2010-10-20 22:04:31 +0200 |
commit | 47f411b6964dc2f0af7d0f35ac0016204f1d9e96 (patch) | |
tree | b32de71a60fa8961b67f76bb8a4510f9cac9d47c /plugins | |
parent | 4886787e05f757a602f077e436a9b6f8b929ae3d (diff) |
added portable build mode (--enable-portable configure option)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/artwork/artwork.c | 35 | ||||
-rw-r--r-- | plugins/artwork/artwork.h | 1 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.c | 12 | ||||
-rw-r--r-- | plugins/gtkui/coverart.c | 7 | ||||
-rw-r--r-- | plugins/gtkui/gtkui.c | 3 |
5 files changed, 36 insertions, 22 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index fbbe71d9..469ec8bb 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -16,7 +16,7 @@ //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(...) -#define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") +static char default_cover[PATH_MAX]; #define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg" static DB_artwork_plugin_t plugin; @@ -41,12 +41,16 @@ static volatile int terminate; static volatile int clear_queue; static intptr_t tid; -int artwork_enable_embedded; -int artwork_enable_local; -int artwork_enable_lfm; -int artwork_enable_aao; -int artwork_reset_time; -char artwork_filemask[200]; +static int artwork_enable_embedded; +static int artwork_enable_local; +static int artwork_enable_lfm; +static int artwork_enable_aao; +static int artwork_reset_time; +static char artwork_filemask[200]; + +static const char *get_default_cover (void) { + return default_cover; +} void make_cache_dir_path (char *path, int size, const char *album, const char *artist) { @@ -568,11 +572,11 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork if (!*artist || !*album) { //give up - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } if (!deadbeef->is_local_file (fname)) { - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } make_cache_path (path, sizeof (path), album, artist); @@ -586,7 +590,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork trace ("reloading cached file %s\n", path); unlink (path); queue_add (fname, artist, album, callback, user_data); - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } trace ("found %s in cache\n", path); @@ -594,7 +598,7 @@ get_album_art (const char *fname, const char *artist, const char *album, artwork } queue_add (fname, artist, album, callback, user_data); - return strdup (DEFAULT_COVER_PATH); + return strdup (get_default_cover ()); } DB_plugin_t * @@ -664,6 +668,13 @@ artwork_on_configchanged (DB_event_t *ev, uintptr_t data) { static int artwork_plugin_start (void) { + const char *def_art = deadbeef->conf_get_str ("gtkui.nocover_pixmap", NULL); + if (!def_art) { + snprintf (default_cover, sizeof (default_cover), "%s/noartwork.jpg", deadbeef->get_pixmap_dir ()); + } + else { + strcpy (default_cover, def_art); + } terminate = 0; artwork_enable_embedded = deadbeef->conf_get_int ("artwork.enable_embedded", 1); @@ -720,6 +731,7 @@ static const char settings_dlg[] = "property \"Fetch from last.fm\" checkbox artwork.enable_lastfm 0;\n" "property \"Fetch from albumart.org\" checkbox artwork.enable_albumartorg 0;\n" ; + // define plugin interface static DB_artwork_plugin_t plugin = { .plugin.plugin.api_vmajor = DB_API_VERSION_MAJOR, @@ -736,4 +748,5 @@ static DB_artwork_plugin_t plugin = { .plugin.plugin.configdialog = settings_dlg, .get_album_art = get_album_art, .reset = artwork_reset, + .get_default_cover = get_default_cover, }; diff --git a/plugins/artwork/artwork.h b/plugins/artwork/artwork.h index ab0fead6..ed5357df 100644 --- a/plugins/artwork/artwork.h +++ b/plugins/artwork/artwork.h @@ -14,6 +14,7 @@ typedef struct { // this has to be called to clear queue on exit, before caller terminates // `fast=1' means "don't wait, just flush queue" void (*reset) (int fast); + const char *(*get_default_cover) (void); } DB_artwork_plugin_t; #endif /*__ARTWORK_H*/ diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index 58a3da41..7ca76d0c 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -689,7 +689,7 @@ on_help1_activate (GtkMenuItem *menuitem, gpointer user_data) { char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", _("help.txt")); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), _("help.txt")); show_info_window (fname, _("Help"), &helpwindow); } @@ -702,7 +702,7 @@ on_about1_activate (GtkMenuItem *menuitem, char s[200]; snprintf (s, sizeof (s), _("About DeaDBeeF %s"), VERSION); char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", "about.txt"); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), "about.txt"); show_info_window (fname, s, &aboutwindow); } @@ -715,7 +715,7 @@ on_changelog1_activate (GtkMenuItem *menuitem, char s[200]; snprintf (s, sizeof (s), _("DeaDBeeF %s ChangeLog"), VERSION); char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", "ChangeLog"); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), "ChangeLog"); show_info_window (fname, s, &changelogwindow); } @@ -726,7 +726,7 @@ on_gpl1_activate (GtkMenuItem *menuitem, gpointer user_data) { char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", "COPYING.GPLv2"); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), "COPYING.GPLv2"); show_info_window (fname, "GNU GENERAL PUBLIC LICENSE Version 2", &gplwindow); } @@ -737,7 +737,7 @@ on_lgpl1_activate (GtkMenuItem *menuitem, gpointer user_data) { char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", "COPYING.LGPLv2.1"); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), "COPYING.LGPLv2.1"); show_info_window (fname, "GNU LESSER GENERAL PUBLIC LICENSE Version 2.1", &lgplwindow); } @@ -1079,7 +1079,7 @@ on_translators1_activate (GtkMenuItem *menuitem, char s[200]; snprintf (s, sizeof (s), _("DeaDBeeF Translators")); char fname[PATH_MAX]; - snprintf (fname, sizeof (fname), DOCDIR "/%s", "translators.txt"); + snprintf (fname, sizeof (fname), "%s/%s", deadbeef->get_doc_dir (), "translators.txt"); show_info_window (fname, s, &translatorswindow); } diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c index 7fb50554..ffd2c2b2 100644 --- a/plugins/gtkui/coverart.c +++ b/plugins/gtkui/coverart.c @@ -25,8 +25,6 @@ #include "../artwork/artwork.h" #include "gtkui.h" -#define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") - //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(...) @@ -151,9 +149,10 @@ loading_thread (void *none) { g_error_free (error); error = NULL; } - pixbuf = gdk_pixbuf_new_from_file_at_scale (DEFAULT_COVER_PATH, queue->width, queue->width, TRUE, &error); + const char *defpath = coverart_plugin->get_default_cover (); + pixbuf = gdk_pixbuf_new_from_file_at_scale (defpath, queue->width, queue->width, TRUE, &error); if (!pixbuf) { - fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", DEFAULT_COVER_PATH, queue->width, error->message); + fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", defpath, queue->width, error->message); } } if (error) { diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index ae7ce4ee..2dd40a73 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -899,7 +899,8 @@ void gtkui_thread (void *ctx) { // let's start some gtk g_thread_init (NULL); - add_pixmap_directory (PREFIX "/share/deadbeef/pixmaps"); +// add_pixmap_directory (PREFIX "/share/deadbeef/pixmaps"); + add_pixmap_directory (deadbeef->get_pixmap_dir ()); gdk_threads_init (); gdk_threads_enter (); |