summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b1a02a4)
raw | patch | inline | side by side (parent: b1a02a4)
author | Kalle Wallin <kaw@linux.se> | |
Sun, 13 Feb 2005 22:04:03 +0000 (22:04 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Sun, 13 Feb 2005 22:04:03 +0000 (22:04 +0000) |
src/screen_file.c | patch | blob | history | |
src/screen_help.c | patch | blob | history | |
src/screen_play.c | patch | blob | history |
diff --git a/src/screen_file.c b/src/screen_file.c
index 1e13cc4c789dee36bf0b4a1fcb48dc250768153b..002e9cd73261132d5bf3704e2f90194f9d3d411c 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
return 0;
}
+static int
+handle_save(screen_t *screen, mpdclient_t *c)
+{
+ filelist_entry_t *entry;
+ char *defaultname = NULL;
+
+
+ entry=( filelist_entry_t *) g_list_nth_data(filelist->list,lw->selected);
+ if( entry && entry->entity )
+ {
+ mpd_InfoEntity *entity = entry->entity;
+ if( entity->type==MPD_INFO_ENTITY_TYPE_PLAYLISTFILE )
+ {
+ mpd_PlaylistFile *plf = entity->info.playlistFile;
+ defaultname = plf->path;
+ }
+ }
+ return playlist_save(screen, c, NULL, defaultname);
+}
+
static int
handle_delete(screen_t *screen, mpdclient_t *c)
{
case CMD_DELETE:
handle_delete(screen, c);
break;
+ case CMD_SAVE_PLAYLIST:
+ handle_save(screen, c);
+ break;
case CMD_SCREEN_UPDATE:
screen->painted = 0;
lw->clear = 1;
diff --git a/src/screen_help.c b/src/screen_help.c
index 66acc3d87e53ae4a856af528eec02c2030df4596..8c5e512cae642e695bed55eab45a2eb95308c082 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
{ 2, CMD_NONE, NULL },
{ 0, CMD_PLAY, N_("Enter directory/Select and play song") },
{ 0, CMD_SELECT, NULL },
+ { 0, CMD_SAVE_PLAYLIST, NULL },
{ 0, CMD_DELETE, N_("Delete playlist") },
{ 0, CMD_SCREEN_UPDATE, NULL },
diff --git a/src/screen_play.c b/src/screen_play.c
index cdb8320e8c66e7886c93b1b3482ccec58c0e74e7..b86c876de7f0e5959683b2c410f061c5b24ce0f6 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
return 0;
}
-static int
-handle_save_playlist(screen_t *screen, mpdclient_t *c, char *name)
+
+int
+playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
{
gchar *filename;
gint error;
/* query the user for a filename */
filename = screen_readln(screen->status_window.w,
_("Save playlist as: "),
- NULL,
+ defaultname,
NULL,
gcmp);
g_free(filename);
return -1;
}
- error = handle_save_playlist(screen, c, filename);
+ error = playlist_save(screen, c, filename, NULL);
g_free(filename);
return error;
}
mpdclient_cmd_delete(c, lw->selected);
return 1;
case CMD_SAVE_PLAYLIST:
- handle_save_playlist(screen, c, NULL);
+ playlist_save(screen, c, NULL, NULL);
return 1;
case CMD_ADD:
handle_add_to_playlist(screen, c);