gui/playlist_tab: Remove custom list from tab
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
9ee00f9997
commit
84ff59cf81
|
@ -6,6 +6,7 @@ extern "C" {
|
|||
#include <core/collection.h>
|
||||
#include <core/playlist.h>
|
||||
#include <gui/builder.h>
|
||||
#include <gui/playlist.h>
|
||||
}
|
||||
#include <gui/tabs.h>
|
||||
#include <gui/queue/label.h>
|
||||
|
@ -16,95 +17,22 @@ static Gtk::ToggleButton *o_fav;
|
|||
|
||||
|
||||
|
||||
static class PlaylistColumns : public Gtk::TreeModelColumnRecord {
|
||||
public:
|
||||
Gtk::TreeModelColumn<Glib::ustring> p_name;
|
||||
PlaylistColumns() { add(p_name); }
|
||||
} p_cols;
|
||||
|
||||
|
||||
|
||||
class PlaylistWindow : public Gtk::ScrolledWindow {
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Builder> _builder;
|
||||
|
||||
public:
|
||||
Gtk::TreeView *p_treeview;
|
||||
Glib::RefPtr<Gtk::ListStore> p_list;
|
||||
|
||||
PlaylistWindow(BaseObjectType *cobject,
|
||||
const Glib::RefPtr<Gtk::Builder> builder)
|
||||
: Gtk::ScrolledWindow(cobject), _builder(builder)
|
||||
{
|
||||
_builder->get_widget("p_treeview", p_treeview);
|
||||
p_list = Glib::RefPtr<Gtk::ListStore>::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++)
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkListStore" id="p_list">
|
||||
<columns>
|
||||
<!-- column-name Playlists -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Favorites</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Hidden</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Most Played</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Least Played</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">Unplayed</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="PlaylistWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="p_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">p_list</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="search_column">0</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection5">
|
||||
<property name="mode">browse</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="title" translatable="yes">Playlists</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue