69
69
static TBluefishPlugin *plugin_from_filename(const gchar *path) {
70
70
TBluefishPlugin *bfplugin;
71
73
bfplugin = load_plugin(path);
72
74
DEBUG_MSG("plugin_from_filename, bfplugin=%p\n",bfplugin);
74
if (bfplugin->bfplugin_version == BFPLUGIN_VERSION
78
if (!(bfplugin->bfplugin_version == BFPLUGIN_VERSION
75
79
&& bfplugin->gtkmajorversion == GTK_MAJOR_VERSION
76
80
&& bfplugin->document_size == sizeof(Tdocument)
77
81
&& bfplugin->sessionvars_size == sizeof(Tsessionvars)
80
84
&& bfplugin->project_size == sizeof(Tproject)
81
85
&& bfplugin->main_size == sizeof(Tmain)
82
86
&& bfplugin->properties_size == sizeof(Tproperties)
84
DEBUG_MSG("bluefish_load_plugins, loaded %s properly, init!\n",path);
87
g_warning("plugin %s is not compatible with this version of bluefish",path);
88
DEBUG_MSG("plugin_from_filename, %s binary compatibility mismatch\n",path);
88
g_warning("plugin %s is not compatible with this version of bluefish",path);
89
DEBUG_MSG("plugin_from_filename, %s binary compatibility mismatch\n",path);
90
g_module_close(PRIVATE(bfplugin)->module);
94
for(tmpslist=main_v->plugins;tmpslist;tmpslist=g_slist_next(tmpslist)) {
95
if (g_strcmp0(bfplugin->name, ((TBluefishPlugin *)tmpslist->data)->name)==0) {
96
g_warning("not loading %s, plugin \"%s\" was already loaded",path, bfplugin->name);
89
97
g_module_close(PRIVATE(bfplugin)->module);
95
static void bluefish_scan_dir_load_plugins(GList **oldlist,const gchar *indirname) {
105
bluefish_scan_dir_load_plugins(GList **oldlist,const gchar *indirname)
96
107
GError *error = NULL;
97
108
GPatternSpec* patspec;
173
184
void bluefish_load_plugins(void) {
175
187
oldlist = main_v->props.plugin_config;
176
188
DEBUG_MSG("bluefish_load_plugins, oldlist %p len=%d\n",oldlist,g_list_length(oldlist));
177
189
main_v->props.plugin_config = NULL;
191
/* load from the user directory first */
192
path = g_strconcat(g_get_home_dir(), "/."PACKAGE"/",NULL);
193
bluefish_scan_dir_load_plugins(&oldlist,path);
179
196
#if defined(NSIS) || defined(OSXAPP)
180
197
#ifdef RELPLUGINPATH
181
198
DEBUG_MSG("using RELPLUGINPATH\n");
182
gchar *path = g_build_path(G_DIR_SEPARATOR_S,RELPLUGINPATH,"lib",PACKAGE,NULL);
199
path = g_build_path(G_DIR_SEPARATOR_S,RELPLUGINPATH,"lib",PACKAGE,NULL);
183
200
bluefish_scan_dir_load_plugins(&oldlist, path);
185
202
#else /* RELPLUGINPATH */
186
gchar *path = g_build_path(G_DIR_SEPARATOR_S,".","lib",PACKAGE,NULL);
203
path = g_build_path(G_DIR_SEPARATOR_S,".","lib",PACKAGE,NULL);
187
204
bluefish_scan_dir_load_plugins(&oldlist, path);
189
206
#endif /* RELPLUGINPATH */
190
207
#elif defined WIN32
191
if (GTK_CHECK_VERSION(2, 16, 0))
193
gchar *path, *topdir;
208
if (GTK_CHECK_VERSION(2, 16, 0)) {
195
211
topdir = g_win32_get_package_installation_directory_of_module(NULL);
196
212
path = g_build_path(G_DIR_SEPARATOR_S, topdir, "lib", PACKAGE, NULL);
202
218
#else /* WIN32 */
203
219
bluefish_scan_dir_load_plugins(&oldlist,PKGLIBDIR);
204
220
#endif /* NSIS || OSXAPP */
205
/* #ifdef DEVELOPMENT */
207
gchar*dir = g_strconcat(g_get_home_dir(), "/."PACKAGE"/",NULL);
208
bluefish_scan_dir_load_plugins(&oldlist,dir);
211
/* #endif */ /* DEVELOPMENT */
212
222
free_arraylist(oldlist);
214
223
main_v->plugins = g_slist_sort(main_v->plugins,(GCompareFunc)plugins_compare_priority);