gui: Rearrange playlist tab
Other files in the gui implement their classes directly, rather than making extra functions. Let's do that here, too. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
300acde068
commit
b940fe710c
|
@ -6,11 +6,37 @@
|
|||
#include <gui/tabs.h>
|
||||
|
||||
|
||||
static bool find_cur_path(Gtk::TreePath &);
|
||||
|
||||
|
||||
class PlaylistTab : public Tab {
|
||||
public:
|
||||
PlaylistTab();
|
||||
~PlaylistTab();
|
||||
bool on_key_press_event(const std::string &);
|
||||
PlaylistTab() : Tab(playlist :: get_queue())
|
||||
{
|
||||
tab_search = lib :: get_widget<Gtk::SearchEntry>("o_playlist_entry");
|
||||
tab_treeview = lib :: get_widget<Gtk::TreeView>("o_playlist_pq_treeview");
|
||||
tab_widget = lib :: get_widget<Gtk::Widget>("o_playlist_page");
|
||||
tab_finish_init();
|
||||
}
|
||||
|
||||
~PlaylistTab()
|
||||
{
|
||||
tab_unmap();
|
||||
}
|
||||
|
||||
bool on_key_press_event(const std::string &key)
|
||||
{
|
||||
Gtk::TreePath path;
|
||||
std::vector<unsigned int> ids;
|
||||
|
||||
if (key != "Delete")
|
||||
return Tab :: on_key_press_event(key);
|
||||
if (find_cur_path(path)) {
|
||||
tab_selected_ids(ids);
|
||||
plist :: del_path_ids(path, ids);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static PlaylistTab *p_tab;
|
||||
|
@ -51,36 +77,3 @@ void init_playlist_tab()
|
|||
p_treeview->signal_button_press_event().connect(sigc::ptr_fun(on_playlist_clicked));
|
||||
p_treeview->set_cursor(Gtk::TreePath("0"));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Playlist tab stuff
|
||||
*/
|
||||
PlaylistTab :: PlaylistTab()
|
||||
: Tab(playlist :: get_queue())
|
||||
{
|
||||
tab_search = lib :: get_widget<Gtk::SearchEntry>("o_playlist_entry");
|
||||
tab_treeview = lib :: get_widget<Gtk::TreeView>("o_playlist_pq_treeview");
|
||||
tab_widget = lib :: get_widget<Gtk::Widget>("o_playlist_page");
|
||||
|
||||
tab_finish_init();
|
||||
}
|
||||
|
||||
PlaylistTab :: ~PlaylistTab()
|
||||
{
|
||||
tab_unmap();
|
||||
}
|
||||
|
||||
bool PlaylistTab :: on_key_press_event(const std::string &key)
|
||||
{
|
||||
Gtk::TreePath path;
|
||||
std::vector<unsigned int> ids;
|
||||
|
||||
if (key != "Delete")
|
||||
return Tab :: on_key_press_event(key);
|
||||
if (find_cur_path(path)) {
|
||||
tab_selected_ids(ids);
|
||||
plist :: del_path_ids(path, ids);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue