gui/collection: Update library paths when rows are clicked
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
2f9ee44000
commit
8dece02eed
|
@ -42,6 +42,21 @@ static struct library *__collection_get_library(GtkTreeIter *iter)
|
||||||
return library;
|
return library;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __collection_activated(GtkTreeView *treeview, GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column, gpointer data)
|
||||||
|
{
|
||||||
|
struct library *library = NULL;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (gtk_tree_model_get_iter(c_model, &iter, path))
|
||||||
|
library = __collection_get_library(&iter);
|
||||||
|
if (!library)
|
||||||
|
return;
|
||||||
|
|
||||||
|
collection_update(library);
|
||||||
|
gui_collection_idle_enable();
|
||||||
|
}
|
||||||
|
|
||||||
void __collection_add(GtkButton *button, GtkFileChooser *chooser)
|
void __collection_add(GtkButton *button, GtkFileChooser *chooser)
|
||||||
{
|
{
|
||||||
gchar *filename = gtk_file_chooser_get_filename(chooser);
|
gchar *filename = gtk_file_chooser_get_filename(chooser);
|
||||||
|
|
|
@ -16,6 +16,7 @@ void __sidebar_resize() {}
|
||||||
#endif /* TEST_NEED_SIDEBAR */
|
#endif /* TEST_NEED_SIDEBAR */
|
||||||
|
|
||||||
#ifdef TEST_NEED_COLLECTION
|
#ifdef TEST_NEED_COLLECTION
|
||||||
|
void __collection_activated() {}
|
||||||
void __collection_add() {}
|
void __collection_add() {}
|
||||||
void __collection_selection_changed() {}
|
void __collection_selection_changed() {}
|
||||||
#endif /* TEST_NEED_COLLECTION */
|
#endif /* TEST_NEED_COLLECTION */
|
||||||
|
|
|
@ -627,6 +627,7 @@
|
||||||
<property name="show_expanders">False</property>
|
<property name="show_expanders">False</property>
|
||||||
<property name="level_indentation">10</property>
|
<property name="level_indentation">10</property>
|
||||||
<property name="enable_tree_lines">True</property>
|
<property name="enable_tree_lines">True</property>
|
||||||
|
<signal name="row-activated" handler="__collection_activated" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection" id="treeview-selection2">
|
<object class="GtkTreeSelection" id="treeview-selection2">
|
||||||
<signal name="changed" handler="__collection_selection_changed" object="colmgr_chooser" swapped="no"/>
|
<signal name="changed" handler="__collection_selection_changed" object="colmgr_chooser" swapped="no"/>
|
||||||
|
|
|
@ -87,6 +87,17 @@ static void test_collection_sidebar()
|
||||||
gtk_tree_model_get(model, &child, 5, &library, -1);
|
gtk_tree_model_get(model, &child, 5, &library, -1);
|
||||||
test_equal((void *)library, (void *)library_get(0));
|
test_equal((void *)library, (void *)library_get(0));
|
||||||
|
|
||||||
|
path = gtk_tree_model_get_path(model, &child);
|
||||||
|
gtk_tree_view_row_activated(treeview, path, NULL);
|
||||||
|
gtk_tree_path_free(path);
|
||||||
|
|
||||||
|
/* Again, run two idle events to update the selected path. */
|
||||||
|
test_equal(gtk_widget_is_visible(GTK_WIDGET(progress)), true);
|
||||||
|
g_main_loop_run(main_loop);
|
||||||
|
test_equal((float)gtk_progress_bar_get_fraction(progress), (float)0.5);
|
||||||
|
g_main_loop_run(main_loop);
|
||||||
|
test_equal(gtk_widget_is_visible(GTK_WIDGET(progress)), false);
|
||||||
|
|
||||||
gui_builder_deinit();
|
gui_builder_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user