gui: Convert the history tab to use the new template files

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-04-12 10:17:40 -04:00
parent 3dd123fbfd
commit b2b23bec46
6 changed files with 123 additions and 265 deletions

View File

@ -3,18 +3,51 @@
*/
#include <core/deck.h>
#include <gui/tabs.h>
#include <gui/queue/label.h>
#include <gui/queue/toolbar.h>
#include <gui/queue/window.h>
class HistoryTab : public Tab {
private:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::VBox history_vbox;
HistoryLabel *history_label;
QueueToolbar *history_toolbar;
QueueWindow *history_window;
public:
HistoryTab() : Tab(deck :: get_queue())
{
tab_search = gui :: get_widget<Gtk::SearchEntry>("o_history_entry");
tab_size = gui :: get_widget<Gtk::Label>("o_history_size");
tab_treeview = gui :: get_widget<Gtk::TreeView>("o_history_treeview");
tab_widget = gui :: get_widget<Gtk::Widget>("o_history_page");
builder = Gtk::Builder::create();
builder->add_from_file(gui :: share_file("QueueWindow.ui"));
builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
builder->add_from_file(gui :: share_file("QueueLabel.ui"));
builder->get_widget_derived("HistoryLabel", history_label);
builder->get_widget_derived("QueueToolbar", history_toolbar);
builder->get_widget_derived("QueueWindow", history_window);
history_toolbar->q_switch->hide();
history_toolbar->q_repeat->hide();
history_vbox.set_margin_left(1);
history_vbox.set_margin_right(1);
history_vbox.set_homogeneous(false);
history_vbox.pack_start(*history_toolbar, false, true, 2);
history_vbox.pack_start(*history_window, true, true);
history_vbox.show();
tab_random = history_toolbar->q_random;
tab_repeat = history_toolbar->q_repeat;
tab_search = history_toolbar->q_search;
tab_size = history_label->history_size;
tab_treeview = history_window->q_treeview;
tab_widget = &history_vbox;
tab_finish_init();
gui :: get_widget<Gtk::Notebook>("o_notebook")->insert_page(history_vbox, *history_label, 0);
}
~HistoryTab()

View File

@ -17,6 +17,19 @@ CollectionLabel :: ~CollectionLabel()
HistoryLabel :: HistoryLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)
{
_builder->get_widget("history_size", history_size);
}
HistoryLabel :: ~HistoryLabel()
{
}
TempLabel :: TempLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)

View File

@ -490,8 +490,8 @@ void init_tabs()
}
/* Initialize other tabs */
init_collection_tab();
init_history_tab();
init_collection_tab();
init_queue_tabs();
}

View File

@ -20,6 +20,19 @@ public:
class HistoryLabel : public Gtk::HBox {
private:
Glib::RefPtr<Gtk::Builder> _builder;
public:
Gtk::Label *history_size;
HistoryLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~HistoryLabel();
};
class TempLabel : public Gtk::HBox {
private:
Glib::RefPtr<Gtk::Builder> _builder;

View File

@ -58,6 +58,63 @@
</packing>
</child>
</object>
<object class="GtkBox" id="HistoryLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-open-recent</property>
<property name="icon_size">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;big&gt;History&lt;/big&gt;</property>
<property name="use_markup">True</property>
<property name="justify">center</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="history_size">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">0</property>
<property name="justify">center</property>
</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>
</object>
<object class="GtkBox" id="TempLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -237,260 +237,6 @@
<property name="tab_pos">left</property>
<property name="scrollable">True</property>
<property name="enable_popup">True</property>
<child>
<object class="GtkBox" id="o_history_page">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">1</property>
<property name="margin_right">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry" id="o_history_entry">
<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>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<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_history_treeview">
<property name="visible">True</property>
<property name="can_focus">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-selection4">
<property name="mode">multiple</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn13">
<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="cellrenderertext12"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn14">
<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="cellrenderertext13"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn15">
<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="cellrenderertext14"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn16">
<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="cellrenderertext15"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn17">
<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="cellrenderertext16"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn18">
<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="cellrenderertext17"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn19">
<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="cellrenderertext18"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn20">
<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="cellrenderertext19"/>
<attributes>
<attribute name="text">7</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">1</property>
<property name="title" translatable="yes">Played</property>
<property name="clickable">True</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext20"/>
<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>
</child>
<child type="tab">
<object class="GtkBox" id="box20">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkImage" id="image15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">document-open-recent</property>
<property name="icon_size">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">1</property>
<property name="label" translatable="yes">&lt;big&gt;History&lt;/big&gt;</property>
<property name="use_markup">True</property>
<property name="justify">center</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="o_history_size">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">0</property>
<property name="justify">center</property>
</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>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="o_playlist_page">
<property name="visible">True</property>
@ -732,9 +478,6 @@
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkBox" id="box22">
@ -771,7 +514,6 @@ Manager</property>
</child>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
@ -980,7 +722,7 @@ Manager</property>
</child>
</object>
<packing>
<property name="position">2</property>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
@ -1018,7 +760,7 @@ Manager</property>
</child>
</object>
<packing>
<property name="position">2</property>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>