Skip to content

Commit

Permalink
save_playlist: merge parameters "name" and "defaultname"
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 6, 2024
1 parent f2b886c commit 1025a2c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/EditPlaylistPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ EditPlaylistPage::OnCommand(struct mpdclient &c, Command cmd)
return HandleDelete(c);

case Command::SAVE_PLAYLIST:
//playlist_save(&c, nullptr, nullptr);
//playlist_save(screen, c, nullptr);
// TODO
return true;

Expand Down
5 changes: 2 additions & 3 deletions src/FileBrowserPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ FileBrowserPage::HandleSave(struct mpdclient &c) noexcept
}

if(defaultname)
playlist_save(screen, c, nullptr,
Utf8ToLocaleZ{defaultname}.c_str());
playlist_save(screen, c, Utf8ToLocaleZ{defaultname}.c_str());
else
playlist_save(screen, c, nullptr, nullptr);
playlist_save(screen, c, nullptr);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/QueuePage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ QueuePage::OnCommand(struct mpdclient &c, Command cmd)
}

case Command::SAVE_PLAYLIST:
playlist_save(screen, c, nullptr, nullptr);
playlist_save(screen, c, nullptr);
return true;

case Command::ADD:
Expand Down
5 changes: 2 additions & 3 deletions src/save_playlist.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ PlaylistNameCompletion::Post([[maybe_unused]] std::string_view value,

int
playlist_save(ScreenManager &screen, struct mpdclient &c,
const char *name,
const char *defaultname) noexcept
const char *name) noexcept
{
std::string filename;

Expand All @@ -70,7 +69,7 @@ playlist_save(ScreenManager &screen, struct mpdclient &c,

/* query the user for a filename */
filename = screen_readln(screen, _("Save queue as"),
defaultname,
nullptr,
nullptr,
completion);
if (filename.empty())
Expand Down
8 changes: 2 additions & 6 deletions src/save_playlist.hxx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project

#ifndef SAVE_PLAYLIST_H
#define SAVE_PLAYLIST_H
#pragma once

class ScreenManager;
struct mpdclient;

int
playlist_save(ScreenManager &screen, struct mpdclient &c,
const char *name,
const char *defaultname) noexcept;

#endif
const char *name) noexcept;

0 comments on commit 1025a2c

Please sign in to comment.