From 84ff59cf81f514b4306b79134f60d08be2596e04 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 4 Jan 2016 09:56:37 -0500 Subject: [PATCH] gui/playlist_tab: Remove custom list from tab Signed-off-by: Anna Schumaker --- gui/playlist_tab.cpp | 80 ++------------------------------- share/ocarina/PlaylistWindow.ui | 60 ------------------------- 2 files changed, 4 insertions(+), 136 deletions(-) delete mode 100644 share/ocarina/PlaylistWindow.ui diff --git a/gui/playlist_tab.cpp b/gui/playlist_tab.cpp index 95addec4..82b2a7f6 100644 --- a/gui/playlist_tab.cpp +++ b/gui/playlist_tab.cpp @@ -6,6 +6,7 @@ extern "C" { #include #include #include +#include } #include #include @@ -16,95 +17,22 @@ static Gtk::ToggleButton *o_fav; -static class PlaylistColumns : public Gtk::TreeModelColumnRecord { -public: - Gtk::TreeModelColumn p_name; - PlaylistColumns() { add(p_name); } -} p_cols; - - - -class PlaylistWindow : public Gtk::ScrolledWindow { -private: - Glib::RefPtr _builder; - -public: - Gtk::TreeView *p_treeview; - Glib::RefPtr p_list; - - PlaylistWindow(BaseObjectType *cobject, - const Glib::RefPtr builder) - : Gtk::ScrolledWindow(cobject), _builder(builder) - { - _builder->get_widget("p_treeview", p_treeview); - p_list = Glib::RefPtr::cast_static(_builder->get_object("p_list")); - - p_treeview->signal_cursor_changed().connect(sigc::mem_fun(*this, - &PlaylistWindow::on_cursor_changed)); - p_treeview->signal_button_press_event().connect(sigc::mem_fun(*this, - &PlaylistWindow::on_clicked)); - } - - ~PlaylistWindow() {} - - enum playlist_t current_playlist() - { - Gtk::TreePath path; - Gtk::TreeModel::Row row; - Gtk::TreeViewColumn *col; - - p_treeview->get_cursor(path, col); - row = *(p_list->get_iter(path)); - - if (row[p_cols.p_name] == "Favorites") - return PL_FAVORITED; - else if (row[p_cols.p_name] == "Hidden") - return PL_HIDDEN; - else if (row[p_cols.p_name] == "Most Played") - return PL_MOST_PLAYED; - else if (row[p_cols.p_name] == "Least Played") - return PL_LEAST_PLAYED; - return PL_UNPLAYED; - } - - void on_cursor_changed() - { - playlist_select(current_playlist()); - } - - bool on_clicked(GdkEventButton *button) - { - return button->button == 3; - } -}; - - - static class PlaylistTab : public Tab { private: - Gtk::HBox playlist_hbox; - PlaylistLabel *playlist_label; - PlaylistWindow *playlist_window; public: PlaylistTab() : Tab(playlist_get_queue()) { tab_builder->add_from_file(gui :: share_file("QueueLabel.ui")); - tab_builder->add_from_file(gui :: share_file("PlaylistWindow.ui")); - tab_builder->get_widget_derived("PlaylistLabel", playlist_label); - tab_builder->get_widget_derived("PlaylistWindow", playlist_window); tab_toolbar->init(tab_pq, playlist_label, tab_window, 0); + playlist_label->init(tab_pq); tab_label = playlist_label; - playlist_hbox.pack_start(*playlist_window, false, true); - playlist_hbox.pack_start(*tab_window, true, true); - playlist_hbox.show(); - - tab_vbox.pack_start(playlist_hbox, true, true); + tab_vbox.pack_start(*tab_window, true, true); Glib :: wrap(GTK_NOTEBOOK(gui_builder_widget("o_notebook")), false)->insert_page(tab_vbox, *playlist_label, 0); @@ -123,7 +51,7 @@ public: if (key != "Delete") return Tab :: on_key_press_event(key); - cur = playlist_window->current_playlist(); + cur = gui_playlist_cur(); tab_selected_ids(ids); for (unsigned int i = 0; i < ids.size(); i++) diff --git a/share/ocarina/PlaylistWindow.ui b/share/ocarina/PlaylistWindow.ui deleted file mode 100644 index 8078ad08..00000000 --- a/share/ocarina/PlaylistWindow.ui +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - Favorites - - - Hidden - - - Most Played - - - Least Played - - - Unplayed - - - - - True - True - 5 - never - in - - - True - True - p_list - False - 0 - - - browse - - - - - Playlists - - - - 0 - - - - - - - -