gui/sidebar: Select first enabled queue during startup
Otherwise the list of tracks is left blank, which the user might not be expecting. Fixes #55: Collection should be selected by default Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
df93ad06df
commit
1ad112e217
|
@ -1,5 +1,7 @@
|
||||||
6.4.13:
|
6.4.13:
|
||||||
- Enable GtkTreeView fixed-height mode
|
- Enable GtkTreeView fixed-height mode
|
||||||
|
- Fix bug where temporary queues don't save
|
||||||
|
- Fix bug where a queue is not selected on startup
|
||||||
|
|
||||||
6.4.13-rc:
|
6.4.13-rc:
|
||||||
- Rewrite GtkTreeView code
|
- Rewrite GtkTreeView code
|
||||||
|
|
|
@ -72,6 +72,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
g_free(ui);
|
g_free(ui);
|
||||||
g_free(icon);
|
g_free(icon);
|
||||||
|
gui_sidebar_select_first();
|
||||||
|
|
||||||
g_signal_connect(G_APPLICATION(ocarina), "activate", (GCallback)__ocarina_activate, NULL);
|
g_signal_connect(G_APPLICATION(ocarina), "activate", (GCallback)__ocarina_activate, NULL);
|
||||||
g_signal_connect(G_APPLICATION(ocarina), "shutdown", (GCallback)__ocarina_shutdown, NULL);
|
g_signal_connect(G_APPLICATION(ocarina), "shutdown", (GCallback)__ocarina_shutdown, NULL);
|
||||||
|
|
|
@ -138,6 +138,26 @@ void gui_sidebar_init()
|
||||||
gtk_paned_set_position(pane, pos);
|
gtk_paned_set_position(pane, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_sidebar_select_first()
|
||||||
|
{
|
||||||
|
GtkTreeView *treeview = GTK_TREE_VIEW(gui_builder_widget("o_sidebar_view"));
|
||||||
|
GtkTreeSelection *selection = gtk_tree_view_get_selection(treeview);
|
||||||
|
struct gui_queue *gq;
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(sb_store), &iter);
|
||||||
|
|
||||||
|
do {
|
||||||
|
gq = __sidebar_get_queue(&iter);
|
||||||
|
} while (!queue_has_flag(gq->gq_queue, Q_ENABLED) &&
|
||||||
|
gtk_tree_model_iter_next(GTK_TREE_MODEL(sb_store), &iter));
|
||||||
|
|
||||||
|
path = gtk_tree_model_get_path(GTK_TREE_MODEL(sb_store), &iter);
|
||||||
|
gtk_tree_selection_select_path(selection, path);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
}
|
||||||
|
|
||||||
gboolean gui_sidebar_on_select(GtkTreeSelection *selection,
|
gboolean gui_sidebar_on_select(GtkTreeSelection *selection,
|
||||||
GtkTreeModel *model, GtkTreePath *path,
|
GtkTreeModel *model, GtkTreePath *path,
|
||||||
gboolean selected, gpointer data)
|
gboolean selected, gpointer data)
|
||||||
|
|
|
@ -16,6 +16,9 @@ enum sidebar_selection_t {
|
||||||
/* Called to initialize the sidebar. */
|
/* Called to initialize the sidebar. */
|
||||||
void gui_sidebar_init();
|
void gui_sidebar_init();
|
||||||
|
|
||||||
|
/* Called to select the first item in the sidebar. */
|
||||||
|
void gui_sidebar_select_first();
|
||||||
|
|
||||||
/* Called when a row in the sidebar is selected. */
|
/* Called when a row in the sidebar is selected. */
|
||||||
gboolean gui_sidebar_on_select(GtkTreeSelection *, GtkTreeModel *,
|
gboolean gui_sidebar_on_select(GtkTreeSelection *, GtkTreeModel *,
|
||||||
GtkTreePath *path, gboolean, gpointer);
|
GtkTreePath *path, gboolean, gpointer);
|
||||||
|
|
Loading…
Reference in New Issue