Code

Add option "text-editor"
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Dec 2011 16:08:36 +0000 (17:08 +0100)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Dec 2011 16:46:46 +0000 (17:46 +0100)
The lyrics screen is going to spawn a text editor to edit lyrics.
Put the infrastructure in place to make it configurable.

doc/config.sample
doc/ncmpc.1
src/conf.c
src/defaults.h
src/options.c
src/options.h

index 75ab0f19209dccd667e30255f9da0f5f78f4b506..6ad6809feeffb6d6f9bb9780754813d1d1b0c4ab 100644 (file)
 ## Automatically save the lyrics after receiving them.
 #lyrics-autosave = no
 
+## The text editor used for editing lyrics.
+#text-editor = emacs
+
 ## Display song length in second column
 #second-column = yes
 
index fc191f127a83a92e54e81fa2e0cab08446e27114..6f48734ba32c828d827fd80480cba1b44a08fa6f 100644 (file)
@@ -130,6 +130,9 @@ Automatically save lyrics after receiving them.
 .B lyrics\-show\-plugin = yes|no
 Show the name of the plugin used to receive lyrics on the lyrics screen.
 .TP
+.B text\-editor = EDITOR
+The text editor used for editing lyrics.
+.TP
 .B second-column = yes|no
 Display song length in a second column.
 .SS Display
index cce0b9408934025c097e139733f7362181e58389..9d1f8828d8d28d59dab74bbc71cf8bed4fe54801 100644 (file)
@@ -77,6 +77,7 @@
 #define CONF_JUMP_PREFIX_ONLY "jump-prefix-only"
 #define CONF_LYRICS_AUTOSAVE "lyrics-autosave"
 #define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin"
+#define CONF_TEXT_EDITOR "text-editor"
 #define CONF_SECOND_COLUMN "second-column"
 
 static bool
@@ -522,6 +523,15 @@ parse_line(char *line)
                options.lyrics_show_plugin = str2bool(value);
 #else
                {}
+#endif
+       else if (!strcasecmp(name, CONF_TEXT_EDITOR))
+#ifdef ENABLE_LYRICS_SCREEN
+               {
+                       g_free(options.text_editor);
+                       options.text_editor = get_format(value);
+               }
+#else
+               {}
 #endif
        else if (!strcasecmp(CONF_SECOND_COLUMN, name))
 #ifdef NCMPC_MINI
index 9bb934dacb9c44698ce076f2aa4c6d960c67e073..fac784d2eaa64012f61cc481e2c9f83f18f659f4 100644 (file)
@@ -34,6 +34,8 @@
 
 #define DEFAULT_LYRICS_TIMEOUT 100
 
+#define DEFAULT_TEXT_EDITOR "editor"
+
 #define DEFAULT_SCROLL TRUE
 #define DEFAULT_SCROLL_SEP " *** "
 
index f7044ccbe24ddd9645b77a2e8f66f61c75291b03..47fc3b9715e72829758d811642b426bac4d7012b 100644 (file)
@@ -368,6 +368,9 @@ options_init(void)
        options.list_format = g_strdup(DEFAULT_LIST_FORMAT);
        options.status_format = g_strdup(DEFAULT_STATUS_FORMAT);
        options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
+#ifdef ENABLE_LYRICS_SCREEN
+       options.text_editor = g_strdup(DEFAULT_TEXT_EDITOR);
+#endif
 #ifndef NCMPC_MINI
        options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP);
 #endif
index a8ad1ffdd76712036f19af881c404f7f5934c005..fc9f7a1e1c99682f4f7099568b3fe94dc2d2f883 100644 (file)
@@ -48,6 +48,7 @@ typedef struct {
        int lyrics_timeout;
        bool lyrics_autosave;
        bool lyrics_show_plugin;
+       char *text_editor;
 #endif
        bool find_wrap;
        bool find_show_last_pattern;