diff src/audacious/general.c @ 3437:3092a8b3fe34 trunk

Big plugin system changes (part 1 of who knows, it's still a big mess): - remove plugin_matrix, replacing it with a mowgli.dictionary of all loaded plugins pointing back to their handles - input_is_enabled() craq -> gboolean plugin::enabled (this craq was pointed out by ccr) - consolidate a lot of crap in ui_preferences.c (a LOT more to come) - introduce probably countless loads of bugs and SIGSEGVs. - you WILL need to recompile plugins after this, and some which do not use C99-style struct initialisers will likely fail to build.
author William Pitcock <nenolod@atheme.org>
date Fri, 07 Sep 2007 03:20:28 -0500
parents f1c756f39e6c
children b0f4ab42dd3b
line wrap: on
line diff
--- a/src/audacious/general.c	Fri Sep 07 02:02:53 2007 -0500
+++ b/src/audacious/general.c	Fri Sep 07 03:20:28 2007 -0500
@@ -76,12 +76,6 @@
     plugin->configure();
 }
 
-static gboolean
-general_plugin_is_enabled(GeneralPlugin * plugin)
-{
-    return (g_list_find(get_general_enabled_list(), plugin) != NULL);
-}
-
 void
 enable_general_plugin(gint i, gboolean enable)
 {
@@ -90,16 +84,18 @@
     if (!plugin)
         return;
 
-    if (enable && !general_plugin_is_enabled(plugin)) {
+    if (enable && !plugin->enabled) {
         gp_data.enabled_list = g_list_append(gp_data.enabled_list, plugin);
         if (plugin->init)
             plugin->init();
     }
-    else if (!enable && general_plugin_is_enabled(plugin)) {
+    else if (!enable && plugin->enabled) {
         gp_data.enabled_list = g_list_remove(gp_data.enabled_list, plugin);
         if (plugin->cleanup)
             plugin->cleanup();
     }
+
+    plugin->enabled = enable;
 }
 
 gboolean
@@ -154,6 +150,8 @@
 
             if (!strcmp(*str, base)) {
                 plugin = GENERAL_PLUGIN(node->data);
+                plugin->enabled = TRUE;
+
                 gp_data.enabled_list = g_list_append(gp_data.enabled_list,
                                                       plugin);
                 if (plugin->init)