diff options
Diffstat (limited to 'browser-plugin/glue.cpp')
-rw-r--r-- | browser-plugin/glue.cpp | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/browser-plugin/glue.cpp b/browser-plugin/glue.cpp index 027f55f..74a3a34 100644 --- a/browser-plugin/glue.cpp +++ b/browser-plugin/glue.cpp @@ -36,11 +36,35 @@ NPNetscapeFuncs NPNFuncs; static char *mimeDescription = NULL; +static bool +InitEvince (void) +{ + if (ev_is_initialized ()) { + return true; + } + +#ifndef USE_PLUGIN_KEEP_IN_MEMORY + /* Keep libevview in memory. NPPVpluginKeepLibraryInMemory is broken. + See https://bugzilla.mozilla.org/show_bug.cgi?id=359870 */ + + GModule *module = g_module_open ("libevview", (GModuleFlags)0); + if (module == NULL) { + return false; + } + g_module_make_resident (module); + g_module_close (module); +#endif + + ev_init (); + + return true; +} + char * NP_GetMIMEDescription (void) { - if (!ev_is_initialized()) { - ev_init (); + if (!InitEvince ()) { + return NULL; } if (mimeDescription == NULL) { @@ -67,21 +91,9 @@ NP_GetMIMEDescription (void) NPError NP_Initialize (NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs) { -#ifndef USE_PLUGIN_KEEP_IN_MEMORY - /* Keep libevview in memory. NPPVpluginKeepLibraryInMemory is broken. - See https://bugzilla.mozilla.org/show_bug.cgi?id=359870 */ - - GModule *module = g_module_open ("libevview", (GModuleFlags)0); - if (module == NULL) { + if (!InitEvince ()) { return NPERR_MODULE_LOAD_FAILED_ERROR; } - g_module_make_resident (module); - g_module_close (module); -#endif - - if (!ev_is_initialized()) { - ev_init (); - } if (aNPNFuncs == NULL || aNPPFuncs == NULL) { return NPERR_INVALID_FUNCTABLE_ERROR; |