gui: Give the QueueToolbar an init() function
GtkBuilder doesn't let me pass additional parameters to classes constructed with get_widget_derived(), so I have to use an init() function for flags and other parameters. This patch adds flags for which buttons to show on the queue toolbar. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
3ed32813da
commit
acbafd2361
|
@ -30,8 +30,7 @@ public:
|
|||
builder->get_widget_derived("QueueToolbar", collection_toolbar);
|
||||
builder->get_widget_derived("QueueWindow", collection_window);
|
||||
|
||||
collection_toolbar->q_switch->hide();
|
||||
collection_toolbar->q_repeat->hide();
|
||||
collection_toolbar->init(T_RANDOM);
|
||||
|
||||
collection_vbox.set_margin_left(1);
|
||||
collection_vbox.set_margin_right(1);
|
||||
|
|
|
@ -29,9 +29,6 @@ public:
|
|||
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);
|
||||
|
|
|
@ -94,9 +94,6 @@ public:
|
|||
builder->get_widget_derived("QueueToolbar", playlist_toolbar);
|
||||
builder->get_widget_derived("QueueWindow", playlist_tracks);
|
||||
|
||||
playlist_toolbar->q_switch->hide();
|
||||
playlist_toolbar->q_repeat->hide();
|
||||
|
||||
playlist_hbox.pack_start(*playlist_window, false, true);
|
||||
playlist_hbox.pack_start(*playlist_tracks, true, true);
|
||||
playlist_hbox.show();
|
||||
|
|
|
@ -108,6 +108,7 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
|||
* Now set up the toolbar
|
||||
*/
|
||||
builder->get_widget_derived("QueueToolbar", q_toolbar);
|
||||
q_toolbar->init(T_RANDOM | T_REPEAT | T_SWITCH);
|
||||
|
||||
/*
|
||||
* And the treeview with scrolled window
|
||||
|
@ -124,6 +125,7 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
|||
q_vbox.set_homogeneous(false);
|
||||
q_vbox.pack_start(*q_toolbar, false, true, 2);
|
||||
q_vbox.pack_start(*q_window, true, true);
|
||||
q_vbox.show();
|
||||
|
||||
|
||||
/*
|
||||
|
@ -142,7 +144,6 @@ QueueTab :: QueueTab(Queue *pq, unsigned int num)
|
|||
|
||||
gui :: get_widget<Gtk::Notebook>("o_notebook")->insert_page(q_vbox, *q_label, num);
|
||||
gui :: get_widget<Gtk::Notebook>("o_notebook")->set_tab_reorderable(q_vbox);
|
||||
q_vbox.show_all();
|
||||
}
|
||||
|
||||
QueueTab :: ~QueueTab()
|
||||
|
|
|
@ -16,3 +16,13 @@ QueueToolbar :: QueueToolbar(BaseObjectType *cobject,
|
|||
QueueToolbar :: ~QueueToolbar()
|
||||
{
|
||||
}
|
||||
|
||||
void QueueToolbar :: init(unsigned int flags)
|
||||
{
|
||||
if (flags & T_SWITCH)
|
||||
q_switch->show();
|
||||
if (flags & T_RANDOM)
|
||||
q_random->show();
|
||||
if (flags & T_REPEAT)
|
||||
q_repeat->show();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
|
||||
#include <gtkmm.h>
|
||||
|
||||
enum toolbar_flags {
|
||||
T_RANDOM = (1 << 0),
|
||||
T_REPEAT = (1 << 1),
|
||||
T_SWITCH = (1 << 2),
|
||||
};
|
||||
|
||||
|
||||
class QueueToolbar : public Gtk::HBox {
|
||||
private:
|
||||
Glib::RefPtr<Gtk::Builder> _builder;
|
||||
|
@ -18,6 +25,7 @@ public:
|
|||
|
||||
QueueToolbar(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
|
||||
~QueueToolbar();
|
||||
void init(unsigned int);
|
||||
};
|
||||
|
||||
#endif /* OCARINA_GUI_QUEUE_TOOLBAR_H */
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="q_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="state">True</property>
|
||||
|
@ -37,7 +36,6 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="q_repeat">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
|
@ -57,7 +55,6 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="q_random">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
|
|
Loading…
Reference in New Issue