Mercurial > audlegacy
comparison src/audacious/ui_preferences.c @ 3439:93584d1b3e7e trunk
Add plugin pointer to the plugin treestore.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 07 Sep 2007 07:09:35 -0500 |
parents | 3092a8b3fe34 |
children | bd1a68dc9ebb |
comparison
equal
deleted
inserted
replaced
3438:7043b5c94a94 | 3439:93584d1b3e7e |
---|---|
75 enum PluginViewCols { | 75 enum PluginViewCols { |
76 PLUGIN_VIEW_COL_ACTIVE, | 76 PLUGIN_VIEW_COL_ACTIVE, |
77 PLUGIN_VIEW_COL_DESC, | 77 PLUGIN_VIEW_COL_DESC, |
78 PLUGIN_VIEW_COL_FILENAME, | 78 PLUGIN_VIEW_COL_FILENAME, |
79 PLUGIN_VIEW_COL_ID, | 79 PLUGIN_VIEW_COL_ID, |
80 PLUGIN_VIEW_COL_PLUGIN_PTR, | |
80 PLUGIN_VIEW_N_COLS | 81 PLUGIN_VIEW_N_COLS |
81 }; | 82 }; |
82 | 83 |
83 enum PluginViewType { | 84 enum PluginViewType { |
84 PLUGIN_VIEW_TYPE_INPUT, | 85 PLUGIN_VIEW_TYPE_INPUT, |
212 { | 213 { |
213 GtkTreeModel *model = GTK_TREE_MODEL(data); | 214 GtkTreeModel *model = GTK_TREE_MODEL(data); |
214 GtkTreeIter iter; | 215 GtkTreeIter iter; |
215 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); | 216 GtkTreePath *path = gtk_tree_path_new_from_string(path_str); |
216 gint pluginnr; | 217 gint pluginnr; |
217 gchar *filename, *basename; | |
218 Plugin *plugin; | 218 Plugin *plugin; |
219 /*GList *diplist, *tmplist; */ | 219 /*GList *diplist, *tmplist; */ |
220 | 220 |
221 /* get toggled iter */ | 221 /* get toggled iter */ |
222 gtk_tree_model_get_iter(model, &iter, path); | 222 gtk_tree_model_get_iter(model, &iter, path); |
223 gtk_tree_model_get(model, &iter, | 223 gtk_tree_model_get(model, &iter, |
224 PLUGIN_VIEW_COL_ID, &pluginnr, | 224 PLUGIN_VIEW_COL_ID, &pluginnr, |
225 PLUGIN_VIEW_COL_FILENAME, &filename, | 225 PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, |
226 -1); | 226 -1); |
227 | |
228 basename = g_path_get_basename(filename); | |
229 g_free(filename); | |
230 | |
231 /* get our plugin */ | |
232 plugin = plugin_get_plugin(basename); | |
233 | 227 |
234 /* do something with the value */ | 228 /* do something with the value */ |
235 plugin->enabled ^= 1; | 229 plugin->enabled ^= 1; |
236 | 230 |
237 /* set new value */ | 231 /* set new value */ |
238 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | 232 gtk_list_store_set(GTK_LIST_STORE(model), &iter, |
239 PLUGIN_VIEW_COL_ACTIVE, plugin->enabled, -1); | 233 PLUGIN_VIEW_COL_ACTIVE, plugin->enabled, -1); |
240 | 234 |
241 /* clean up */ | 235 /* clean up */ |
242 gtk_tree_path_free(path); | 236 gtk_tree_path_free(path); |
243 g_free(basename); | |
244 } | 237 } |
245 | 238 |
246 | 239 |
247 static void | 240 static void |
248 vis_plugin_toggle(GtkCellRendererToggle * cell, | 241 vis_plugin_toggle(GtkCellRendererToggle * cell, |
387 | 380 |
388 GList *list = (GList *) data; | 381 GList *list = (GList *) data; |
389 | 382 |
390 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, | 383 store = gtk_list_store_new(PLUGIN_VIEW_N_COLS, |
391 G_TYPE_BOOLEAN, G_TYPE_STRING, | 384 G_TYPE_BOOLEAN, G_TYPE_STRING, |
392 G_TYPE_STRING, G_TYPE_INT); | 385 G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER); |
393 | 386 |
394 column = gtk_tree_view_column_new(); | 387 column = gtk_tree_view_column_new(); |
395 gtk_tree_view_column_set_title(column, _("Enabled")); | 388 gtk_tree_view_column_set_title(column, _("Enabled")); |
396 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); | 389 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); |
397 gtk_tree_view_column_set_spacing(column, 4); | 390 gtk_tree_view_column_set_spacing(column, 4); |
444 gtk_list_store_append(store, &iter); | 437 gtk_list_store_append(store, &iter); |
445 gtk_list_store_set(store, &iter, | 438 gtk_list_store_set(store, &iter, |
446 PLUGIN_VIEW_COL_ACTIVE, plugin->enabled, | 439 PLUGIN_VIEW_COL_ACTIVE, plugin->enabled, |
447 PLUGIN_VIEW_COL_DESC, description[0], | 440 PLUGIN_VIEW_COL_DESC, description[0], |
448 PLUGIN_VIEW_COL_FILENAME, description[1], | 441 PLUGIN_VIEW_COL_FILENAME, description[1], |
449 PLUGIN_VIEW_COL_ID, id++, -1); | 442 PLUGIN_VIEW_COL_ID, id++, |
443 PLUGIN_VIEW_COL_PLUGIN_PTR, plugin, -1); | |
450 | 444 |
451 g_free(description[1]); | 445 g_free(description[1]); |
452 g_free(description[0]); | 446 g_free(description[0]); |
453 } | 447 } |
454 | 448 |