ocarina: Scroll to a songid instead of a Track
I want to store the currently selected row and go back there after a refresh or a filter. This allows me to find the current songid and scroll back to it later. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
bc0be6d831
commit
362a0697c9
|
@ -65,7 +65,7 @@ class SongList : public libsaria::SourceModel
|
|||
void clear();
|
||||
void refilter();
|
||||
void list_selected_ids(list<sid_t> &);
|
||||
void scroll_to(libsaria::Track *);
|
||||
void scroll_to(sid_t);
|
||||
|
||||
gint right_click(guint, guint64);
|
||||
};
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace ocarina
|
|||
|
||||
void library::scroll_to(libsaria::Track *track)
|
||||
{
|
||||
library_list.scroll_to(track);
|
||||
library_list.scroll_to(track->get_songid());
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -67,7 +67,7 @@ void SongList::set_label_text()
|
|||
}
|
||||
|
||||
struct scroll_data {
|
||||
sid_t inode;
|
||||
sid_t songid;
|
||||
GtkWidget *treeview;
|
||||
GdkRectangle rect;
|
||||
};
|
||||
|
@ -83,7 +83,7 @@ static int scroll_to_check_row(GtkTreeModel *model, GtkTreePath *path,
|
|||
int n;
|
||||
|
||||
gtk_tree_model_get(model, iter, 0, ¤t, -1);
|
||||
if (current != scroll->inode)
|
||||
if (current != scroll->songid)
|
||||
return FALSE;
|
||||
|
||||
col = gtk_tree_view_get_column(GTK_TREE_VIEW(scroll->treeview), 0);
|
||||
|
@ -103,10 +103,10 @@ static int scroll_to_check_row(GtkTreeModel *model, GtkTreePath *path,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void SongList::scroll_to(libsaria::Track *track)
|
||||
void SongList::scroll_to(sid_t songid)
|
||||
{
|
||||
struct scroll_data data;
|
||||
data.inode = track->get_songid();
|
||||
data.songid = songid;
|
||||
data.treeview = treeview;
|
||||
|
||||
gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(treeview), &data.rect);
|
||||
|
|
Loading…
Reference in New Issue