playlist tab cleanups
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
160d2ac3be
commit
2890819cd3
|
@ -6,12 +6,6 @@
|
||||||
#include <gui/tabs.h>
|
#include <gui/tabs.h>
|
||||||
|
|
||||||
|
|
||||||
static bool find_cur_path(Gtk::TreePath &path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Playlist tab stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
class PlaylistTab : public Tab {
|
class PlaylistTab : public Tab {
|
||||||
public:
|
public:
|
||||||
PlaylistTab();
|
PlaylistTab();
|
||||||
|
@ -19,7 +13,49 @@ public:
|
||||||
bool on_key_press_event(const std::string &);
|
bool on_key_press_event(const std::string &);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static PlaylistTab *p_tab;
|
||||||
|
static Gtk::TreeView *p_treeview;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sidebar code
|
||||||
|
*/
|
||||||
|
static bool find_cur_path(Gtk::TreePath &path)
|
||||||
|
{
|
||||||
|
Gtk::TreeViewColumn *col;
|
||||||
|
p_treeview->get_cursor(path, col);
|
||||||
|
return !path.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_playlist_cursor_changed()
|
||||||
|
{
|
||||||
|
Gtk::TreePath path;
|
||||||
|
if (find_cur_path(path))
|
||||||
|
plist :: select_path(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool on_playlist_clicked(GdkEventButton *button)
|
||||||
|
{
|
||||||
|
if (button->button != 3)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_playlist_tab()
|
||||||
|
{
|
||||||
|
plist :: init();
|
||||||
|
p_tab = new PlaylistTab;
|
||||||
|
p_treeview = lib :: get_widget<Gtk::TreeView>("plist_treeview");
|
||||||
|
|
||||||
|
p_treeview->signal_cursor_changed().connect(sigc::ptr_fun(on_playlist_cursor_changed));
|
||||||
|
p_treeview->signal_button_press_event().connect(sigc::ptr_fun(on_playlist_clicked));
|
||||||
|
p_treeview->set_cursor(Gtk::TreePath("0"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Playlist tab stuff
|
||||||
|
*/
|
||||||
PlaylistTab :: PlaylistTab()
|
PlaylistTab :: PlaylistTab()
|
||||||
: Tab(playlist :: get_queue())
|
: Tab(playlist :: get_queue())
|
||||||
{
|
{
|
||||||
|
@ -42,55 +78,9 @@ bool PlaylistTab :: on_key_press_event(const std::string &key)
|
||||||
|
|
||||||
if (key != "Delete")
|
if (key != "Delete")
|
||||||
return Tab :: on_key_press_event(key);
|
return Tab :: on_key_press_event(key);
|
||||||
|
|
||||||
if (find_cur_path(path)) {
|
if (find_cur_path(path)) {
|
||||||
tab_selected_ids(ids);
|
tab_selected_ids(ids);
|
||||||
plist :: del_path_ids(path, ids);
|
plist :: del_path_ids(path, ids);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Playlist "sidebar" stuff
|
|
||||||
*/
|
|
||||||
|
|
||||||
static Gtk::TreeView *playlist_tv;
|
|
||||||
|
|
||||||
static bool find_cur_path(Gtk::TreePath &path)
|
|
||||||
{
|
|
||||||
Gtk::TreeViewColumn *col;
|
|
||||||
playlist_tv->get_cursor(path, col);
|
|
||||||
return !path.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void on_playlist_cursor_changed()
|
|
||||||
{
|
|
||||||
Gtk::TreePath path;
|
|
||||||
if (find_cur_path(path))
|
|
||||||
plist :: select_path(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool on_playlist_clicked(GdkEventButton *button)
|
|
||||||
{
|
|
||||||
if (button->button != 3)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static PlaylistTab *playlist_tab;
|
|
||||||
|
|
||||||
void init_playlist_tab()
|
|
||||||
{
|
|
||||||
plist :: init();
|
|
||||||
|
|
||||||
playlist_tab = new PlaylistTab;
|
|
||||||
playlist_tv = lib :: get_widget<Gtk::TreeView>("o_playlist_treeview");
|
|
||||||
|
|
||||||
playlist_tv->signal_cursor_changed().connect(sigc::ptr_fun(on_playlist_cursor_changed));
|
|
||||||
playlist_tv->signal_button_press_event().connect(sigc::ptr_fun(on_playlist_clicked));
|
|
||||||
playlist_tv->set_cursor(Gtk::TreePath("0"));
|
|
||||||
}
|
|
||||||
|
|
|
@ -816,7 +816,7 @@
|
||||||
<property name="margin_bottom">5</property>
|
<property name="margin_bottom">5</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="shadow_type">in</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTreeView" id="o_playlist_treeview">
|
<object class="GtkTreeView" id="plist_treeview">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="model">plist_list</property>
|
<property name="model">plist_list</property>
|
||||||
|
|
Loading…
Reference in New Issue