diff --git a/gui/collection_tab.cpp b/gui/collection_tab.cpp index 2e983bb5..10273e1c 100644 --- a/gui/collection_tab.cpp +++ b/gui/collection_tab.cpp @@ -20,7 +20,6 @@ public: { tab_builder->add_from_file(gui :: share_file("QueueLabel.ui")); tab_builder->get_widget_derived("CollectionLabel", collection_label); - tab_toolbar->init(tab_pq, collection_label, tab_window, T_RANDOM); collection_label->init(tab_pq); tab_label = collection_label; diff --git a/gui/history.cpp b/gui/history.cpp index be722a05..aac76ac3 100644 --- a/gui/history.cpp +++ b/gui/history.cpp @@ -19,7 +19,6 @@ public: { tab_builder->add_from_file(gui :: share_file("QueueLabel.ui")); tab_builder->get_widget_derived("HistoryLabel", history_label); - tab_toolbar->init(tab_pq, history_label, tab_window, 0); history_label->init(tab_pq); tab_label = history_label; diff --git a/gui/playlist_tab.cpp b/gui/playlist_tab.cpp index 96f9312d..f3884c4e 100644 --- a/gui/playlist_tab.cpp +++ b/gui/playlist_tab.cpp @@ -28,8 +28,6 @@ public: tab_builder->add_from_file(gui :: share_file("QueueLabel.ui")); tab_builder->get_widget_derived("PlaylistLabel", playlist_label); - tab_toolbar->init(tab_pq, playlist_label, tab_window, 0); - playlist_label->init(tab_pq); tab_label = playlist_label; diff --git a/gui/queue/toolbar.cpp b/gui/queue/toolbar.cpp deleted file mode 100644 index f1a833fb..00000000 --- a/gui/queue/toolbar.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2015 (c) Anna Schumaker. - */ -#include - -QueueToolbar :: QueueToolbar(BaseObjectType *cobject, - const Glib::RefPtr builder) - : Gtk::HBox(cobject), _builder(builder) -{ - _builder->get_widget("q_search", q_search); - _builder->get_widget("q_switch", _q_switch); - _builder->get_widget("q_repeat", _q_repeat); - _builder->get_widget("q_random", _q_random); - - q_search->signal_key_release_event().connect(sigc::mem_fun(*this, - &QueueToolbar::on_search_key_released)); - q_search->signal_search_changed().connect(sigc::mem_fun(*this, - &QueueToolbar::on_search_changed)); -} - -QueueToolbar :: ~QueueToolbar() -{ -} - -void QueueToolbar :: init(queue *queue, QueueLabel *label, - QueueWindow *window, unsigned int flags) -{ - _queue = queue; - _q_label = label; - _q_window = window; - - if (flags & T_SWITCH) { - _q_switch->property_active().signal_changed().connect( - sigc::mem_fun(*this, &QueueToolbar::on_switch_toggled)); - _q_switch->set_active(queue_has_flag(_queue, Q_ENABLED)); - _q_switch->show(); - } - - if (flags & T_RANDOM) { - _q_random->signal_toggled().connect(sigc::mem_fun(*this, - &QueueToolbar::on_random_toggled)); - _q_random->set_active(queue_has_flag(_queue, Q_RANDOM)); - _q_random->show(); - } - - if (flags & T_REPEAT) { - _q_repeat->signal_toggled().connect(sigc::mem_fun(*this, - &QueueToolbar::on_repeat_toggled)); - _q_repeat->set_active(queue_has_flag(_queue, Q_REPEAT)); - _q_repeat->show(); - } -} - -void QueueToolbar :: on_random_toggled() -{ - if (_q_random->get_active()) - queue_set_flag(_queue, Q_RANDOM); - else - queue_unset_flag(_queue, Q_RANDOM); -} - -void QueueToolbar :: on_repeat_toggled() -{ - if (_q_repeat->get_active()) - queue_set_flag(_queue, Q_REPEAT); - else - queue_unset_flag(_queue, Q_REPEAT); -} - -bool QueueToolbar :: on_search_key_released(GdkEventKey *event) -{ - std::string key = gdk_keyval_name(event->keyval); - return key == "space"; -} - -void QueueToolbar :: on_search_changed() -{ - std::string text = q_search->get_text(); - _q_window->filter(text); -} - -void QueueToolbar :: on_switch_toggled() -{ - bool active = _q_switch->get_active(); - - if (active) - queue_set_flag(_queue, Q_ENABLED); - else - queue_unset_flag(_queue, Q_ENABLED); - - _q_label->set_sensitive(active); - _q_window->set_sensitive(active); -} diff --git a/gui/queue_tab.cpp b/gui/queue_tab.cpp index 63d000e5..1b75ffe0 100644 --- a/gui/queue_tab.cpp +++ b/gui/queue_tab.cpp @@ -85,12 +85,6 @@ QueueTab :: QueueTab(queue *pq, unsigned int num) queue_set_number(num); - /* - * Now set up the toolbar - */ - tab_toolbar->init(pq, q_label, tab_window, T_RANDOM | T_REPEAT | T_SWITCH); - - /* * Fill in the page! */ diff --git a/gui/tabs.cpp b/gui/tabs.cpp index 1c214704..a513c39a 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -78,9 +78,7 @@ Tab :: Tab(queue *pq) queue_mapping[tab_pq] = this; tab_builder = Gtk::Builder::create(); - tab_builder->add_from_file(gui :: share_file("QueueToolbar.ui")); tab_builder->add_from_file(gui :: share_file("QueueWindow.ui")); - tab_builder->get_widget_derived("QueueToolbar", tab_toolbar); tab_builder->get_widget_derived("QueueWindow", tab_window); tab_window->init(tab_pq); @@ -97,8 +95,6 @@ Tab :: Tab(queue *pq) tab_vbox.set_margin_start(1); tab_vbox.set_margin_end(1); tab_vbox.set_homogeneous(false); - - tab_vbox.pack_start(*tab_toolbar, false, true, 2); tab_vbox.show(); tab_runtime_changed(); @@ -188,11 +184,6 @@ void Tab :: tab_unmap() queue_mapping.erase(tab_pq); } -void Tab :: tab_focus_search() -{ - tab_toolbar->q_search->grab_focus(); -} - void Tab :: tab_selected_ids(std::vector &ids) { Glib::RefPtr sel = tab_window->q_treeview->get_selection(); @@ -415,14 +406,6 @@ static void on_search_changed() tab->tab_window->filter(text); } -void tab_focus_search() -{ - int page = Glib :: wrap(GTK_NOTEBOOK(gui_builder_widget("o_notebook")), false)->get_current_page(); - Tab *tab = find_tab(page); - if (tab) - tab->tab_focus_search(); -} - static void on_new_pq() { Tab *tab = cur_tab(); @@ -468,9 +451,7 @@ static bool on_window_key_pressed(GdkEventKey *event) key = key.substr(3); } - if (key == "slash") - tab_focus_search(); - else if (key >= "0" && key <= "9") { + if (key >= "0" && key <= "9") { unsigned int n = atoi(key.c_str()); if (n < tempq_count()) notebook->set_current_page(n); diff --git a/include/gui/queue/toolbar.h b/include/gui/queue/toolbar.h deleted file mode 100644 index e1b2727c..00000000 --- a/include/gui/queue/toolbar.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2015 (c) Anna Schumaker. - */ -#ifndef OCARINA_GUI_QUEUE_TOOLBAR_H -#define OCARINA_GUI_QUEUE_TOOLBAR_H - -extern "C" { -#include -} -#include -#include -#include - -enum toolbar_flags { - T_RANDOM = (1 << 0), - T_REPEAT = (1 << 1), - T_SWITCH = (1 << 2), -}; - - -class QueueToolbar : public Gtk::HBox { -private: - Glib::RefPtr _builder; - queue *_queue; - QueueLabel *_q_label; - QueueWindow *_q_window; - - - Gtk::ToggleButton *_q_random; - Gtk::ToggleButton *_q_repeat; - Gtk::Switch *_q_switch; - -public: - Gtk::SearchEntry *q_search; - - QueueToolbar(BaseObjectType *, const Glib::RefPtr); - ~QueueToolbar(); - - void init(queue *, QueueLabel*, QueueWindow*, unsigned int); - - void on_random_toggled(); - void on_repeat_toggled(); - bool on_search_key_released(GdkEventKey *event); - void on_search_changed(); - void on_switch_toggled(); -}; - -#endif /* OCARINA_GUI_QUEUE_TOOLBAR_H */ diff --git a/include/gui/tabs.h b/include/gui/tabs.h index 60214dfa..3c201f36 100644 --- a/include/gui/tabs.h +++ b/include/gui/tabs.h @@ -5,8 +5,8 @@ #define OCARINA_TABS_H #include +#include #include -#include #include #include #include @@ -21,7 +21,6 @@ protected: queue *tab_pq; Gtk::VBox tab_vbox; - QueueToolbar *tab_toolbar; QueueLabel *tab_label; /** diff --git a/share/ocarina/QueueToolbar.ui b/share/ocarina/QueueToolbar.ui deleted file mode 100644 index 95b03d85..00000000 --- a/share/ocarina/QueueToolbar.ui +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - True - False - 5 - - - True - True - edit-find-symbolic - False - False - - - True - True - 0 - - - - - True - True - - - False - True - 1 - - - - - True - True - False - - - True - False - media-playlist-repeat - - - - - False - True - 2 - - - - - True - True - False - - - True - False - media-playlist-shuffle - - - - - False - True - 3 - - - -