gui: Begin the new playlist tab
The list of playlists is now created in glade, too =) Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
4104a4cede
commit
1d4ba1474d
|
@ -139,6 +139,20 @@
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkListStore" id="o_playlists">
|
||||||
|
<columns>
|
||||||
|
<!-- column-name Playlists -->
|
||||||
|
<column type="gchararray"/>
|
||||||
|
</columns>
|
||||||
|
<data>
|
||||||
|
<row>
|
||||||
|
<col id="0" translatable="yes">Favorites</col>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<col id="0" translatable="yes">Banned</col>
|
||||||
|
</row>
|
||||||
|
</data>
|
||||||
|
</object>
|
||||||
<object class="GtkAdjustment" id="o_progress">
|
<object class="GtkAdjustment" id="o_progress">
|
||||||
<property name="upper">100000000000</property>
|
<property name="upper">100000000000</property>
|
||||||
<property name="step_increment">1000000000</property>
|
<property name="step_increment">1000000000</property>
|
||||||
|
@ -713,15 +727,241 @@
|
||||||
<object class="GtkBox" id="box17">
|
<object class="GtkBox" id="box17">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">1</property>
|
||||||
|
<property name="margin_right">1</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkSearchEntry" id="searchentry3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||||
|
<property name="primary_icon_activatable">False</property>
|
||||||
|
<property name="primary_icon_sensitive">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkBox" id="box25">
|
||||||
</child>
|
<property name="visible">True</property>
|
||||||
<child>
|
<property name="can_focus">False</property>
|
||||||
<placeholder/>
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="scrolledwindow6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="o_playlist_treeview">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="model">o_playlists</property>
|
||||||
|
<property name="enable_search">False</property>
|
||||||
|
<property name="search_column">0</property>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection" id="treeview-selection">
|
||||||
|
<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="cellrenderertext30"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="scrolledwindow5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_bottom">5</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="o_playlist_pq_treeview">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="rules_hint">True</property>
|
||||||
|
<property name="enable_search">False</property>
|
||||||
|
<property name="rubber_banding">True</property>
|
||||||
|
<property name="tooltip_column">9</property>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection" id="treeview-selection7">
|
||||||
|
<property name="mode">multiple</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn22">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">20</property>
|
||||||
|
<property name="title" translatable="yes">#</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext21"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn23">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">300</property>
|
||||||
|
<property name="title" translatable="yes">Title</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext22"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">1</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn24">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">60</property>
|
||||||
|
<property name="title" translatable="yes">Length</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext23"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">2</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn25">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">100</property>
|
||||||
|
<property name="title" translatable="yes">Artist</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext24"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">3</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn26">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">100</property>
|
||||||
|
<property name="title" translatable="yes">Album</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext25"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">4</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn27">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">45</property>
|
||||||
|
<property name="title" translatable="yes">Year</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext26"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">5</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn28">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">100</property>
|
||||||
|
<property name="title" translatable="yes">Genre</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext27"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">6</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn29">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">60</property>
|
||||||
|
<property name="title" translatable="yes">Count</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext28"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">7</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn30">
|
||||||
|
<property name="resizable">True</property>
|
||||||
|
<property name="sizing">fixed</property>
|
||||||
|
<property name="fixed_width">1</property>
|
||||||
|
<property name="title" translatable="yes">Played</property>
|
||||||
|
<property name="clickable">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext29"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">8</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -812,7 +1052,7 @@ Manager</property>
|
||||||
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
<object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
|
||||||
<property name="fixed_width">20</property>
|
<property name="fixed_width">20</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererToggle" id="o_collection_toggle"/>
|
<object class="GtkCellRendererToggle" id="o_collection_toggle"/>
|
||||||
|
@ -823,7 +1063,7 @@ Manager</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
|
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
||||||
<property name="fixed_width">60</property>
|
<property name="fixed_width">60</property>
|
||||||
<property name="title" translatable="yes">Size</property>
|
<property name="title" translatable="yes">Size</property>
|
||||||
<child>
|
<child>
|
||||||
|
@ -835,7 +1075,7 @@ Manager</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
<object class="GtkTreeViewColumn" id="treeviewcolumn32">
|
||||||
<property name="title" translatable="yes">Path</property>
|
<property name="title" translatable="yes">Path</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 (c) Anna Schumaker.
|
||||||
|
*/
|
||||||
|
#include <playlist.h>
|
||||||
|
#include <ocarina.h>
|
||||||
|
|
||||||
|
static Glib::RefPtr<PlayqueueModel> model;
|
||||||
|
|
||||||
|
static class PlaylistColumns : public Gtk::TreeModelColumnRecord {
|
||||||
|
public:
|
||||||
|
PlaylistColumns()
|
||||||
|
{ add(plist_col_name); }
|
||||||
|
|
||||||
|
Gtk::TreeModelColumn<std::string> plist_col_name;
|
||||||
|
} plist_cols;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic helper functions
|
||||||
|
*/
|
||||||
|
static inline Playqueue *playlist_pq()
|
||||||
|
{
|
||||||
|
return playlist::get_pq();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Gtk::TreeView *get_playlist_treeview()
|
||||||
|
{
|
||||||
|
return get_widget<Gtk::TreeView>("o_playlist_treeview");
|
||||||
|
}
|
||||||
|
|
||||||
|
static Glib::RefPtr<Gtk::ListStore> get_playlists()
|
||||||
|
{
|
||||||
|
return get_object<Gtk::ListStore>("o_playlists");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gtk signal functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void on_playlist_cursor_changed()
|
||||||
|
{
|
||||||
|
Gtk::TreePath path;
|
||||||
|
Gtk::TreeViewColumn *col;
|
||||||
|
Gtk::TreeModel::Row row;
|
||||||
|
|
||||||
|
get_playlist_treeview()->get_cursor(path, col);
|
||||||
|
row = *(get_playlists()->get_iter(path));
|
||||||
|
|
||||||
|
print("%s\n", row[plist_cols.plist_col_name]);
|
||||||
|
//playlist::select(row[plist_cols.plist_col_name]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool on_playlist_clicked(GdkEventButton *button)
|
||||||
|
{
|
||||||
|
if (button->button != 3)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions exposed through a TabFuncs structure
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void playlist_init_late() {}
|
||||||
|
static void playlist_cleanup() {}
|
||||||
|
|
||||||
|
static bool playlist_has_queue(Playqueue *pq)
|
||||||
|
{
|
||||||
|
return pq == playlist_pq();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void playlist_track_added(Playqueue *pq, unsigned int row)
|
||||||
|
{
|
||||||
|
model->on_row_inserted(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void playlist_track_deleted(Playqueue *pq, unsigned int row)
|
||||||
|
{
|
||||||
|
model->on_row_deleted(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct TabFuncs playlist_funcs = {
|
||||||
|
.init_late = playlist_init_late,
|
||||||
|
.cleanup = playlist_cleanup,
|
||||||
|
|
||||||
|
.has_queue = playlist_has_queue,
|
||||||
|
.track_added = playlist_track_added,
|
||||||
|
.track_deleted = playlist_track_deleted,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic tab setup
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct TabFuncs *init_playlist_tab()
|
||||||
|
{
|
||||||
|
Gtk::TreeView *playlist = get_playlist_treeview();
|
||||||
|
|
||||||
|
model = Glib::RefPtr<PlayqueueModel>(new PlayqueueModel(playlist_pq()));
|
||||||
|
get_widget<Gtk::TreeView>("o_playlist_pq_treeview")->set_model(model);
|
||||||
|
|
||||||
|
playlist->signal_cursor_changed().connect(sigc::ptr_fun(on_playlist_cursor_changed));
|
||||||
|
playlist->signal_button_press_event().connect(sigc::ptr_fun(on_playlist_clicked));
|
||||||
|
playlist->set_cursor(Gtk::TreePath("0"));
|
||||||
|
|
||||||
|
return &playlist_funcs;
|
||||||
|
}
|
|
@ -945,6 +945,7 @@ void init_tabs()
|
||||||
|
|
||||||
tab_types.push_back(init_collection_tab());
|
tab_types.push_back(init_collection_tab());
|
||||||
tab_types.push_back(init_history_tab());
|
tab_types.push_back(init_history_tab());
|
||||||
|
tab_types.push_back(init_playlist_tab());
|
||||||
|
|
||||||
notebook->signal_switch_page().connect(sigc::ptr_fun(on_switch_page));
|
notebook->signal_switch_page().connect(sigc::ptr_fun(on_switch_page));
|
||||||
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
|
notebook->signal_page_reordered().connect(sigc::ptr_fun(on_page_reordered));
|
||||||
|
|
|
@ -63,6 +63,9 @@ public:
|
||||||
unsigned int path_to_id(const Gtk::TreePath &);
|
unsigned int path_to_id(const Gtk::TreePath &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* playlist.cpp */
|
||||||
|
struct TabFuncs *init_playlist_tab();
|
||||||
|
|
||||||
|
|
||||||
/* tabs.cpp */
|
/* tabs.cpp */
|
||||||
void queue_selected(bool);
|
void queue_selected(bool);
|
||||||
|
|
Loading…
Reference in New Issue