Mercurial > audlegacy
changeset 3442:b0f4ab42dd3b trunk
Rework configuration and about calls.
- ui_preferences.c: use plugin->about() and plugin->configure() directly.
- discovery.[ch], effect.[ch], general.[ch], input.[ch], visualization.[ch]: remove _configure() and _about() functions.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 07 Sep 2007 07:23:00 -0500 |
parents | bd1a68dc9ebb |
children | 709cd9c2fa8f |
files | src/audacious/discovery.c src/audacious/discovery.h src/audacious/effect.c src/audacious/effect.h src/audacious/general.c src/audacious/general.h src/audacious/input.c src/audacious/input.h src/audacious/ui_preferences.c src/audacious/visualization.c src/audacious/visualization.h |
diffstat | 11 files changed, 18 insertions(+), 197 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/discovery.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/discovery.c Fri Sep 07 07:23:00 2007 -0500 @@ -53,29 +53,6 @@ return DISCOVERY_PLUGIN(node->data); } - -void -discovery_about(gint i) -{ - DiscoveryPlugin *plugin = get_discovery_plugin(i); - - if (!plugin || !plugin->about) - return; - - plugin->about(); -} - -void -discovery_configure(gint i) -{ - DiscoveryPlugin *plugin = get_discovery_plugin(i); - - if (!plugin || !plugin->configure) - return; - - plugin->configure(); -} - void enable_discovery_plugin(gint i, gboolean enable) {
--- a/src/audacious/discovery.h Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/discovery.h Fri Sep 07 07:23:00 2007 -0500 @@ -44,8 +44,6 @@ GList *get_discovery_list(void); GList *get_discovery_enabled_list(void); void enable_discovery_plugin(gint i, gboolean enable); -void discovery_about(gint i); -void discovery_configure(gint i); gboolean discovery_enabled(gint i); gchar *discovery_stringify_enabled_list(void); void discovery_enable_from_stringified_list(const gchar * list);
--- a/src/audacious/effect.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/effect.c Fri Sep 07 07:23:00 2007 -0500 @@ -105,31 +105,6 @@ } void -effect_about(int i) -{ - EffectPlugin *effect; - GList *node = g_list_nth(ep_data.effect_list, i); - if (node) { - effect = node->data; - if (effect && effect->about) - effect->about(); - } -} - -void -effect_configure(int i) -{ - GList *node = g_list_nth(ep_data.effect_list, i); - EffectPlugin *effect; - if (node) { - effect = node->data; - if (effect && effect->configure) - effect->configure(); - } -} - - -void enable_effect_plugin(int i, gboolean enable) { GList *node = g_list_nth(ep_data.effect_list, i);
--- a/src/audacious/effect.h Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/effect.h Fri Sep 07 07:23:00 2007 -0500 @@ -36,8 +36,6 @@ }; GList *get_effect_list(void); -void effect_about(gint i); -void effect_configure(gint i); GList *get_effect_enabled_list(void); void enable_effect_plugin(gint i, gboolean enable); gboolean effect_enabled(gint i);
--- a/src/audacious/general.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/general.c Fri Sep 07 07:23:00 2007 -0500 @@ -53,29 +53,6 @@ return GENERAL_PLUGIN(node->data); } - -void -general_about(gint i) -{ - GeneralPlugin *plugin = get_general_plugin(i); - - if (!plugin || !plugin->about) - return; - - plugin->about(); -} - -void -general_configure(gint i) -{ - GeneralPlugin *plugin = get_general_plugin(i); - - if (!plugin || !plugin->configure) - return; - - plugin->configure(); -} - void enable_general_plugin(gint i, gboolean enable) {
--- a/src/audacious/general.h Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/general.h Fri Sep 07 07:23:00 2007 -0500 @@ -35,8 +35,6 @@ GList *get_general_list(void); GList *get_general_enabled_list(void); void enable_general_plugin(gint i, gboolean enable); -void general_about(gint i); -void general_configure(gint i); gboolean general_enabled(gint i); gchar *general_stringify_enabled_list(void); void general_enable_from_stringified_list(const gchar * list);
--- a/src/audacious/input.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/input.c Fri Sep 07 07:23:00 2007 -0500 @@ -861,23 +861,3 @@ ui_skinned_playstatus_set_buffering(mainwin_playstatus, ip_data.buffering); } - -void -input_about(gint index) -{ - InputPlugin *ip; - - ip = g_list_nth(ip_data.input_list, index)->data; - if (ip && ip->about) - ip->about(); -} - -void -input_configure(gint index) -{ - InputPlugin *ip; - - ip = g_list_nth(ip_data.input_list, index)->data; - if (ip && ip->configure) - ip->configure(); -}
--- a/src/audacious/input.h Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/input.h Fri Sep 07 07:23:00 2007 -0500 @@ -65,9 +65,6 @@ guchar *input_get_vis(gint time); void input_update_vis_plugin(gint time); -void input_about(gint index); -void input_configure(gint index); - void input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr); InputVisType input_get_vis_type();
--- a/src/audacious/ui_preferences.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/ui_preferences.c Fri Sep 07 07:23:00 2007 -0500 @@ -875,27 +875,16 @@ GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; - gint id; + Plugin *plugin = NULL; selection = gtk_tree_view_get_selection(treeview); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return; - gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); + gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); - switch(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview), "plugin_type"))) { - case PLUGIN_VIEW_TYPE_INPUT: - input_configure(id); - break; - case PLUGIN_VIEW_TYPE_GENERAL: - general_configure(id); - break; - case PLUGIN_VIEW_TYPE_VIS: - vis_configure(id); - break; - case PLUGIN_VIEW_TYPE_EFFECT: - effect_configure(id); - break; - } + g_return_if_fail(plugin != NULL); + + plugin->configure(); } static void @@ -904,27 +893,16 @@ GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; - gint id; + Plugin *plugin = NULL; selection = gtk_tree_view_get_selection(treeview); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return; - gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); + gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); - switch(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview), "plugin_type"))) { - case PLUGIN_VIEW_TYPE_INPUT: - input_about(id); - break; - case PLUGIN_VIEW_TYPE_GENERAL: - general_about(id); - break; - case PLUGIN_VIEW_TYPE_VIS: - vis_about(id); - break; - case PLUGIN_VIEW_TYPE_EFFECT: - effect_about(id); - break; - } + g_return_if_fail(plugin != NULL); + + plugin->about(); } static void @@ -933,36 +911,17 @@ GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; - - GList *plist; - gint id; + Plugin *plugin = NULL; selection = gtk_tree_view_get_selection(treeview); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return; - gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); + gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); - switch(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview), "plugin_type"))) { - case PLUGIN_VIEW_TYPE_INPUT: - plist = get_input_list(); - break; - case PLUGIN_VIEW_TYPE_GENERAL: - plist = get_general_list(); - break; - case PLUGIN_VIEW_TYPE_VIS: - plist = get_vis_list(); - break; - case PLUGIN_VIEW_TYPE_EFFECT: - plist = get_effect_list(); - break; - default: - return; - } - plist = g_list_nth(plist, id); + g_return_if_fail(plugin != NULL); - gtk_widget_set_sensitive(GTK_WIDGET(button), - INPUT_PLUGIN(plist->data)->configure != NULL); + gtk_widget_set_sensitive(GTK_WIDGET(button), plugin->configure != NULL); } static void @@ -971,35 +930,17 @@ GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; - GList *plist; - gint id; + Plugin *plugin = NULL; selection = gtk_tree_view_get_selection(treeview); if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return; - gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_ID, &id, -1); + gtk_tree_model_get(model, &iter, PLUGIN_VIEW_COL_PLUGIN_PTR, &plugin, -1); - switch(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(treeview), "plugin_type"))) { - case PLUGIN_VIEW_TYPE_INPUT: - plist = get_input_list(); - break; - case PLUGIN_VIEW_TYPE_GENERAL: - plist = get_general_list(); - break; - case PLUGIN_VIEW_TYPE_VIS: - plist = get_vis_list(); - break; - case PLUGIN_VIEW_TYPE_EFFECT: - plist = get_effect_list(); - break; - default: - return; - } - plist = g_list_nth(plist, id); + g_return_if_fail(plugin != NULL); - gtk_widget_set_sensitive(GTK_WIDGET(button), - INPUT_PLUGIN(plist->data)->about != NULL); + gtk_widget_set_sensitive(GTK_WIDGET(button), plugin->about != NULL); }
--- a/src/audacious/visualization.c Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/visualization.c Fri Sep 07 07:23:00 2007 -0500 @@ -63,24 +63,6 @@ } void -vis_about(gint i) -{ - GList *node = g_list_nth(vp_data.vis_list, i); - - if (node && node->data && VIS_PLUGIN(node->data)->about) - VIS_PLUGIN(node->data)->about(); -} - -void -vis_configure(gint i) -{ - GList *node = g_list_nth(vp_data.vis_list, i); - - if (node && node->data && VIS_PLUGIN(node->data)->configure) - VIS_PLUGIN(node->data)->configure(); -} - -void vis_playback_start(void) { GList *node;
--- a/src/audacious/visualization.h Fri Sep 07 07:12:28 2007 -0500 +++ b/src/audacious/visualization.h Fri Sep 07 07:23:00 2007 -0500 @@ -41,8 +41,6 @@ GList *get_vis_enabled_list(void); void enable_vis_plugin(gint i, gboolean enable); void vis_disable_plugin(VisPlugin * vp); -void vis_about(gint i); -void vis_configure(gint i); void vis_playback_start(void); void vis_playback_stop(void); gboolean vis_enabled(gint i);