annotate src/audacious/pluginenum.c @ 3478:481a4a88d3ec trunk

Use old iterator when new one isn't found
author Kieran Clancy <clancy.kieran+audacious@gmail.com>
date Mon, 10 Sep 2007 14:16:20 +0930
parents c0eb377bb4e5
children 6aea4fb32ef4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious development team
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
3 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
4 * Based on BMP:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
5 * Copyright (C) 2003-2004 BMP development team
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
6 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
7 * Based on XMMS:
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
8 * Copyright (C) 1998-2003 XMMS development team
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
9 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2825
diff changeset
12 * the Free Software Foundation; under version 3 of the License.
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
13 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
17 * GNU General Public License for more details.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
18 *
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
3121
3b6d316f8b09 GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents: 2825
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
3123
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
21 *
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
22 * The Audacious team does not consider modular code linking to
f1c756f39e6c Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents: 3121
diff changeset
23 * Audacious or using our public API to be a derived work.
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
24 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
25
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
27 # include "config.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
28 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
29
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
30 #ifndef SHARED_SUFFIX
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
31 # define SHARED_SUFFIX G_MODULE_SUFFIX
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
32 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
33
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
34 #include <glib.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
35 #include <gmodule.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
36 #include <glib/gprintf.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
37 #include <string.h>
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
38
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
39 #include "main.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
40 #include "ui_main.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
41 #include "playback.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
42 #include "playlist.h"
2373
ad1d7687814c [svn] made strings.h for existing strings.c, cleanups
mf0102
parents: 2313
diff changeset
43 #include "strings.h"
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
44 #include "util.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
45
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
46 #include "effect.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
47 #include "general.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
48 #include "input.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
49 #include "output.h"
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
50 #include "visualization.h"
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
51 #include "discovery.h"
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
52
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
53 #include "pluginenum.h"
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
54
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
55 const gchar *plugin_dir_list[] = {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
56 PLUGINSUBS,
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
57 NULL
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
58 };
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
59
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
60 GList *lowlevel_list = NULL;
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
61 extern GList *vfs_transports;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
62
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
63 mowgli_dictionary_t *plugin_dict = NULL;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
64
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
65 static gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
66 inputlist_compare_func(gconstpointer a, gconstpointer b)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
67 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
68 const InputPlugin *ap = a, *bp = b;
2804
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
69 if(ap->description && bp->description)
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
70 return strcasecmp(ap->description, bp->description);
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
71 else
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
72 return 0;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
73 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
74
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
75 static gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
76 outputlist_compare_func(gconstpointer a, gconstpointer b)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
77 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
78 const OutputPlugin *ap = a, *bp = b;
2804
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
79 if(ap->description && bp->description)
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
80 return strcasecmp(ap->description, bp->description);
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
81 else
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
82 return 0;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
83 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
84
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
85 static gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
86 effectlist_compare_func(gconstpointer a, gconstpointer b)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
87 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
88 const EffectPlugin *ap = a, *bp = b;
2804
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
89 if(ap->description && bp->description)
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
90 return strcasecmp(ap->description, bp->description);
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
91 else
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
92 return 0;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
93 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
94
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
95 static gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
96 generallist_compare_func(gconstpointer a, gconstpointer b)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
97 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
98 const GeneralPlugin *ap = a, *bp = b;
2804
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
99 if(ap->description && bp->description)
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
100 return strcasecmp(ap->description, bp->description);
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
101 else
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
102 return 0;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
103 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
104
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
105 static gint
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
106 vislist_compare_func(gconstpointer a, gconstpointer b)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
107 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
108 const VisPlugin *ap = a, *bp = b;
2804
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
109 if(ap->description && bp->description)
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
110 return strcasecmp(ap->description, bp->description);
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
111 else
d5c77e670be0 [svn] - temporal fix for crash in compare_func().
yaz
parents: 2801
diff changeset
112 return 0;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
113 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
114
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
115 static gint
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
116 discoverylist_compare_func(gconstpointer a, gconstpointer b)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
117 {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
118 const DiscoveryPlugin *ap = a, *bp = b;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
119 if(ap->description && bp->description)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
120 return strcasecmp(ap->description, bp->description);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
121 else
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
122 return 0;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
123 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
124
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
125 static gboolean
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
126 plugin_is_duplicate(const gchar * filename)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
127 {
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
128 gchar *base_filename = g_path_get_basename(filename);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
129
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
130 if (mowgli_dictionary_retrieve(plugin_dict, base_filename) != NULL)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
131 {
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
132 g_free(base_filename);
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
133 return TRUE;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
134 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
135
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
136 g_free(base_filename);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
137
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
138 return FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
139 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
140
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
141 gboolean
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
142 plugin_is_enabled(const gchar *filename)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
143 {
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
144 Plugin *plugin = mowgli_dictionary_retrieve(plugin_dict, filename);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
145
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
146 if (!plugin)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
147 return FALSE;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
148
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
149 return plugin->enabled;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
150 }
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
151
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
152 void
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
153 plugin_set_enabled(const gchar *filename, gboolean enabled)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
154 {
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
155 Plugin *plugin = mowgli_dictionary_retrieve(plugin_dict, filename);
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
156
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
157 if (!plugin)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
158 return;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
159
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
160 plugin->enabled = enabled;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
161 }
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
162
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
163 Plugin *
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
164 plugin_get_plugin(const gchar *filename)
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
165 {
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
166 return mowgli_dictionary_retrieve(plugin_dict, filename);
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
167 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
168
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
169 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
170 input_plugin_init(Plugin * plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
171 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
172 InputPlugin *p = INPUT_PLUGIN(plugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
173
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
174 p->get_vis_type = input_get_vis_type;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
175 p->add_vis_pcm = input_add_vis_pcm;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
176
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
177 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
178 else thinks we could use a CONST macro to solve the warnings?
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
179 - descender */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
180 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi;
3165
8775dfc57ead Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
181 p->set_info_text = input_set_info_text;
8775dfc57ead Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
182 p->set_status_buffering = input_set_status_buffering;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
183
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
184 ip_data.input_list = g_list_append(ip_data.input_list, p);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
185
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
186 p->enabled = TRUE;
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
187
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
188 /* XXX: we need something better than p->filename if plugins
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
189 will eventually provide multiple plugins --nenolod */
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
190 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
191 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
192
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
193 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
194 output_plugin_init(Plugin * plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
195 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
196 OutputPlugin *p = OUTPUT_PLUGIN(plugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
197 op_data.output_list = g_list_append(op_data.output_list, p);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
198
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
199 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
200 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
201
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
202 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
203 effect_plugin_init(Plugin * plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
204 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
205 EffectPlugin *p = EFFECT_PLUGIN(plugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
206 ep_data.effect_list = g_list_append(ep_data.effect_list, p);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
207
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
208 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
209 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
210
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
211 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
212 general_plugin_init(Plugin * plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
213 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
214 GeneralPlugin *p = GENERAL_PLUGIN(plugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
215 gp_data.general_list = g_list_append(gp_data.general_list, p);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
216
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
217 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
218 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
219
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
220 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
221 vis_plugin_init(Plugin * plugin)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
222 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
223 VisPlugin *p = VIS_PLUGIN(plugin);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
224 p->disable_plugin = vis_disable_plugin;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
225 vp_data.vis_list = g_list_append(vp_data.vis_list, p);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
226
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
227 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
228 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
229
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
230 static void
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
231 discovery_plugin_init(Plugin * plugin)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
232 {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
233 DiscoveryPlugin *p = DISCOVERY_PLUGIN(plugin);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
234 dp_data.discovery_list = g_list_append(dp_data.discovery_list, p);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
235
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
236 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p);
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
237 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
238
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
239 /*******************************************************************/
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
240
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
241 static void
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
242 plugin2_dispose(GModule *module, const gchar *str, ...)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
243 {
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
244 gchar buf[4096];
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
245 va_list va;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
246
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
247 va_start(va, str);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
248 vsnprintf(buf, 4096, str, va);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
249 va_end(va);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
250
3247
e21930ccd5a8 remove old debugging notices that aren't very relevant anymore.
William Pitcock <nenolod@atheme-project.org>
parents: 3232
diff changeset
251 g_message("*** %s\n", buf);
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
252 g_module_close(module);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
253 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
254
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
255 void
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
256 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
257 {
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
258 InputPlugin **ip_iter;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
259 OutputPlugin **op_iter;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
260 EffectPlugin **ep_iter;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
261 GeneralPlugin **gp_iter;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
262 VisPlugin **vp_iter;
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
263 DiscoveryPlugin **dp_iter;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
264
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
265 if (header->magic != PLUGIN_MAGIC)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
266 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
267
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
268 if (header->api_version != __AUDACIOUS_PLUGIN_API__)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
269 return plugin2_dispose(module, "plugin <%s> discarded, wanting API version %d, we implement API version %d",
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
270 filename, header->api_version, __AUDACIOUS_PLUGIN_API__);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
271
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
272 if (header->init)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
273 header->init();
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
274
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
275 header->priv_assoc = g_new0(Plugin, 1);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
276 header->priv_assoc->handle = module;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
277 header->priv_assoc->filename = g_strdup(filename);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
278
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
279 if (header->ip_list)
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
280 {
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
281 for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++)
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
282 {
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
283 PLUGIN(*ip_iter)->filename = g_strdup(filename);
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
284 input_plugin_init(PLUGIN(*ip_iter));
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
285 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
286 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
287
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
288 if (header->op_list)
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
289 {
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
290 for (op_iter = header->op_list; *op_iter != NULL; op_iter++)
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
291 {
2801
8ab12f092722 [svn] - extended compatibility with v1 API
nenolod
parents: 2799
diff changeset
292 PLUGIN(*op_iter)->filename = g_strdup(filename);
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
293 output_plugin_init(PLUGIN(*op_iter));
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
294 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
295 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
296
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
297 if (header->ep_list)
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
298 {
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
299 for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++)
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
300 {
2801
8ab12f092722 [svn] - extended compatibility with v1 API
nenolod
parents: 2799
diff changeset
301 PLUGIN(*ep_iter)->filename = g_strdup(filename);
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
302 effect_plugin_init(PLUGIN(*ep_iter));
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
303 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
304 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
305
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
306 if (header->gp_list)
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
307 {
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
308 for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++)
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
309 {
2801
8ab12f092722 [svn] - extended compatibility with v1 API
nenolod
parents: 2799
diff changeset
310 PLUGIN(*gp_iter)->filename = g_strdup(filename);
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
311 general_plugin_init(PLUGIN(*gp_iter));
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
312 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
313 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
314
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
315 if (header->vp_list)
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
316 {
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
317 for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++)
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
318 {
2801
8ab12f092722 [svn] - extended compatibility with v1 API
nenolod
parents: 2799
diff changeset
319 PLUGIN(*vp_iter)->filename = g_strdup(filename);
2799
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
320 vis_plugin_init(PLUGIN(*vp_iter));
febdfe7a482b [svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents: 2798
diff changeset
321 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
322 }
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
323
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
324 if (header->dp_list)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
325 {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
326 for (dp_iter = header->dp_list; *dp_iter != NULL; dp_iter++)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
327 {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
328 PLUGIN(*dp_iter)->filename = g_strdup(filename);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
329 discovery_plugin_init(PLUGIN(*dp_iter));
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
330 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
331 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
332 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
333
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
334 void
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
335 plugin2_unload(PluginHeader *header)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
336 {
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
337 GModule *module;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
338
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
339 g_return_if_fail(header->priv_assoc != NULL);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
340
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
341 module = header->priv_assoc->handle;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
342
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
343 g_free(header->priv_assoc->filename);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
344 g_free(header->priv_assoc);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
345
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
346 if (header->fini)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
347 header->fini();
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
348
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
349 g_module_close(module);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
350 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
351
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
352 /******************************************************************/
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
353
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
354 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
355 add_plugin(const gchar * filename)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
356 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
357 GModule *module;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
358 gpointer func;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
359
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
360 if (plugin_is_duplicate(filename))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
361 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
362
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
363 g_message("Loaded plugin (%s)", filename);
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
364
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
365 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
366 printf("Failed to load plugin (%s): %s\n",
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
367 filename, g_module_error());
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
368 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
369 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
370
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
371 /* v2 plugin loading */
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
372 if (g_module_symbol(module, "get_plugin_info", &func))
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
373 {
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
374 PluginHeader *(*header_func_p)() = func;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
375 PluginHeader *header;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
376
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
377 /* this should never happen. */
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
378 g_return_if_fail((header = header_func_p()) != NULL);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
379
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
380 plugin2_process(header, module, filename);
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
381 return;
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
382 }
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
383
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
384 printf("Invalid plugin (%s)\n", filename);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
385 g_module_close(module);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
386 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
387
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
388 static gboolean
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
389 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
390 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
391 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
392 return FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
393
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
394 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
395 return FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
396
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
397 add_plugin(path);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
398
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
399 return FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
400 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
401
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
402 static void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
403 scan_plugins(const gchar * path)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
404 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
405 dir_foreach(path, scan_plugin_func, NULL, NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
406 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
407
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
408 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
409 plugin_system_init(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
410 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
411 gchar *dir, **disabled;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
412 GList *node;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
413 OutputPlugin *op;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
414 InputPlugin *ip;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
415 LowlevelPlugin *lp;
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
416 DiscoveryPlugin *dp;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
417 gint dirsel = 0, i = 0;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
418
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
419 if (!g_module_supported()) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
420 report_error("Module loading not supported! Plugins will not be loaded.\n");
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
421 return;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
422 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
423
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
424 plugin_dict = mowgli_dictionary_create(g_ascii_strcasecmp);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
425
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
426 #ifndef DISABLE_USER_PLUGIN_DIR
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
427 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
428 /*
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
429 * This is in a separate lo
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
430 * DiscoveryPlugin *dpop so if the user puts them in the
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
431 * wrong dir we'll still get them in the right order (home dir
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
432 * first) - Zinx
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
433 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
434 while (plugin_dir_list[dirsel]) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
435 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR],
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
436 plugin_dir_list[dirsel++], NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
437 scan_plugins(dir);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
438 g_free(dir);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
439 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
440 dirsel = 0;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
441 #endif
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
442
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
443 while (plugin_dir_list[dirsel]) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
444 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
445 scan_plugins(dir);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
446 g_free(dir);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
447 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
448
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
449 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
450 if (!op_data.current_output_plugin
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
451 && g_list_length(op_data.output_list)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
452 op_data.current_output_plugin = op_data.output_list->data;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
453 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
454
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
455 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
456
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
457 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
458 ep_data.enabled_list = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
459
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
460 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
461 gp_data.enabled_list = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
462
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
463 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
464 vp_data.enabled_list = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
465
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
466 dp_data.discovery_list = g_list_sort(dp_data.discovery_list, discoverylist_compare_func);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
467 dp_data.enabled_list = NULL;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
468
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
469
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
470 general_enable_from_stringified_list(cfg.enabled_gplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
471 vis_enable_from_stringified_list(cfg.enabled_vplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
472 effect_enable_from_stringified_list(cfg.enabled_eplugins);
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
473 discovery_enable_from_stringified_list(cfg.enabled_dplugins);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
474
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
475 g_free(cfg.enabled_gplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
476 cfg.enabled_gplugins = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
477
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
478 g_free(cfg.enabled_vplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
479 cfg.enabled_vplugins = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
480
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
481 g_free(cfg.enabled_eplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
482 cfg.enabled_eplugins = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
483
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
484 g_free(cfg.enabled_dplugins);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
485 cfg.enabled_dplugins = NULL;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
486
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
487
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
488 for (node = op_data.output_list; node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
489 op = OUTPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
490 /*
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
491 * Only test basename to avoid problems when changing
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
492 * prefix. We will only see one plugin with the same
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
493 * basename, so this is usually what the user want.
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
494 */
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
495 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename)))
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
496 op_data.current_output_plugin = op;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
497 if (op->init)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
498 op->init();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
499 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
500
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
501 for (node = ip_data.input_list; node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
502 ip = INPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
503 if (ip->init)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
504 ip->init();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
505 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
506
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
507 for (node = dp_data.discovery_list; node; node = g_list_next(node)) {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
508 dp = DISCOVERY_PLUGIN(node->data);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
509 if (dp->init)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
510 dp->init();
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
511 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
512
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
513
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
514 for (node = lowlevel_list; node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
515 lp = LOWLEVEL_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
516 if (lp->init)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
517 lp->init();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
518 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
519
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
520 if (cfg.disabled_iplugins) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
521 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0);
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
522
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
523 while (disabled[i]) {
3454
c0eb377bb4e5 Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents: 3438
diff changeset
524 Plugin *plugintmp = plugin_get_plugin(disabled[i]);
c0eb377bb4e5 Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents: 3438
diff changeset
525 if (plugintmp)
c0eb377bb4e5 Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents: 3438
diff changeset
526 INPUT_PLUGIN(plugintmp)->enabled = FALSE;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
527 i++;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
528 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
529
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
530 g_free(disabled);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
531
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
532 g_free(cfg.disabled_iplugins);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
533 cfg.disabled_iplugins = NULL;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
534 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
535 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
536
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
537 void
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
538 plugin_system_cleanup(void)
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
539 {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
540 InputPlugin *ip;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
541 OutputPlugin *op;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
542 EffectPlugin *ep;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
543 GeneralPlugin *gp;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
544 VisPlugin *vp;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
545 LowlevelPlugin *lp;
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
546 DiscoveryPlugin *dp;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
547 GList *node;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
548
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
549 g_message("Shutting down plugin system");
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
550
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
551 if (playback_get_playing()) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
552 ip_data.stop = TRUE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
553 playback_stop();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
554 ip_data.stop = FALSE;
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
555 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
556
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
557 /* FIXME: race condition -nenolod */
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
558 op_data.current_output_plugin = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
559
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
560 for (node = get_input_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
561 ip = INPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
562 if (ip && ip->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
563 ip->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
564 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
565 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
566 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
567 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
568
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
569 if (ip->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
570 g_module_close(ip->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
571 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
572
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
573 if (ip_data.input_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
574 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
575 g_list_free(ip_data.input_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
576 ip_data.input_list = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
577 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
578
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
579 for (node = get_output_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
580 op = OUTPUT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
581 if (op && op->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
582 op->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
583 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
584 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
585 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
586 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
587
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
588 if (op->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
589 g_module_close(op->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
590 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
591
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
592 if (op_data.output_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
593 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
594 g_list_free(op_data.output_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
595 op_data.output_list = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
596 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
597
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
598 for (node = get_effect_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
599 ep = EFFECT_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
600 if (ep && ep->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
601 ep->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
602 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
603 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
604 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
605 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
606
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
607 if (ep->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
608 g_module_close(ep->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
609 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
610
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
611 if (ep_data.effect_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
612 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
613 g_list_free(ep_data.effect_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
614 ep_data.effect_list = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
615 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
616
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
617 for (node = get_general_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
618 gp = GENERAL_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
619 if (gp && gp->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
620 gp->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
621 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
622 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
623 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
624 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
625
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
626 if (gp->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
627 g_module_close(gp->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
628 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
629
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
630 if (gp_data.general_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
631 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
632 g_list_free(gp_data.general_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
633 gp_data.general_list = NULL;
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
634 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
635
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
636 for (node = get_vis_list(); node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
637 vp = VIS_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
638 if (vp && vp->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
639 vp->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
640 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
641 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
642 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
643 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
644
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
645 if (vp->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
646 g_module_close(vp->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
647 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
648
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
649 if (vp_data.vis_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
650 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
651 g_list_free(vp_data.vis_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
652 vp_data.vis_list = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
653 }
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
654
3227
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
655
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
656 for (node = get_discovery_list(); node; node = g_list_next(node)) {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
657 dp = DISCOVERY_PLUGIN(node->data);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
658 if (dp && dp->cleanup) {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
659 dp->cleanup();
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
660 GDK_THREADS_LEAVE();
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
661 while (g_main_context_iteration(NULL, FALSE));
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
662 GDK_THREADS_ENTER();
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
663 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
664
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
665 if (dp->handle)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
666 g_module_close(dp->handle);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
667 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
668
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
669 if (dp_data.discovery_list != NULL)
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
670 {
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
671 g_list_free(dp_data.discovery_list);
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
672 dp_data.discovery_list = NULL;
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
673 }
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
674
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
675
2619f4c62abe added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 3165
diff changeset
676
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
677 for (node = lowlevel_list; node; node = g_list_next(node)) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
678 lp = LOWLEVEL_PLUGIN(node->data);
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
679 if (lp && lp->cleanup) {
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
680 lp->cleanup();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
681 GDK_THREADS_LEAVE();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
682 while (g_main_context_iteration(NULL, FALSE));
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
683 GDK_THREADS_ENTER();
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
684 }
2797
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
685
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
686 if (lp->handle)
f0c1c8b22c88 [svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents: 2795
diff changeset
687 g_module_close(lp->handle);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
688 }
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
689
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
690 if (lowlevel_list != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
691 {
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
692 g_list_free(lowlevel_list);
2623
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
693 lowlevel_list = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
694 }
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
695
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
696 /* XXX: vfs will crash otherwise. -nenolod */
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
697 if (vfs_transports != NULL)
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
698 {
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
699 g_list_free(vfs_transports);
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
700 vfs_transports = NULL;
0ad10a95ed10 [svn] - plugin reloading.
nenolod
parents: 2400
diff changeset
701 }
2682
c3cd6e47faf6 [svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents: 2624
diff changeset
702
3437
3092a8b3fe34 Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents: 3247
diff changeset
703 mowgli_dictionary_destroy(plugin_dict, NULL, NULL);
2313
3149d4b1a9a9 [svn] - objective-make autodepend fixes
nenolod
parents:
diff changeset
704 }