summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-05-30 22:42:18 +0200
committerGravatar waker <wakeroid@gmail.com>2012-05-30 22:42:48 +0200
commitadb3be459d614e1eba3e88a67cf1b3ec276e0960 (patch)
tree5e417e440f0cd80b09b2bc5891708c27677a576c
parent98a2f36916af7039f73f7ad071ad3daac0d2e414 (diff)
converter: fixed dsp plugin selection on init
-rw-r--r--plugins/converter/convgui.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c
index 670fa8eb..712c6f24 100644
--- a/plugins/converter/convgui.c
+++ b/plugins/converter/convgui.c
@@ -869,6 +869,21 @@ fill_dsp_preset_chain (GtkListStore *mdl) {
}
}
+static int
+listview_get_index (GtkWidget *list) {
+ GtkTreePath *path;
+ GtkTreeViewColumn *col;
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (list), &path, &col);
+ if (!path) {
+ // nothing selected
+ return -1;
+ }
+ int *indices = gtk_tree_path_get_indices (path);
+ int idx = *indices;
+ g_free (indices);
+ return idx;
+}
+
void
on_dsp_preset_add_plugin_clicked (GtkButton *button,
gpointer user_data)
@@ -914,8 +929,12 @@ on_dsp_preset_add_plugin_clicked (GtkButton *button,
// reinit list of instances
GtkWidget *list = lookup_widget (toplevel, "plugins");
GtkListStore *mdl = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW(list)));
+ int idx = listview_get_index (list);
gtk_list_store_clear (mdl);
fill_dsp_preset_chain (mdl);
+ GtkTreePath *path = gtk_tree_path_new_from_indices (idx, -1);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (list), path, NULL, FALSE);
+ gtk_tree_path_free (path);
}
else {
fprintf (stderr, "converter: failed to add DSP plugin to chain\n");
@@ -988,16 +1007,7 @@ on_dsp_preset_plugin_configure_clicked (GtkButton *button,
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
GtkWidget *list = lookup_widget (toplevel, "plugins");
- GtkTreePath *path;
- GtkTreeViewColumn *col;
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (list), &path, &col);
- if (!path || !col) {
- // nothing selected
- return;
- }
- int *indices = gtk_tree_path_get_indices (path);
- int idx = *indices;
- g_free (indices);
+ int idx = listview_get_index (list);
if (idx == -1) {
return;
}
@@ -1021,21 +1031,6 @@ on_dsp_preset_plugin_configure_clicked (GtkButton *button,
}
static int
-listview_get_index (GtkWidget *list) {
- GtkTreePath *path;
- GtkTreeViewColumn *col;
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (list), &path, &col);
- if (!path || !col) {
- // nothing selected
- return - 1;
- }
- int *indices = gtk_tree_path_get_indices (path);
- int idx = *indices;
- g_free (indices);
- return idx;
-}
-
-static int
swap_items (GtkWidget *list, int idx) {
ddb_dsp_context_t *prev = NULL;
ddb_dsp_context_t *p = current_ctx->current_dsp_preset->chain;
@@ -1139,6 +1134,9 @@ edit_dsp_preset (const char *title, GtkWidget *toplevel, int overwrite) {
gtk_tree_view_set_model (GTK_TREE_VIEW (list), GTK_TREE_MODEL (mdl));
fill_dsp_preset_chain (mdl);
+ GtkTreePath *path = gtk_tree_path_new_from_indices (0, -1);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (list), path, NULL, FALSE);
+ gtk_tree_path_free (path);
}
for (;;) {