summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6fabb44)
raw | patch | inline | side by side (parent: 6fabb44)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:40:28 +0000 (17:40 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:40:28 +0000 (17:40 +0200) |
Follow the same code style als MPD itself.
diff --git a/src/list_window.c b/src/list_window.c
index cce992d86c31aaf02ab0328ac1316eeed81bb53a..5a4ccf36d7906d7f9cffa8d0bb8e34d2313e96b3 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
int selected = lw->start + i == lw->selected;
size_t len = my_strlen(label);
- if( highlight )
+ if (highlight)
colors_use(lw->w, COLOR_LIST_BOLD);
else
colors_use(lw->w, COLOR_LIST);
- if( show_cursor && selected )
+ if (show_cursor && selected)
wattron(lw->w, A_REVERSE);
//waddnstr(lw->w, label, lw->cols);
waddstr(lw->w, label);
- if( fill && len<lw->cols )
+ if (fill && len < lw->cols)
whline(lw->w, ' ', lw->cols-len);
- if( selected )
+ if (selected)
wattroff(lw->w, A_REVERSE);
}
}
diff --git a/src/screen_artist.c b/src/screen_artist.c
index dd7e0175a180e0f6eb8d4d3bb796bab9d2100990..4abd585c01dda3a42d27421d99d86f2d99588208 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
-/*
- * $Id$
- *
+/*
* (c) 2005 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/screen_browser.c b/src/screen_browser.c
index bbf69c5227aa3d3d44bd8033701171f9fd8dbe15..9ce6fedd8f68626858caac90fca6ad63fca49ff0 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
/*
- * $Id$
- *
* (c) 2004 by Kalle Wallin <kaw@linux.se>
* Copyright (C) 2008 Max Kellermann <max@duempel.org>
*
diff --git a/src/screen_file.c b/src/screen_file.c
index 9205250048d79f3591f0d16b9e901b56626c511e..f2384ecb72c70650c3a3385364b14896c4314ece 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/screen_help.c b/src/screen_help.c
index 79b8fa722ef146a9e638be46515285f42644da07..e440672d278036f312b168fa3205d0a874b635af 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
const char *text;
} help_text_row_t;
-static help_text_row_t help_text[] =
+static help_text_row_t help_text[] =
{
{ 1, CMD_NONE, N_("Keys - Movement") },
{ 2, CMD_NONE, NULL },
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 9d573976afccd1ee9c95f61a7573f69f57286665..3dda0ec72554b0a3ed55b92c7c4e2cf8d212e018 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
static int
keybindings_changed(void)
{
- command_definition_t *orginal_cmds = get_command_definitions();
- size_t size = command_list_length*sizeof(command_definition_t);
-
- return memcmp(orginal_cmds, cmds, size);
+ command_definition_t *orginal_cmds = get_command_definitions();
+ size_t size = command_list_length * sizeof(command_definition_t);
+
+ return memcmp(orginal_cmds, cmds, size);
}
static void
apply_keys(void)
{
- if( keybindings_changed() )
- {
- command_definition_t *orginal_cmds = get_command_definitions();
- size_t size = command_list_length*sizeof(command_definition_t);
-
- memcpy(orginal_cmds, cmds, size);
- screen_status_printf(_("You have new key bindings!"));
- }
- else
- screen_status_printf(_("Keybindings unchanged."));
+ if (keybindings_changed()) {
+ command_definition_t *orginal_cmds = get_command_definitions();
+ size_t size = command_list_length * sizeof(command_definition_t);
+
+ memcpy(orginal_cmds, cmds, size);
+ screen_status_printf(_("You have new key bindings!"));
+ } else
+ screen_status_printf(_("Keybindings unchanged."));
}
static int
save_keys(void)
{
- FILE *f;
- char *filename;
-
- if( check_user_conf_dir() )
- {
- screen_status_printf(_("Error: Unable to create direcory ~/.ncmpc - %s"),
- strerror(errno));
- screen_bell();
- return -1;
- }
-
- filename = get_user_key_binding_filename();
-
- if( (f=fopen(filename,"w")) == NULL )
- {
- screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
- screen_bell();
- g_free(filename);
- return -1;
- }
- if( write_key_bindings(f, KEYDEF_WRITE_HEADER) )
- screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
- else
- screen_status_printf(_("Wrote %s"), filename);
-
- g_free(filename);
- return fclose(f);
+ FILE *f;
+ char *filename;
+
+ if (check_user_conf_dir()) {
+ screen_status_printf(_("Error: Unable to create direcory ~/.ncmpc - %s"),
+ strerror(errno));
+ screen_bell();
+ return -1;
+ }
+
+ filename = get_user_key_binding_filename();
+
+ if ((f = fopen(filename,"w")) == NULL) {
+ screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
+ screen_bell();
+ g_free(filename);
+ return -1;
+ }
+
+ if (write_key_bindings(f, KEYDEF_WRITE_HEADER))
+ screen_status_printf(_("Error: %s - %s"), filename, strerror(errno));
+ else
+ screen_status_printf(_("Wrote %s"), filename);
+
+ g_free(filename);
+ return fclose(f);
}
static void
check_subcmd_length(void)
{
- subcmd_length = 0;
- while( subcmd_length<MAX_COMMAND_KEYS && cmds[subcmd].keys[subcmd_length]>0 )
- subcmd_length ++;
-
- if( subcmd_length<MAX_COMMAND_KEYS )
- {
- subcmd_addpos = subcmd_length;
- subcmd_length++;
- }
- else
- subcmd_addpos = 0;
- subcmd_length += STATIC_SUB_ITEMS;
+ subcmd_length = 0;
+ while (subcmd_length < MAX_COMMAND_KEYS &&
+ cmds[subcmd].keys[subcmd_length] > 0)
+ ++subcmd_length;
+
+ if (subcmd_length < MAX_COMMAND_KEYS) {
+ subcmd_addpos = subcmd_length;
+ subcmd_length++;
+ } else
+ subcmd_addpos = 0;
+ subcmd_length += STATIC_SUB_ITEMS;
}
static void
delete_key(int cmd_index, int key_index)
{
- int i = key_index+1;
-
- screen_status_printf(_("Deleted"));
- while( i<MAX_COMMAND_KEYS && cmds[cmd_index].keys[i] )
- cmds[cmd_index].keys[key_index++] = cmds[cmd_index].keys[i++];
- cmds[cmd_index].keys[key_index] = 0;
- cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
- check_subcmd_length();
- lw->clear = 1;
- lw->repaint = 1;
- /* update key conflict flags */
- check_key_bindings(cmds, NULL, 0);
+ int i = key_index+1;
+
+ screen_status_printf(_("Deleted"));
+ while (i < MAX_COMMAND_KEYS && cmds[cmd_index].keys[i])
+ cmds[cmd_index].keys[key_index++] = cmds[cmd_index].keys[i++];
+ cmds[cmd_index].keys[key_index] = 0;
+ cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
+ check_subcmd_length();
+ lw->clear = 1;
+ lw->repaint = 1;
+ /* update key conflict flags */
+ check_key_bindings(cmds, NULL, 0);
}
static void
assign_new_key(WINDOW *w, int cmd_index, int key_index)
{
- int key;
- char *buf;
- command_t cmd;
-
- buf = g_strdup_printf(_("Enter new key for %s: "), cmds[cmd_index].name);
- key = screen_getch(w, buf);
- g_free(buf);
- if( key==KEY_RESIZE )
- screen_resize();
- if( key==ERR )
- {
- screen_status_printf(_("Aborted!"));
- return;
- }
- cmd = find_key_command(key, cmds);
- if( cmd!=CMD_NONE && cmd!= cmds[cmd_index].command )
- {
- screen_status_printf(_("Error: key %s is already used for %s"),
- key2str(key),
- get_key_command_name(cmd));
- screen_bell();
- return;
- }
- cmds[cmd_index].keys[key_index] = key;
- cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
-
- screen_status_printf(_("Assigned %s to %s"),
- key2str(key),cmds[cmd_index].name);
- check_subcmd_length();
- lw->repaint = 1;
- /* update key conflict flags */
- check_key_bindings(cmds, NULL, 0);
+ int key;
+ char *buf;
+ command_t cmd;
+
+ buf = g_strdup_printf(_("Enter new key for %s: "), cmds[cmd_index].name);
+ key = screen_getch(w, buf);
+ g_free(buf);
+
+ if (key == KEY_RESIZE)
+ screen_resize();
+
+ if (key==ERR) {
+ screen_status_printf(_("Aborted!"));
+ return;
+ }
+
+ cmd = find_key_command(key, cmds);
+ if (cmd != CMD_NONE && cmd != cmds[cmd_index].command) {
+ screen_status_printf(_("Error: key %s is already used for %s"),
+ key2str(key),
+ get_key_command_name(cmd));
+ screen_bell();
+ return;
+ }
+
+ cmds[cmd_index].keys[key_index] = key;
+ cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
+
+ screen_status_printf(_("Assigned %s to %s"),
+ key2str(key),cmds[cmd_index].name);
+ check_subcmd_length();
+ lw->repaint = 1;
+ /* update key conflict flags */
+ check_key_bindings(cmds, NULL, 0);
}
static const char *
return NULL;
}
-static void
+static void
keydef_init(WINDOW *w, int cols, int rows)
{
- lw = list_window_init(w, cols, rows);
+ lw = list_window_init(w, cols, rows);
}
static void
keydef_resize(int cols, int rows)
{
- lw->cols = cols;
- lw->rows = rows;
+ lw->cols = cols;
+ lw->rows = rows;
}
-static void
+static void
keydef_exit(void)
{
- list_window_free(lw);
- if( cmds )
- g_free(cmds);
- cmds = NULL;
- lw = NULL;
+ list_window_free(lw);
+ if (cmds)
+ g_free(cmds);
+ cmds = NULL;
+ lw = NULL;
}
-static void
+static void
keydef_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- if( cmds == NULL )
- {
- command_definition_t *current_cmds = get_command_definitions();
- size_t cmds_size;
-
- command_list_length = 0;
- while( current_cmds[command_list_length].name )
- command_list_length++;
-
- cmds_size = (command_list_length+1)*sizeof(command_definition_t);
- cmds = g_malloc0(cmds_size);
- memcpy(cmds, current_cmds, cmds_size);
- command_list_length += STATIC_ITEMS;
- screen_status_printf(_("Welcome to the key editor!"));
- }
-
- subcmd = -1;
- list_window_check_selected(lw, LIST_LENGTH());
+ if (cmds == NULL) {
+ command_definition_t *current_cmds = get_command_definitions();
+ size_t cmds_size;
+
+ command_list_length = 0;
+ while (current_cmds[command_list_length].name)
+ command_list_length++;
+
+ cmds_size = (command_list_length+1) * sizeof(command_definition_t);
+ cmds = g_malloc0(cmds_size);
+ memcpy(cmds, current_cmds, cmds_size);
+ command_list_length += STATIC_ITEMS;
+ screen_status_printf(_("Welcome to the key editor!"));
+ }
+
+ subcmd = -1;
+ list_window_check_selected(lw, LIST_LENGTH());
}
-static void
+static void
keydef_close(void)
{
- if( cmds && !keybindings_changed() )
- {
- g_free(cmds);
- cmds = NULL;
- }
- else
- screen_status_printf(_("Note: Did you forget to \'Apply\' your changes?"));
+ if (cmds && !keybindings_changed()) {
+ g_free(cmds);
+ cmds = NULL;
+ } else
+ screen_status_printf(_("Note: Did you forget to \'Apply\' your changes?"));
}
static const char *
keydef_title(char *str, size_t size)
{
- if( subcmd<0 )
- return _("Edit key bindings");
-
- g_snprintf(str, size, _("Edit keys for %s"), cmds[subcmd].name);
- return str;
+ if (subcmd < 0)
+ return _("Edit key bindings");
+
+ g_snprintf(str, size, _("Edit keys for %s"), cmds[subcmd].name);
+ return str;
}
-static void
+static void
keydef_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- lw->clear = 1;
- list_window_paint(lw, list_callback, NULL);
- wrefresh(lw->w);
+ lw->clear = 1;
+ list_window_paint(lw, list_callback, NULL);
+ wrefresh(lw->w);
}
-static void
+static void
keydef_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
-{
- if( lw->repaint )
- {
- list_window_paint(lw, list_callback, NULL);
- wrefresh(lw->w);
- lw->repaint = 0;
- }
+{
+ if (lw->repaint) {
+ list_window_paint(lw, list_callback, NULL);
+ wrefresh(lw->w);
+ lw->repaint = 0;
+ }
}
static int
switch(cmd) {
case CMD_PLAY:
- if( subcmd<0 ) {
- if( lw->selected == LIST_ITEM_APPLY() )
+ if (subcmd < 0) {
+ if (lw->selected == LIST_ITEM_APPLY())
apply_keys();
- else if( lw->selected == LIST_ITEM_SAVE() ) {
+ else if (lw->selected == LIST_ITEM_SAVE()) {
apply_keys();
save_keys();
} else {
} else
assign_new_key(screen->status_window.w,
subcmd,
- lw->selected-STATIC_SUB_ITEMS);
+ lw->selected - STATIC_SUB_ITEMS);
}
lw->repaint = 1;
lw->clear = 1;
diff --git a/src/screen_play.c b/src/screen_play.c
index 265ca4d10b5057d044d4fdd09981806a3d25e763..6df8c9f81a7f8408924070408117576178626a5e 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
typedef struct
{
- GList **list;
- GList **dir_list;
- screen_t *screen;
- mpdclient_t *c;
+ GList **list;
+ GList **dir_list;
+ screen_t *screen;
+ mpdclient_t *c;
} completion_callback_data_t;
static GTime input_timestamp;
playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
{
D("screen_play.c> playlist_callback() [%d]\n", event);
- switch(event) {
+ switch (event) {
case PLAYLIST_EVENT_DELETE:
break;
case PLAYLIST_EVENT_MOVE:
lw->selected = *((int *) data);
- if( lw->selected<lw->start )
+ if (lw->selected < lw->start)
lw->start--;
break;
default:
completion_callback_data_t *tmp = (completion_callback_data_t *)data;
screen_t *screen = tmp->screen;
- if( g_list_length(items)>=1 ) {
+ if (g_list_length(items) >= 1) {
screen_display_completion_list(screen, items);
lw->clear = 1;
}
@@ -150,179 +148,176 @@ save_post_completion_cb(mpd_unused GCompletion *gcmp, mpd_unused gchar *line,
int
playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
{
- gchar *filename;
- gint error;
- GCompletion *gcmp;
- GList *list = NULL;
- completion_callback_data_t data;
-
- if( name==NULL )
- {
- /* initialize completion support */
- gcmp = g_completion_new(NULL);
- g_completion_set_compare(gcmp, strncmp);
- data.list = &list;
- data.dir_list = NULL;
- data.screen = screen;
- data.c = c;
- wrln_completion_callback_data = &data;
- wrln_pre_completion_callback = save_pre_completion_cb;
- wrln_post_completion_callback = save_post_completion_cb;
-
-
- /* query the user for a filename */
- filename = screen_readln(screen->status_window.w,
- _("Save playlist as: "),
- defaultname,
- NULL,
- gcmp);
-
- /* destroy completion support */
- wrln_completion_callback_data = NULL;
- wrln_pre_completion_callback = NULL;
- wrln_post_completion_callback = NULL;
- g_completion_free(gcmp);
- list = string_list_free(list);
- if( filename )
- filename=g_strstrip(filename);
- }
- else
- {
- filename=g_strdup(name);
- }
- if( filename==NULL || filename[0]=='\0' )
- return -1;
- /* send save command to mpd */
- D("Saving playlist as \'%s \'...\n", filename);
- if( (error=mpdclient_cmd_save_playlist(c, filename)) )
- {
- gint code = GET_ACK_ERROR_CODE(error);
-
- if( code == MPD_ACK_ERROR_EXIST )
- {
- char *buf;
- int key;
-
- buf=g_strdup_printf(_("Replace %s [%s/%s] ? "), filename, YES, NO);
- key = tolower(screen_getch(screen->status_window.w, buf));
- g_free(buf);
- if( key == YES[0] )
- {
- if( mpdclient_cmd_delete_playlist(c, filename) )
- {
- g_free(filename);
- return -1;
+ gchar *filename;
+ gint error;
+ GCompletion *gcmp;
+ GList *list = NULL;
+ completion_callback_data_t data;
+
+ if (name == NULL) {
+ /* initialize completion support */
+ gcmp = g_completion_new(NULL);
+ g_completion_set_compare(gcmp, strncmp);
+ data.list = &list;
+ data.dir_list = NULL;
+ data.screen = screen;
+ data.c = c;
+ wrln_completion_callback_data = &data;
+ wrln_pre_completion_callback = save_pre_completion_cb;
+ wrln_post_completion_callback = save_post_completion_cb;
+
+
+ /* query the user for a filename */
+ filename = screen_readln(screen->status_window.w,
+ _("Save playlist as: "),
+ defaultname,
+ NULL,
+ gcmp);
+
+ /* destroy completion support */
+ wrln_completion_callback_data = NULL;
+ wrln_pre_completion_callback = NULL;
+ wrln_post_completion_callback = NULL;
+ g_completion_free(gcmp);
+ list = string_list_free(list);
+ if( filename )
+ filename=g_strstrip(filename);
+ } else
+ filename=g_strdup(name);
+
+ if (filename == NULL || filename[0] == '\0')
+ return -1;
+
+ /* send save command to mpd */
+ D("Saving playlist as \'%s \'...\n", filename);
+ if ((error = mpdclient_cmd_save_playlist(c, filename))) {
+ gint code = GET_ACK_ERROR_CODE(error);
+
+ if (code == MPD_ACK_ERROR_EXIST) {
+ char *buf;
+ int key;
+
+ buf = g_strdup_printf(_("Replace %s [%s/%s] ? "),
+ filename, YES, NO);
+ key = tolower(screen_getch(screen->status_window.w,
+ buf));
+ g_free(buf);
+
+ if (key == YES[0]) {
+ if (mpdclient_cmd_delete_playlist(c, filename)) {
+ g_free(filename);
+ return -1;
+ }
+
+ error = playlist_save(screen, c, filename, NULL);
+ g_free(filename);
+ return error;
+ }
+
+ screen_status_printf(_("Aborted!"));
}
- error = playlist_save(screen, c, filename, NULL);
- g_free(filename);
- return error;
- }
- screen_status_printf(_("Aborted!"));
+
+ g_free(filename);
+ return -1;
}
- g_free(filename);
- return -1;
- }
- /* success */
- screen_status_printf(_("Saved %s"), filename);
- g_free(filename);
- return 0;
+
+ /* success */
+ screen_status_printf(_("Saved %s"), filename);
+ g_free(filename);
+ return 0;
}
static void add_dir(GCompletion *gcmp, gchar *dir, GList **dir_list,
- GList **list, mpdclient_t *c)
+ GList **list, mpdclient_t *c)
{
- g_completion_remove_items(gcmp, *list);
- *list = string_list_remove(*list, dir);
- *list = gcmp_list_from_path(c, dir, *list, GCMP_TYPE_RFILE);
- g_completion_add_items(gcmp, *list);
- *dir_list = g_list_append(*dir_list, g_strdup(dir));
+ g_completion_remove_items(gcmp, *list);
+ *list = string_list_remove(*list, dir);
+ *list = gcmp_list_from_path(c, dir, *list, GCMP_TYPE_RFILE);
+ g_completion_add_items(gcmp, *list);
+ *dir_list = g_list_append(*dir_list, g_strdup(dir));
}
static void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data)
{
- completion_callback_data_t *tmp = (completion_callback_data_t *)data;
- GList **dir_list = tmp->dir_list;
- GList **list = tmp->list;
- mpdclient_t *c = tmp->c;
-
- D("pre_completion()...\n");
- if( *list == NULL )
- {
- /* create initial list */
- *list = gcmp_list_from_path(c, "", NULL, GCMP_TYPE_RFILE);
- g_completion_add_items(gcmp, *list);
- }
- else if( line && line[0] && line[strlen(line)-1]=='/' &&
- string_list_find(*dir_list, line) == NULL )
- {
- /* add directory content to list */
- add_dir(gcmp, line, dir_list, list, c);
- }
+ completion_callback_data_t *tmp = (completion_callback_data_t *)data;
+ GList **dir_list = tmp->dir_list;
+ GList **list = tmp->list;
+ mpdclient_t *c = tmp->c;
+
+ D("pre_completion()...\n");
+ if (*list == NULL) {
+ /* create initial list */
+ *list = gcmp_list_from_path(c, "", NULL, GCMP_TYPE_RFILE);
+ g_completion_add_items(gcmp, *list);
+ } else if (line && line[0] && line[strlen(line)-1]=='/' &&
+ string_list_find(*dir_list, line) == NULL) {
+ /* add directory content to list */
+ add_dir(gcmp, line, dir_list, list, c);
+ }
}
static void add_post_completion_cb(GCompletion *gcmp, gchar *line,
- GList *items, void *data)
+ GList *items, void *data)
{
- completion_callback_data_t *tmp = (completion_callback_data_t *)data;
- GList **dir_list = tmp->dir_list;
- GList **list = tmp->list;
- mpdclient_t *c = tmp->c;
- screen_t *screen = tmp->screen;
-
- D("post_completion()...\n");
- if( g_list_length(items)>=1 )
- {
- screen_display_completion_list(screen, items);
- lw->clear = 1;
- }
-
- if( line && line[0] && line[strlen(line)-1]=='/' &&
- string_list_find(*dir_list, line) == NULL )
- {
- /* add directory content to list */
- add_dir(gcmp, line, dir_list, list, c);
- }
+ completion_callback_data_t *tmp = (completion_callback_data_t *)data;
+ GList **dir_list = tmp->dir_list;
+ GList **list = tmp->list;
+ mpdclient_t *c = tmp->c;
+ screen_t *screen = tmp->screen;
+
+ D("post_completion()...\n");
+ if (g_list_length(items) >= 1) {
+ screen_display_completion_list(screen, items);
+ lw->clear = 1;
+ }
+
+ if (line && line[0] && line[strlen(line) - 1] == '/' &&
+ string_list_find(*dir_list, line) == NULL) {
+ /* add directory content to list */
+ add_dir(gcmp, line, dir_list, list, c);
+ }
}
static int
handle_add_to_playlist(screen_t *screen, mpdclient_t *c)
{
- gchar *path;
- GCompletion *gcmp;
- GList *list = NULL;
- GList *dir_list = NULL;
- completion_callback_data_t data;
-
- /* initialize completion support */
- gcmp = g_completion_new(NULL);
- g_completion_set_compare(gcmp, strncmp);
- data.list = &list;
- data.dir_list = &dir_list;
- data.screen = screen;
- data.c = c;
- wrln_completion_callback_data = &data;
- wrln_pre_completion_callback = add_pre_completion_cb;
- wrln_post_completion_callback = add_post_completion_cb;
- /* get path */
- path = screen_readln(screen->status_window.w,
- _("Add: "),
- NULL,
- NULL,
- gcmp);
-
- /* destroy completion data */
- wrln_completion_callback_data = NULL;
- wrln_pre_completion_callback = NULL;
- wrln_post_completion_callback = NULL;
- g_completion_free(gcmp);
- string_list_free(list);
- string_list_free(dir_list);
-
- /* add the path to the playlist */
- if( path && path[0] )
- mpdclient_cmd_add_path(c, path);
-
- return 0;
+ gchar *path;
+ GCompletion *gcmp;
+ GList *list = NULL;
+ GList *dir_list = NULL;
+ completion_callback_data_t data;
+
+ /* initialize completion support */
+ gcmp = g_completion_new(NULL);
+ g_completion_set_compare(gcmp, strncmp);
+ data.list = &list;
+ data.dir_list = &dir_list;
+ data.screen = screen;
+ data.c = c;
+ wrln_completion_callback_data = &data;
+ wrln_pre_completion_callback = add_pre_completion_cb;
+ wrln_post_completion_callback = add_post_completion_cb;
+
+ /* get path */
+ path = screen_readln(screen->status_window.w,
+ _("Add: "),
+ NULL,
+ NULL,
+ gcmp);
+
+ /* destroy completion data */
+ wrln_completion_callback_data = NULL;
+ wrln_pre_completion_callback = NULL;
+ wrln_post_completion_callback = NULL;
+ g_completion_free(gcmp);
+ string_list_free(list);
+ string_list_free(dir_list);
+
+ /* add the path to the playlist */
+ if (path && path[0])
+ mpdclient_cmd_add_path(c, path);
+
+ return 0;
}
static void
}
/* center the cursor */
- if( options.auto_center ) {
+ if (options.auto_center) {
static int prev_song_id = 0;
- if( c->song && prev_song_id != c->song->id ) {
+ if (c->song && prev_song_id != c->song->id) {
center_playing_item(c);
prev_song_id = c->song->id;
}
diff --git a/src/screen_search.c b/src/screen_search.c
index 7dfc58d0f05dc85ceb59b5f700fc449309a2da6a..8242f1350088382827df26b22d8610f892bf6c8c 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/screen_utils.c b/src/screen_utils.c
index b6141216c8c19513503ee42a928152d3c921ad36..6ee1eba68fbf392de6ea5b8c0d7d54697545cde2 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
-/*
- * $Id$
- *
+/*
* (c) 2004 by Kalle Wallin <kaw@linux.se>
*
* This program is free software; you can redistribute it and/or modify