ocarina: Play songs when double clicking rows
I copied this function from playlist/treeview.cpp since it seemed to be working well. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
8583ac01d9
commit
b2e2404741
|
@ -28,10 +28,11 @@ string run_chooser(const string &);
|
|||
void init_window();
|
||||
|
||||
/* body/playlist.cpp */
|
||||
void init_playlist();
|
||||
void init_playlist2();
|
||||
|
||||
/* playlist.cpp */
|
||||
void update_playlist(notify_t, libsaria::PlaylistNotification *);
|
||||
void init_playlist();
|
||||
|
||||
/* status.cpp */
|
||||
bool update_idle_bar(int);
|
||||
|
|
|
@ -41,7 +41,7 @@ static GtkWidget *init_playlist_action()
|
|||
return box;
|
||||
}
|
||||
|
||||
void init_playlist()
|
||||
void init_playlist2()
|
||||
{
|
||||
tabs = get_widget("PlaylistTabs");
|
||||
gtk_notebook_set_action_widget(GTK_NOTEBOOK(tabs),
|
||||
|
|
|
@ -58,6 +58,19 @@ namespace ocarina
|
|||
|
||||
}; /* Namespace: ocarina */
|
||||
|
||||
static void track_selected(GtkWidget *treeview, GtkTreePath *path,
|
||||
GtkTreeViewColumn *col, gpointer data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
libsaria::Track *track;
|
||||
|
||||
model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
|
||||
gtk_tree_model_get_iter(model, &iter, path);
|
||||
gtk_tree_model_get(model, &iter, 0, &track, -1);
|
||||
track->load(true);
|
||||
}
|
||||
|
||||
static string formatted(string str)
|
||||
{
|
||||
char *escaped = g_markup_escape_text(str.c_str(), -1);
|
||||
|
@ -118,3 +131,9 @@ void update_playlist(notify_t event, libsaria::PlaylistNotification *data)
|
|||
else if (event == PLAYLIST_SIZE)
|
||||
set_playlist_size(data->plist);
|
||||
}
|
||||
|
||||
void init_playlist()
|
||||
{
|
||||
init_playlist2();
|
||||
connect_signal("LibraryPlistView", "row-activated", G_CALLBACK(track_selected), NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue