libsaria: Remove name field from playlists

I know what playlists are library, recent and banned.  All others are
just named "Playlist" so there is no need to set up a name variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-11-03 15:34:13 -04:00
parent b98373c0fa
commit cf8ded7d5d
7 changed files with 10 additions and 18 deletions

View File

@ -52,7 +52,6 @@ namespace libsaria
void do_sort();
protected:
string name;
vector<Track *> plist;
void pick_random();
@ -60,7 +59,7 @@ namespace libsaria
void add_sorted(list<Track *> &);
public:
Playlist(string, unsigned int);
Playlist(unsigned int);
virtual ~Playlist();
void push_front(Track *);
@ -83,7 +82,6 @@ namespace libsaria
void set_disabled(bool);
string &get_name();
void renumber(int);
unsigned int get_number();
unsigned int get_size();

View File

@ -3,7 +3,7 @@
#include <library.h>
#include <ban.h>
static libsaria::Playlist banned_plist("Banned", PL_STATIC | PL_NO_DRAIN | PL_RANDOM | PL_SORTED);
static libsaria::Playlist banned_plist(PL_STATIC | PL_NO_DRAIN | PL_RANDOM | PL_SORTED);
namespace libsaria
{

View File

@ -17,7 +17,7 @@ using namespace std;
static unsigned int next_id = 0;
static list<struct libsaria::library::Path> path_list;
libsaria::Playlist lib_playlist("Library", PL_STATIC | PL_NO_DRAIN | PL_SORTED);
libsaria::Playlist lib_playlist(PL_STATIC | PL_NO_DRAIN | PL_SORTED);
libsaria::library::Path *push_path(libsaria::library::Path &path)
{

View File

@ -15,7 +15,7 @@ static AutoPauseType pause_type;
static unsigned short pause_count = 0;
static list<libsaria::Playlist *> playlist_deck;
static libsaria::Playlist recent_plist("Recent", PL_STATIC | PL_NO_DRAIN);
static libsaria::Playlist recent_plist(PL_STATIC | PL_NO_DRAIN);
static void renumber_playlists()
{
@ -110,7 +110,7 @@ namespace libsaria
if (playlist_deck.size() == MAX_PLAYLISTS)
return NULL;
plist = new Playlist("Playlist", flags);
plist = new Playlist(flags);
if (front)
deck::push_front(plist);

View File

@ -7,9 +7,8 @@
namespace libsaria
{
Playlist::Playlist(string n, unsigned int f)
Playlist::Playlist(unsigned int f)
{
name = n;
number = -1;
flags = f;
length = 0;
@ -95,11 +94,6 @@ namespace libsaria
return index.is_visible(track);
}
string &Playlist::get_name()
{
return name;
}
void Playlist::renumber(int n)
{
if (number == n)

View File

@ -1,4 +1,5 @@
// Copyright (c) 2012 Bryan Schumaker
#include <ban.h>
#include <track.h>
#include <library.h>
#include <stdlib.h>
@ -235,10 +236,9 @@ static void delete_from_playlist(GtkTreeView *treeview)
{
list<unsigned int> indices;
libsaria::Playlist *playlist = current_playlist();
string name = playlist->get_name();
if (name == "Library" || name == "Banned") {
ban_selected(treeview, name == "Library");
if (playlist == libsaria::library::get_playlist() || playlist == libsaria::ban::get_banned_plist()) {
ban_selected(treeview, playlist == libsaria::library::get_playlist());
return;
}

View File

@ -212,7 +212,7 @@ static void new_playlist(libsaria::Playlist *playlist)
{
struct PlaylistWidgets *widgets = new struct PlaylistWidgets;
dynamic_widgets.push_back(widgets);
init_page(playlist->get_name(), widgets, playlist,
init_page("Playlist", widgets, playlist,
libsaria::deck::get_playlist_index(playlist),
CLOSE_BUTTON | DISABLE_BUTTON | RANDOM_BUTTON | SORT_BUTTON);
gtk_notebook_set_tab_reorderable(tabs, GTK_WIDGET(widgets->page_box), true);