~ubuntu-branches/ubuntu/trusty/bluefish/trusty

« back to all changes in this revision

Viewing changes to src/plugins.c

  • Committer: Package Import Robot
  • Author(s): Daniel Leidert
  • Date: 2012-06-27 22:28:39 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20120627222839-5g0f5s6gpaezfhve
Tags: 2.2.3-1
* New upstream release.
* debian/control: Dropped DM-Upload-Allowed.
  (Maintainer): Set to my new address.
  (Suggests): Calculate browsers depending on distribution.
  (Depends): Added python depends for newly shipped Python scripts.
* debian/copyright: Minor update. Link to GPLv2 text.
* debian/rules: Enabled hardening. Added python2 module. Calculate brwoser
  dependencies via dpkg-vendor.
* debian/patches/LP810663_blacklist_from_appmenu.patch: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
 
69
69
static TBluefishPlugin *plugin_from_filename(const gchar *path) {
70
70
        TBluefishPlugin *bfplugin;
 
71
        GSList *tmpslist;
 
72
        
71
73
        bfplugin = load_plugin(path);
72
74
        DEBUG_MSG("plugin_from_filename, bfplugin=%p\n",bfplugin);
73
 
        if (bfplugin) {
74
 
                if (bfplugin->bfplugin_version == BFPLUGIN_VERSION
 
75
        if (!bfplugin)
 
76
                return NULL;
 
77
        
 
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)
83
 
                                        ) {
84
 
                        DEBUG_MSG("bluefish_load_plugins, loaded %s properly, init!\n",path);
85
 
                        return bfplugin;
86
 
                } else {
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);
 
87
                        )) {
 
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);
 
91
                return NULL;
 
92
        }
 
93
        
 
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);
 
98
                        return NULL;
90
99
                }
91
100
        }
92
 
        return NULL;
 
101
        return bfplugin;
93
102
}
94
103
 
95
 
static void bluefish_scan_dir_load_plugins(GList **oldlist,const gchar *indirname) {
 
104
static void
 
105
bluefish_scan_dir_load_plugins(GList **oldlist,const gchar *indirname)
 
106
{
96
107
        GError *error = NULL;
97
108
        GPatternSpec* patspec;
98
109
        GDir* gdir;
171
182
}
172
183
 
173
184
void bluefish_load_plugins(void) {
174
 
        GList *oldlist; 
 
185
        GList *oldlist;
 
186
        gchar *path;    
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;
178
190
 
 
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);
 
194
        g_free(path);
 
195
 
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);
184
201
        g_free(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);
188
205
        g_free(path);
189
206
#endif /* RELPLUGINPATH */
190
207
#elif defined WIN32 
191
 
        if (GTK_CHECK_VERSION(2, 16, 0))
192
 
        {
193
 
                gchar *path, *topdir;
 
208
        if (GTK_CHECK_VERSION(2, 16, 0)) {
 
209
                gchar *topdir;
194
210
 
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 */
206
 
        {
207
 
                gchar*dir = g_strconcat(g_get_home_dir(), "/."PACKAGE"/",NULL);
208
 
                bluefish_scan_dir_load_plugins(&oldlist,dir);
209
 
                g_free(dir);
210
 
        }
211
 
/* #endif */ /* DEVELOPMENT */
 
221
 
212
222
        free_arraylist(oldlist);
213
 
        
214
223
        main_v->plugins = g_slist_sort(main_v->plugins,(GCompareFunc)plugins_compare_priority);
215
224
}
216
225