ocarina: Implement the banned playlist using GtkBuilder
I don't have a way to ban songs using GtkBuilder yet... that's coming, but for now I'll just assume it works :) Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
3ed02e221e
commit
ae39628b01
|
@ -17,6 +17,7 @@ static GtkWidget *yes_image;
|
|||
static GtkWidget *no_image;
|
||||
static GtkTreeModel *library_filter;
|
||||
static GtkTreeModel *recent_filter;
|
||||
static GtkTreeModel *banned_filter;
|
||||
|
||||
static void find_exe_path(string &res)
|
||||
{
|
||||
|
@ -94,6 +95,8 @@ GObject *get_object(const string &name)
|
|||
return G_OBJECT(library_filter);
|
||||
else if (name == "RecentFilter")
|
||||
return G_OBJECT(recent_filter);
|
||||
else if (name == "BannedFilter")
|
||||
return G_OBJECT(banned_filter);
|
||||
return gtk_builder_get_object(builder, name.c_str());
|
||||
}
|
||||
|
||||
|
@ -150,6 +153,9 @@ static void init_widgets()
|
|||
recent_filter = gtk_tree_model_filter_new(
|
||||
GTK_TREE_MODEL(get_object("RecentPlist")),
|
||||
NULL);
|
||||
banned_filter = gtk_tree_model_filter_new(
|
||||
GTK_TREE_MODEL(get_object("BannedPlist")),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void init(int argc, char **argv)
|
||||
|
@ -176,9 +182,6 @@ static void init(int argc, char **argv)
|
|||
connect_signal("NextButton", "clicked", libsaria::deck::next, NULL);
|
||||
|
||||
/* Show any widgets that need showing */
|
||||
/* ocarina::window::init();
|
||||
ocarina::body::init();*/
|
||||
ocarina::playlist::init();
|
||||
/* ocarina::init_pipe();*/
|
||||
gtk_timeout_add(100, timeout_poll, NULL);
|
||||
}
|
||||
|
|
|
@ -9,40 +9,6 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
static ocarina::Playlist banned_renderer(PL_STATIC);
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
void on_new_playlist(libsaria::Playlist *plist)
|
||||
{
|
||||
new Playlist(plist);
|
||||
}
|
||||
|
||||
void playlist::switch_to_banned()
|
||||
{
|
||||
banned_renderer.switch_to();
|
||||
}
|
||||
|
||||
void playlist::switch_to_plist(unsigned int n)
|
||||
{
|
||||
libsaria::Playlist *plist = libsaria::deck::get_playlist(n);
|
||||
ocarina::Playlist *renderer;
|
||||
|
||||
if (plist)
|
||||
renderer = (ocarina::Playlist *)plist->get_renderer();
|
||||
if (renderer)
|
||||
renderer->switch_to();
|
||||
}
|
||||
|
||||
void playlist::init()
|
||||
{
|
||||
libsaria::set_on_new_playlist(on_new_playlist);
|
||||
banned_renderer.set_playlist(libsaria::ban::get_banned_plist());
|
||||
}
|
||||
|
||||
}; /* Namespace: ocarina */
|
||||
|
||||
static gboolean is_visible(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
libsaria::Track *track;
|
||||
|
@ -86,6 +52,8 @@ static GtkListStore *find_list(libsaria::Playlist *plist)
|
|||
return GTK_LIST_STORE(get_object("LibraryPlist"));
|
||||
else if (plist == libsaria::deck::get_recent_plist())
|
||||
return GTK_LIST_STORE(get_object("RecentPlist"));
|
||||
else if (plist == libsaria::ban::get_banned_plist())
|
||||
return GTK_LIST_STORE(get_object("BannedPlist"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -95,6 +63,8 @@ static GtkWidget *find_label(libsaria::Playlist *plist)
|
|||
return get_widget("LibrarySize");
|
||||
else if (plist == libsaria::deck::get_recent_plist())
|
||||
return get_widget("RecentSize");
|
||||
else if (plist == libsaria::ban::get_banned_plist())
|
||||
return get_widget("BannedSize");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -104,6 +74,8 @@ static GtkTreeModelFilter *find_filter(libsaria::Playlist *plist)
|
|||
return GTK_TREE_MODEL_FILTER(get_object("LibraryFilter"));
|
||||
else if (plist == libsaria::deck::get_recent_plist())
|
||||
return GTK_TREE_MODEL_FILTER(get_object("RecentFilter"));
|
||||
else if (plist == libsaria::ban::get_banned_plist())
|
||||
return GTK_TREE_MODEL_FILTER(get_object("BannedFilter"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -172,4 +144,5 @@ void init_playlist()
|
|||
|
||||
init_playlist_tab(libsaria::library::get_playlist(), "LibraryPlistView", "LibraryEntry");
|
||||
init_playlist_tab(libsaria::deck::get_recent_plist(), "RecentView", "RecentEntry");
|
||||
init_playlist_tab(libsaria::ban::get_banned_plist(), "BannedView", "BannedEntry");
|
||||
}
|
||||
|
|
232
xml/ocarina.xml
232
xml/ocarina.xml
|
@ -2,6 +2,30 @@
|
|||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="BannedPlist">
|
||||
<columns>
|
||||
<!-- column-name Pointer -->
|
||||
<column type="gpointer"/>
|
||||
<!-- column-name # -->
|
||||
<column type="guint"/>
|
||||
<!-- column-name Title -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Length -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Artist -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Album -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Year -->
|
||||
<column type="guint"/>
|
||||
<!-- column-name Count -->
|
||||
<column type="guint"/>
|
||||
<!-- column-name Last -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Filepath -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkAction" id="action1"/>
|
||||
<object class="GtkFileChooserDialog" id="DirectoryChooser">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -601,6 +625,214 @@
|
|||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="BannedEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">True</property>
|
||||
<property name="secondary_icon_sensitive">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</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="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="BannedView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">BannedPlist</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="rules_hint">True</property>
|
||||
<property name="search_column">1</property>
|
||||
<property name="tooltip_column">9</property>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn20">
|
||||
<property name="resizable">True</property>
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="fixed_width">20</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">#</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext19"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn21">
|
||||
<property name="resizable">True</property>
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="fixed_width">300</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Title</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext20"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn22">
|
||||
<property name="resizable">True</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Length</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext21"/>
|
||||
<attributes>
|
||||
<attribute name="text">3</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">125</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Artist</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext22"/>
|
||||
<attributes>
|
||||
<attribute name="text">4</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">125</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Album</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext23"/>
|
||||
<attributes>
|
||||
<attribute name="text">5</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn25">
|
||||
<property name="resizable">True</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Year</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext24"/>
|
||||
<attributes>
|
||||
<attribute name="text">6</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn26">
|
||||
<property name="resizable">True</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Count</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext25"/>
|
||||
<attributes>
|
||||
<attribute name="text">7</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn27">
|
||||
<property name="resizable">True</property>
|
||||
<property name="min_width">2</property>
|
||||
<property name="max_width">700</property>
|
||||
<property name="title" translatable="yes">Played</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext26"/>
|
||||
<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="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkVBox" id="vbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">Banned</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="BannedSize">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
Loading…
Reference in New Issue