Exemplo n.º 1
0
static gboolean
nautilus_module_load (GTypeModule *gmodule)
{
	NautilusModule *module;
	
	module = NAUTILUS_MODULE (gmodule);
	
	module->library = g_module_open (module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);

	if (!module->library) {
		g_warning ("%s", g_module_error ());
		return FALSE;
	}

	if (!g_module_symbol (module->library,
			      "nautilus_module_initialize",
			      (gpointer *)&module->initialize) ||
	    !g_module_symbol (module->library,
			      "nautilus_module_shutdown",
			      (gpointer *)&module->shutdown) ||
	    !g_module_symbol (module->library,
			      "nautilus_module_list_types",
			      (gpointer *)&module->list_types)) {

		g_warning ("%s", g_module_error ());
		g_module_close (module->library);
		
		return FALSE;
	}

	module->initialize (gmodule);
	
	return TRUE;
}
Exemplo n.º 2
0
static gboolean
nautilus_module_load (GTypeModule *gmodule)
{
	NautilusModule *module;
	
	module = NAUTILUS_MODULE (gmodule);
	
	module->library = g_module_open (module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);

	if (!module->library) {
		g_warning ("%s", g_module_error ());
		return FALSE;
	}

	/* ORBit installs atexit() handlers, which would get unloaded together
	 * with the module now that the main process doesn't depend on GConf anymore,
	 * causing nautilus to sefgault at exit.
	 * If we detect that an extension would pull in ORBit, we make the
	 * module resident to prevent that.
	 */
        if (module_pulls_in_orbit (module->library)) {
		g_module_make_resident (module->library);
        }

	if (!g_module_symbol (module->library,
			      "nautilus_module_initialize",
			      (gpointer *)&module->initialize) ||
	    !g_module_symbol (module->library,
			      "nautilus_module_shutdown",
			      (gpointer *)&module->shutdown) ||
	    !g_module_symbol (module->library,
			      "nautilus_module_list_types",
			      (gpointer *)&module->list_types)) {

		g_warning ("%s", g_module_error ());
		g_module_close (module->library);
		
		return FALSE;
	}

	module->initialize (gmodule);
	
	return TRUE;
}