ocarina: Remove old songlist code
I've been wanting to do this for a long time. I don't think I need it anymore, so it can all be safely removed. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
45c839c04a
commit
3b705515c2
|
@ -1,18 +0,0 @@
|
|||
#ifndef OCARINA_QUEUE_H
|
||||
#define OCARINA_QUEUE_H
|
||||
|
||||
#include <libsaria/playlist.h>
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
namespace queue
|
||||
{
|
||||
|
||||
void init();
|
||||
void refresh();
|
||||
void new_playlist(libsaria::Playlist *);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* OCARINA_QUEUE_H */
|
|
@ -1,69 +0,0 @@
|
|||
#ifndef OCARINA_SONGLIST_H
|
||||
#define OCARINA_SONGLIST_H
|
||||
|
||||
#include <ocarina/ocarina.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/playlist.h>
|
||||
#include <libsaria/renderer.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
class MenuItem
|
||||
{
|
||||
private:
|
||||
string text;
|
||||
void (*func)(GtkMenuItem *, gpointer);
|
||||
|
||||
public:
|
||||
MenuItem(string, void (*)(GtkMenuItem *, gpointer));
|
||||
~MenuItem();
|
||||
|
||||
GtkWidget *get_widget();
|
||||
};
|
||||
|
||||
class SongList : public libsaria::PlaylistRenderer
|
||||
{
|
||||
private:
|
||||
list <MenuItem> *menu_items;
|
||||
string name;
|
||||
|
||||
GtkWidget *window;
|
||||
GtkWidget *label;
|
||||
GtkWidget *page;
|
||||
|
||||
GtkWidget *treeview;
|
||||
GtkListStore *liststore;
|
||||
GtkTreeModel *filter;
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *textcell;
|
||||
|
||||
void set_label_text();
|
||||
void freeze();
|
||||
void thaw();
|
||||
|
||||
void list_selected_indices(list<int> &);
|
||||
void on_playlist_empty();
|
||||
|
||||
public:
|
||||
SongList();
|
||||
SongList(libsaria::Playlist *);
|
||||
~SongList();
|
||||
|
||||
GtkWidget *init(string, list<MenuItem> *, bool);
|
||||
|
||||
void insert(libsaria::Track *, unsigned int);
|
||||
void fill();
|
||||
void clear();
|
||||
void refilter();
|
||||
//void list_selected_ids(list<sid_t> &);
|
||||
void rm_selected_indices();
|
||||
void index_removed(int);
|
||||
//void scroll_to(sid_t);
|
||||
//sid_t current_id();
|
||||
|
||||
gint right_click(guint, guint64);
|
||||
};
|
||||
|
||||
#endif /* OCARINA_SONGLIST_H */
|
|
@ -1,70 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <ocarina/playlist.h>
|
||||
#include <libsaria/library.h>
|
||||
|
||||
/*#include <ocarina/library.h>
|
||||
#include <ocarina/body.h>
|
||||
#include <ocarina/ocarina.h>
|
||||
#include <ocarina/songlist.h>
|
||||
#include <ocarina/shortcut.h>
|
||||
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/track.h>
|
||||
#include <libsaria/stack.h>
|
||||
#include <libsaria/print.h>
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
static SongList library_list;
|
||||
static list <MenuItem> library_menu;
|
||||
static GtkWidget *library_page = NULL;
|
||||
|
||||
static void add_to_queue()
|
||||
{
|
||||
list<sid_t> selected;
|
||||
library_list.list_selected_ids(selected);
|
||||
libsaria::add_to_playlist(selected);
|
||||
}
|
||||
|
||||
static void add_to_queue_event(GtkMenuItem *menu, gpointer data)
|
||||
{
|
||||
add_to_queue();
|
||||
}
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
void library::refilter()
|
||||
{
|
||||
sid_t cur = library_list.current_id();
|
||||
library_list.refilter();
|
||||
library_list.scroll_to(cur);
|
||||
}
|
||||
|
||||
void library::refresh()
|
||||
{
|
||||
sid_t cur = library_list.current_id();
|
||||
library_list.clear();
|
||||
library_list.fill();
|
||||
library_list.scroll_to(cur);
|
||||
}
|
||||
|
||||
void library::init()
|
||||
{
|
||||
library_menu.push_back(MenuItem("Add to Queue", add_to_queue_event));
|
||||
|
||||
register_shortcut("q", add_to_queue);
|
||||
|
||||
//library_list.set_playlist(libsaria::library::get_playlist(), false);
|
||||
library_page = library_list.init("Library", &library_menu, true);
|
||||
set_current_page(library_page);
|
||||
ocarina::library::refresh();
|
||||
}
|
||||
|
||||
void library::scroll_to(libsaria::Track *track)
|
||||
{
|
||||
//library_list.scroll_to(track->get_songid());
|
||||
}
|
||||
|
||||
};*/
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <ocarina/queue.h>
|
||||
#include <ocarina/body.h>
|
||||
#include <ocarina/ocarina.h>
|
||||
#include <ocarina/songlist.h>
|
||||
#include <ocarina/shortcut.h>
|
||||
#include <libsaria/deck.h>
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
static SongList *queue_list;
|
||||
static list <MenuItem> queue_menu;
|
||||
GtkWidget *queue_page;
|
||||
|
||||
static void rm_from_queue()
|
||||
{
|
||||
queue_list->rm_selected_indices();
|
||||
//libsaria::stack_top_pop();
|
||||
}
|
||||
|
||||
static void rm_from_queue_event(GtkMenuItem *menu, gpointer data)
|
||||
{
|
||||
rm_from_queue();
|
||||
}
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
void queue::new_playlist(libsaria::Playlist *plist)
|
||||
{
|
||||
/*queue_list = new SongList();
|
||||
queue_list->set_playlist(plist, true);
|
||||
queue_list->init("Queue", &queue_menu, false);
|
||||
queue_list->fill();*/
|
||||
}
|
||||
|
||||
void queue::init()
|
||||
{
|
||||
queue_menu.push_back(MenuItem("Remove from Queue", rm_from_queue_event));
|
||||
register_shortcut("Delete", rm_from_queue);
|
||||
}
|
||||
|
||||
};
|
|
@ -1,53 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <ocarina/songlist.h>
|
||||
|
||||
/*
|
||||
string formatted(string str)
|
||||
{
|
||||
char *escaped = g_markup_escape_text(str.c_str(), -1);
|
||||
string ret = escaped;
|
||||
g_free(escaped);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
void SongList::freeze()
|
||||
{
|
||||
gtk_widget_freeze_child_notify(treeview);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), NULL);
|
||||
}
|
||||
|
||||
void SongList::thaw()
|
||||
{
|
||||
gtk_widget_thaw_child_notify(treeview);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), filter);
|
||||
}
|
||||
|
||||
void SongList::clear()
|
||||
{
|
||||
freeze();
|
||||
gtk_list_store_clear(liststore);
|
||||
thaw();
|
||||
}
|
||||
|
||||
void SongList::insert(libsaria::Track *track, unsigned int index)
|
||||
{
|
||||
/*gtk_list_store_insert_with_values(liststore, NULL, index,
|
||||
0, track->get_songid(),
|
||||
1, track->get_track(),
|
||||
2, track->get_title().c_str(),
|
||||
3, track->get_lenstr().c_str(),
|
||||
4, track->get_artist().c_str(),
|
||||
5, track->get_album().c_str(),
|
||||
6, track->get_year(),
|
||||
7, formatted(track->get_filepath()).c_str(),
|
||||
-1);
|
||||
set_label_text();*/
|
||||
}
|
||||
|
||||
void SongList::fill()
|
||||
{
|
||||
freeze();
|
||||
//PlaylistRenderer::fill();
|
||||
thaw();
|
||||
set_label_text();
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <libsaria/index.h>
|
||||
#include <ocarina/songlist.h>
|
||||
|
||||
gboolean songlist_filter_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
/*sid_t inode;
|
||||
gtk_tree_model_get(model, iter, 0, &inode, -1);
|
||||
return libsaria::index::is_visible(inode);*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SongList::refilter()
|
||||
{
|
||||
freeze();
|
||||
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(filter));
|
||||
thaw();
|
||||
set_label_text();
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <ocarina/songlist.h>
|
||||
#include <ocarina/body.h>
|
||||
#include "songlist.h"
|
||||
|
||||
SongList::SongList():libsaria::PlaylistRenderer(0) {}
|
||||
SongList::~SongList() {}
|
||||
|
||||
struct column_info {
|
||||
const char *name;
|
||||
int width;
|
||||
bool visible;
|
||||
GType type;
|
||||
|
||||
column_info(const char *n, GType t, int w, bool v)
|
||||
{
|
||||
name = n;
|
||||
width = w;
|
||||
visible = v;
|
||||
type = t;
|
||||
}
|
||||
};
|
||||
|
||||
static struct column_info columns[] = {
|
||||
column_info( "Id", G_TYPE_LONG, 2, false),
|
||||
column_info( "#", G_TYPE_INT, 20, true),
|
||||
column_info( "Title", G_TYPE_STRING, 300, true),
|
||||
column_info( "Length", G_TYPE_STRING, 60, true),
|
||||
column_info( "Artist", G_TYPE_STRING, 125, true),
|
||||
column_info( "Album", G_TYPE_STRING, 125, true),
|
||||
column_info( "Year", G_TYPE_INT, 50, true),
|
||||
column_info("Filepath", G_TYPE_STRING, 2, false),
|
||||
};
|
||||
|
||||
#define NUM_COLUMNS (sizeof(columns) / sizeof(column_info))
|
||||
|
||||
static GtkWidget *setup_label(string text)
|
||||
{
|
||||
GtkWidget *label = gtk_label_new(text.c_str());
|
||||
gtk_label_set_angle(GTK_LABEL(label), 90);
|
||||
return label;
|
||||
}
|
||||
|
||||
static GtkCellRenderer *setup_renderer()
|
||||
{
|
||||
GtkCellRenderer *textcell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_renderer_text_set_fixed_height_from_font(GTK_CELL_RENDERER_TEXT(textcell), 1);
|
||||
return textcell;
|
||||
}
|
||||
|
||||
static GtkListStore *setup_liststore()
|
||||
{
|
||||
GType types[NUM_COLUMNS];
|
||||
|
||||
for (unsigned int i = 0; i < NUM_COLUMNS; i++)
|
||||
types[i] = columns[i].type;
|
||||
|
||||
return gtk_list_store_newv(NUM_COLUMNS, types);
|
||||
}
|
||||
|
||||
static GtkTreeModel *setup_filter(GtkListStore *liststore)
|
||||
{
|
||||
GtkTreeModel *filter;
|
||||
filter = gtk_tree_model_filter_new(GTK_TREE_MODEL(liststore), NULL);
|
||||
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(filter),
|
||||
songlist_filter_func, NULL, NULL);
|
||||
return filter;
|
||||
}
|
||||
|
||||
static GtkWidget *setup_treeview(GtkTreeModel *model, SongList *list)
|
||||
{
|
||||
GtkWidget *treeview = gtk_tree_view_new();
|
||||
|
||||
GTK_CONNECT(treeview, "row-activated", songlist_row_activated, NULL);
|
||||
GTK_CONNECT(treeview, "button-release-event", songlist_button_click, list);
|
||||
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), model);
|
||||
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(treeview), 7);
|
||||
return treeview;
|
||||
}
|
||||
|
||||
static GtkTreeSelection *setup_selection(GtkWidget *treeview)
|
||||
{
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
||||
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
||||
return selection;
|
||||
}
|
||||
|
||||
static GtkWidget *setup_window(GtkWidget *treeview)
|
||||
{
|
||||
GtkWidget *window = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
container_add(window, treeview);
|
||||
return window;
|
||||
}
|
||||
|
||||
static void add_column(GtkCellRenderer *textcell, GtkWidget *treeview, int index)
|
||||
{
|
||||
GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
|
||||
columns[index].name, textcell,
|
||||
"text", index, NULL);
|
||||
gtk_tree_view_column_set_resizable(column, TRUE);
|
||||
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_min_width(column, 2);
|
||||
gtk_tree_view_column_set_max_width(column, 700);
|
||||
gtk_tree_view_column_set_fixed_width(column, columns[index].width);
|
||||
gtk_tree_view_column_set_visible(column, columns[index].visible);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
|
||||
}
|
||||
|
||||
static void setup_columns(GtkCellRenderer *textcell, GtkWidget *treeview)
|
||||
{
|
||||
for (unsigned int i = 0; i < NUM_COLUMNS; i++)
|
||||
add_column(textcell, treeview, i);
|
||||
}
|
||||
|
||||
/*
|
||||
* I need an init() function to set up the scrolled window AFTER
|
||||
* the gtk_init() function has been called. This allows the songlst
|
||||
* to be used as a static global variable in other files.
|
||||
*/
|
||||
GtkWidget *SongList::init(string text, list <MenuItem> *menu, bool enable_filter)
|
||||
{
|
||||
/* Initialize helper variables */
|
||||
name = text;
|
||||
menu_items = menu;
|
||||
|
||||
/* Set up the gtk widgets */
|
||||
label = setup_label(name);
|
||||
textcell = setup_renderer();
|
||||
liststore = setup_liststore();
|
||||
if (enable_filter == true)
|
||||
filter = setup_filter(liststore);
|
||||
else
|
||||
filter = GTK_TREE_MODEL(liststore);
|
||||
treeview = setup_treeview(filter, this);
|
||||
selection = setup_selection(treeview);
|
||||
window = setup_window(treeview);
|
||||
setup_columns(textcell, treeview);
|
||||
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show_all(window);
|
||||
|
||||
//page = make_page(window);
|
||||
//push_page(page, label, true);
|
||||
return page;
|
||||
}
|
||||
|
||||
void SongList::on_playlist_empty()
|
||||
{
|
||||
/*if (page)
|
||||
remove_page(page);*/
|
||||
page = NULL;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <ocarina/songlist.h>
|
||||
#include <libsaria/print.h>
|
||||
#include "songlist.h"
|
||||
|
||||
#define BUTTON_RIGHT 3
|
||||
|
||||
MenuItem::MenuItem(string s, void (*f)(GtkMenuItem *, gpointer))
|
||||
{
|
||||
text = s;
|
||||
func = f;
|
||||
}
|
||||
|
||||
MenuItem::~MenuItem() {}
|
||||
|
||||
GtkWidget *MenuItem::get_widget()
|
||||
{
|
||||
GtkWidget *widget = gtk_menu_item_new_with_label(text.c_str());
|
||||
GTK_CONNECT(widget, "activate", func, NULL);
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void toggle_pause_after(GtkMenuItem *menu, gpointer data)
|
||||
{
|
||||
//libsaria::set_pause_after(!libsaria::get_pause_after());
|
||||
}
|
||||
|
||||
static GtkWidget *make_pause_after_item()
|
||||
{
|
||||
GtkWidget *widget = gtk_check_menu_item_new_with_label("Pause After Current Song");
|
||||
/*gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget),
|
||||
libsaria::get_pause_after());*/
|
||||
GTK_CONNECT(widget, "activate", toggle_pause_after, NULL);
|
||||
return widget;
|
||||
}
|
||||
|
||||
gint SongList::right_click(guint button, guint64 time)
|
||||
{
|
||||
list<MenuItem>::iterator it;
|
||||
GtkWidget *menu = gtk_menu_new();
|
||||
|
||||
for (it = menu_items->begin(); it != menu_items->end(); it++)
|
||||
gtk_menu_append(GTK_MENU(menu), it->get_widget());
|
||||
|
||||
gtk_menu_append(GTK_MENU(menu), make_pause_after_item());
|
||||
|
||||
gtk_widget_show_all(menu);
|
||||
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void songlist_button_click(GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
{
|
||||
SongList *list = (SongList *)data;
|
||||
|
||||
if (event->button.button != BUTTON_RIGHT)
|
||||
return;
|
||||
list->right_click(event->button.button, event->button.time);
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
#include <ocarina/ocarina.h>
|
||||
#include <ocarina/songlist.h>
|
||||
#include <libsaria/print.h>
|
||||
#include "songlist.h"
|
||||
|
||||
/*void songlist_selected_inode(GtkTreeView *treeview, GtkTreePath *path, sid_t &inode)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
|
||||
|
||||
gtk_tree_model_get_iter(model, &iter, path);
|
||||
gtk_tree_model_get(model, &iter, 0, &inode, -1);
|
||||
}
|
||||
|
||||
sid_t songlist_current_id(GtkTreeView *treeview, GtkTreePath *path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
sid_t songid;
|
||||
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(treeview);
|
||||
gtk_tree_model_get_iter(model, &iter, path);
|
||||
gtk_tree_model_get(model, &iter, 0, &songid, -1);
|
||||
|
||||
return songid;
|
||||
}*/
|
||||
|
||||
void songlist_row_activated(GtkTreeView *treeview, GtkTreePath *path,
|
||||
GtkTreeViewColumn *column, gpointer data)
|
||||
{
|
||||
/* sid_t songid = songlist_current_id(treeview, path);
|
||||
println("Double click! %lu", songid);
|
||||
libsaria::play_id(songid);*/
|
||||
}
|
||||
|
||||
/*static void selected_foreach_func(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
list<sid_t> *res = (list<sid_t> *) data;
|
||||
sid_t inode;
|
||||
gtk_tree_model_get(model, iter, 0, &inode, -1);
|
||||
res->push_back(inode);
|
||||
}*/
|
||||
|
||||
static void selected_foreach_func2(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
list<int> *res = (list<int> *) data;
|
||||
int *index = gtk_tree_path_get_indices(path);
|
||||
res->push_back(*index);
|
||||
println("Found index: %d", *index);
|
||||
}
|
||||
|
||||
/*void SongList::list_selected_ids(list<sid_t> &res)
|
||||
{
|
||||
gtk_tree_selection_selected_foreach(selection, selected_foreach_func, &res);
|
||||
}*/
|
||||
|
||||
void SongList::list_selected_indices(list<int> &res)
|
||||
{
|
||||
gtk_tree_selection_selected_foreach(selection, selected_foreach_func2, &res);
|
||||
}
|
||||
|
||||
void SongList::rm_selected_indices()
|
||||
{
|
||||
list<int> selected;
|
||||
list<int>::iterator it;
|
||||
|
||||
list_selected_indices(selected);
|
||||
//get_playlist()->rm_indices(selected);
|
||||
}
|
||||
|
||||
void SongList::index_removed(int index)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(liststore), &iter, NULL, index);
|
||||
gtk_list_store_remove(liststore, &iter);
|
||||
set_label_text();
|
||||
}
|
||||
|
||||
void SongList::set_label_text()
|
||||
{
|
||||
string res;
|
||||
stringstream stream;
|
||||
|
||||
stream << name << " (";
|
||||
//stream << get_playlist()->apparent_size() << ")";
|
||||
res = stream.str();
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(label), res.c_str());
|
||||
}
|
||||
|
||||
struct scroll_data {
|
||||
// sid_t songid;
|
||||
GtkWidget *treeview;
|
||||
GdkRectangle rect;
|
||||
};
|
||||
|
||||
/*static int scroll_to_check_row(GtkTreeModel *model, GtkTreePath *path,
|
||||
GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
struct scroll_data *scroll = (struct scroll_data *)data;
|
||||
sid_t current;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkTreePath *target;
|
||||
GdkRectangle area;
|
||||
int n;
|
||||
|
||||
gtk_tree_model_get(model, iter, 0, ¤t, -1);
|
||||
if (current != scroll->songid)
|
||||
return FALSE;
|
||||
|
||||
col = gtk_tree_view_get_column(GTK_TREE_VIEW(scroll->treeview), 0);
|
||||
gtk_tree_view_get_cell_area(GTK_TREE_VIEW(scroll->treeview), path, col, &area);
|
||||
target = gtk_tree_path_copy(path);
|
||||
if (area.height > 0) {
|
||||
n = scroll->rect.height / area.height;
|
||||
for (int i = 0; i < (n / 2); i++)
|
||||
gtk_tree_path_prev(target);
|
||||
}
|
||||
|
||||
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(scroll->treeview),
|
||||
target, NULL, TRUE, 0, 0);
|
||||
gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(scroll->treeview),
|
||||
path, NULL, NULL, FALSE);
|
||||
gtk_tree_path_free(target);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SongList::scroll_to(sid_t songid)
|
||||
{
|
||||
struct scroll_data data;
|
||||
data.songid = songid;
|
||||
data.treeview = treeview;
|
||||
|
||||
if (songid == 0)
|
||||
return;
|
||||
|
||||
gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(treeview), &data.rect);*/
|
||||
/* Widget not realized yet */
|
||||
/* if (data.rect.height == 0)
|
||||
return;
|
||||
|
||||
gtk_tree_model_foreach(filter, scroll_to_check_row, &data);
|
||||
}
|
||||
|
||||
sid_t SongList::current_id()
|
||||
{
|
||||
sid_t songid = 0;
|
||||
GtkTreePath *path;
|
||||
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
|
||||
GList *selected = gtk_tree_selection_get_selected_rows(selection, &model);
|
||||
GList *first = g_list_first(selected);
|
||||
|
||||
if (first != NULL) {
|
||||
path = (GtkTreePath *)first->data;
|
||||
songid = songlist_current_id(GTK_TREE_VIEW(treeview), path);
|
||||
}
|
||||
|
||||
g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL);
|
||||
g_list_free(selected);
|
||||
|
||||
return songid;
|
||||
}*/
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef OCARINA_SONGLIST_PRIVATE_H
|
||||
#define OCARINA_SONGLIST_PRIVATE_H
|
||||
|
||||
#include <ocarina/ocarina.h>
|
||||
|
||||
void songlist_row_activated(GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, gpointer);
|
||||
void songlist_button_click(GtkWidget *, GdkEvent *, gpointer);
|
||||
gboolean songlist_filter_func(GtkTreeModel *, GtkTreeIter *, gpointer);
|
||||
|
||||
#endif /* OCARINA_SONGLIST_PRIVATE_H */
|
Loading…
Reference in New Issue