aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Obergrusberger <tradiaz@yahoo.de>2007-01-05 10:39:17 +0000
committerAndreas Obergrusberger <tradiaz@yahoo.de>2007-01-05 10:39:17 +0000
commit0058a29551923c8f39c52e75ea7ad97743fa2c05 (patch)
tree253cf786a39ed3d78f3d8a19699f0a0c3502256f /src
parent653b7f9dd27d655cf1bdca6d559d3ece6cdb6443 (diff)
downloadmpd-0058a29551923c8f39c52e75ea7ad97743fa2c05.tar.gz
mpd-0058a29551923c8f39c52e75ea7ad97743fa2c05.tar.xz
mpd-0058a29551923c8f39c52e75ea7ad97743fa2c05.zip
fix user plugin dir; code cleanup
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5220 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/src_lyrics.c20
-rw-r--r--src/src_lyrics.h4
3 files changed, 16 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index ed7c70cc7..934882244 100644
--- a/src/main.c
+++ b/src/main.c
@@ -267,7 +267,7 @@ main(int argc, const char *argv[])
ncurses_init();
if(options->show_splash == TRUE) draw_splash();
- init_src_lyr ();
+ src_lyr_init ();
/* connect to our music player daemon */
mpd = mpdclient_new();
diff --git a/src/src_lyrics.c b/src/src_lyrics.c
index ee7c852ea..8ce9937dd 100644
--- a/src/src_lyrics.c
+++ b/src/src_lyrics.c
@@ -18,12 +18,13 @@
*
*/
-#include "src_lyrics.h"
-#include <options.h>
#include <unistd.h>
+#include <string.h>
+
#include "../config.h"
+#include "src_lyrics.h"
-#define PLUGIN_DIR_USER "/home/andi/.ncmpc/plugins"
+#define PLUGIN_DIR_USER "/.ncmpc/plugins"
int get_text_line(formed_text *text, int num, char *dest, int len)
{
@@ -104,7 +105,7 @@ int deregister_lyr_hd ();
int register_lyr_hd (src_lyr *source_descriptor);
#endif
-int init_src_lyr_stack ()
+int src_lyr_stack_init ()
{
src_lyr_stack = g_array_new (TRUE, FALSE, sizeof (src_lyr*));
@@ -120,14 +121,15 @@ int init_src_lyr_stack ()
#endif
#ifndef DISABLE_PLUGIN_SYSTEM
+
src_lyr_plugins_load ();
#endif
}
-int init_src_lyr ()
+int src_lyr_init ()
{
- init_src_lyr_stack();
+ src_lyr_stack_init ();
int i = 0;
while (g_array_index (src_lyr_stack, src_lyr*, i) != NULL)
@@ -189,8 +191,12 @@ int src_lyr_plugins_load ()
if (plugin_dir == NULL)
return -1;
src_lyr_plugins_load_from_dir (plugin_dir);
+
+ GString *user_dir_path;
+ user_dir_path = g_string_new (g_get_home_dir());
+ g_string_append (user_dir_path, PLUGIN_DIR_USER);
- plugin_dir = g_dir_open (PLUGIN_DIR_USER, 0, NULL);
+ plugin_dir = g_dir_open (user_dir_path->str, 0, NULL);
if (plugin_dir == NULL)
return -1;
src_lyr_plugins_load_from_dir (plugin_dir);
diff --git a/src/src_lyrics.h b/src/src_lyrics.h
index dd52e7282..140906e26 100644
--- a/src/src_lyrics.h
+++ b/src/src_lyrics.h
@@ -70,8 +70,8 @@ typedef int (*src_lyr_plugin_register) (src_lyr *source_descriptor);
GArray *src_lyr_stack;
-int init_src_lyr_stack ();
-int init_src_lyr ();
+int src_lyr_stack_init ();
+int src_lyr_init ();
int get_lyr_by_src (int priority, char *artist, char *title);
#endif