From b940fe710cdcdf30434b7f10608b553fa2bb73ef Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Thu, 15 Jan 2015 08:32:44 -0500 Subject: [PATCH] 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 --- gui/playlist.cpp | 65 +++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/gui/playlist.cpp b/gui/playlist.cpp index 4792a843..2b7cccdf 100644 --- a/gui/playlist.cpp +++ b/gui/playlist.cpp @@ -6,11 +6,37 @@ #include +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("o_playlist_entry"); + tab_treeview = lib :: get_widget("o_playlist_pq_treeview"); + tab_widget = lib :: get_widget("o_playlist_page"); + tab_finish_init(); + } + + ~PlaylistTab() + { + tab_unmap(); + } + + bool on_key_press_event(const std::string &key) + { + Gtk::TreePath path; + std::vector 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("o_playlist_entry"); - tab_treeview = lib :: get_widget("o_playlist_pq_treeview"); - tab_widget = lib :: get_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 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; -}