gui/collection: Toggle library state through the gui

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-01-01 11:31:10 -05:00
parent 8dece02eed
commit 0afe46b5df
3 changed files with 19 additions and 1 deletions

View File

@ -57,6 +57,21 @@ void __collection_activated(GtkTreeView *treeview, GtkTreePath *path,
gui_collection_idle_enable();
}
void __collection_toggled(GtkCellRendererToggle *toggle, gchar *path,
gpointer data)
{
struct library *library = NULL;
GtkTreeIter iter;
if (gtk_tree_model_get_iter_from_string(c_model, &iter, path))
library = __collection_get_library(&iter);
if (!library)
return;
collection_set_enabled(library, !library->li_enabled);
__collection_set_library(&iter, library);
}
void __collection_add(GtkButton *button, GtkFileChooser *chooser)
{
gchar *filename = gtk_file_chooser_get_filename(chooser);

View File

@ -19,6 +19,7 @@ void __sidebar_resize() {}
void __collection_activated() {}
void __collection_add() {}
void __collection_selection_changed() {}
void __collection_toggled() {}
#endif /* TEST_NEED_COLLECTION */
#endif /* TESTS_GUI_H */

View File

@ -649,7 +649,9 @@
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="title" translatable="yes">Enabled</property>
<child>
<object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
<object class="GtkCellRendererToggle" id="cellrenderertoggle1">
<signal name="toggled" handler="__collection_toggled" swapped="no"/>
</object>
<attributes>
<attribute name="visible">3</attribute>
<attribute name="active">2</attribute>