From: Andreas Obergrusberger Date: Fri, 5 Jan 2007 10:39:17 +0000 (+0000) Subject: fix user plugin dir; code cleanup X-Git-Tag: v0.12_alpha1~347 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0058a29551923c8f39c52e75ea7ad97743fa2c05;p=ncmpc.git fix user plugin dir; code cleanup git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@5220 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/src/main.c b/src/main.c index ed7c70c..9348822 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 ee7c852..8ce9937 100644 --- a/src/src_lyrics.c +++ b/src/src_lyrics.c @@ -18,12 +18,13 @@ * */ -#include "src_lyrics.h" -#include #include +#include + #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 dd52e72..140906e 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