diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-10-21 23:31:19 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-10-21 23:31:19 +0800 |
commit | 8e4b79936d79e1fb33947fbfbea1f69141488790 (patch) | |
tree | 3ea3a4c212b43be8b3526d5098800a61f63b1d41 /lib | |
parent | 944263b78b78513f86b48dd74a1ba9900f05ed10 (diff) | |
download | gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar.gz gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar.bz2 gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar.lz gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar.xz gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.tar.zst gsoc2013-epiphany-8e4b79936d79e1fb33947fbfbea1f69141488790.zip |
Expose the extension description keyfile directly to the loaders.
2005-10-21 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-loader.c: (ephy_loader_get_object):
* lib/ephy-loader.h:
* lib/ephy-module.c: (ephy_module_load), (ephy_module_new):
* lib/ephy-module.h:
* lib/ephy-shlib-loader.c: (impl_get_object),
(ephy_shlib_loader_class_init):
* src/ephy-extensions-manager.c: (free_extension_info),
(ephy_extensions_manager_load_ini_string), (get_loader_for_type),
(load_extension):
* src/ephy-python-loader.c: (impl_get_object):
Expose the extension description keyfile directly to the loaders.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-loader.c | 4 | ||||
-rw-r--r-- | lib/ephy-loader.h | 4 | ||||
-rw-r--r-- | lib/ephy-module.c | 10 | ||||
-rw-r--r-- | lib/ephy-module.h | 3 | ||||
-rw-r--r-- | lib/ephy-shlib-loader.c | 27 |
5 files changed, 28 insertions, 20 deletions
diff --git a/lib/ephy-loader.c b/lib/ephy-loader.c index 9d682caa9..d7df7de8c 100644 --- a/lib/ephy-loader.c +++ b/lib/ephy-loader.c @@ -54,10 +54,10 @@ ephy_loader_type (const EphyLoader *loader) GObject * ephy_loader_get_object (EphyLoader *loader, - GData **attributes) + GKeyFile *keyfile) { EphyLoaderIface *iface = EPHY_LOADER_GET_IFACE (loader); - return iface->get_object (loader, attributes); + return iface->get_object (loader, keyfile); } void diff --git a/lib/ephy-loader.h b/lib/ephy-loader.h index c987bb636..0a77f6d6f 100644 --- a/lib/ephy-loader.h +++ b/lib/ephy-loader.h @@ -46,7 +46,7 @@ struct _EphyLoaderIface /* Methods */ GObject * (* get_object) (EphyLoader *loader, - GData **attributes); + GKeyFile *keyfile); void (* release_object) (EphyLoader *loader, GObject *object); }; @@ -56,7 +56,7 @@ GType ephy_loader_get_type (void); const char *ephy_loader_type (const EphyLoader *loader); GObject *ephy_loader_get_object (EphyLoader *loader, - GData **attributes); + GKeyFile *keyfile); void ephy_loader_release_object (EphyLoader *loader, GObject *object); diff --git a/lib/ephy-module.c b/lib/ephy-module.c index 9572d2010..39bf5b35c 100644 --- a/lib/ephy-module.c +++ b/lib/ephy-module.c @@ -42,6 +42,7 @@ struct _EphyModule char *path; GType type; + guint resident : 1; }; typedef GType (*EphyModuleRegisterFunc) (GTypeModule *); @@ -139,6 +140,11 @@ ephy_module_load (GTypeModule *gmodule) return FALSE; } + if (module->resident) + { + g_module_make_resident (module->library); + } + return TRUE; } @@ -209,7 +215,8 @@ ephy_module_class_init (EphyModuleClass *class) } EphyModule * -ephy_module_new (const char *path) +ephy_module_new (const char *path, + gboolean resident) { EphyModule *result; @@ -222,6 +229,7 @@ ephy_module_new (const char *path) g_type_module_set_name (G_TYPE_MODULE (result), path); result->path = g_strdup (path); + result->resident = resident != FALSE; return result; } diff --git a/lib/ephy-module.h b/lib/ephy-module.h index aaacbff63..191b1ffde 100644 --- a/lib/ephy-module.h +++ b/lib/ephy-module.h @@ -37,7 +37,8 @@ typedef struct _EphyModule EphyModule; GType ephy_module_get_type (void); -EphyModule *ephy_module_new (const char *path); +EphyModule *ephy_module_new (const char *path, + gboolean resident); const char *ephy_module_get_path (EphyModule *module); diff --git a/lib/ephy-shlib-loader.c b/lib/ephy-shlib-loader.c index 2b0b9b6d2..c1a82e938 100644 --- a/lib/ephy-shlib-loader.c +++ b/lib/ephy-shlib-loader.c @@ -36,9 +36,6 @@ typedef struct GObject *object; } LoaderData; -static GQuark Library_quark = 0; -static GQuark library_quark = 0; - #define EPHY_SHLIB_LOADER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHLIB_LOADER, EphyShlibLoaderPrivate)) struct _EphyShlibLoaderPrivate @@ -143,24 +140,25 @@ find_object (const LoaderData *data, static GObject * impl_get_object (EphyLoader *eloader, - GData **attributes) + GKeyFile *keyfile) { EphyShlibLoader *loader = EPHY_SHLIB_LOADER (eloader); GSList *l; LoaderData *data = NULL; - const char *library; + char *library; + gboolean resident; - library = g_datalist_id_get_data (attributes, Library_quark); - if (library == NULL) - { - library = g_datalist_id_get_data (attributes, library_quark); - } + g_return_val_if_fail (keyfile != NULL, NULL); + + library = g_key_file_get_string (keyfile, "Loader", "Library", NULL); if (library == NULL) { g_warning ("NULL library name!\n"); return NULL; } + resident = g_key_file_get_boolean (keyfile, "Loader", "Resident", NULL); + l = g_slist_find_custom (loader->priv->data, library, (GCompareFunc) find_library); @@ -171,6 +169,7 @@ impl_get_object (EphyLoader *eloader, if (data->object != NULL) { + g_free (library); return g_object_ref (data->object); } } @@ -182,13 +181,14 @@ impl_get_object (EphyLoader *eloader, if (data->module == NULL) { - data->module = ephy_module_new (library); + data->module = ephy_module_new (library, resident); } g_return_val_if_fail (data->object == NULL, data->object); if (g_type_module_use (G_TYPE_MODULE (data->module)) == FALSE) { + g_free (library); g_warning ("Could not load extension file at %s\n", ephy_module_get_path (data->module)); return NULL; @@ -203,6 +203,8 @@ impl_get_object (EphyLoader *eloader, g_object_set_data (G_OBJECT (data->object), DATA_KEY, data); } + g_free (library); + return data->object; } @@ -241,7 +243,4 @@ ephy_shlib_loader_class_init (EphyShlibLoaderClass *klass) object_class->finalize = ephy_shlib_loader_finalize; g_type_class_add_private (object_class, sizeof (EphyShlibLoaderPrivate)); - - Library_quark = g_quark_from_string ("Library"); - library_quark = g_quark_from_string ("library"); } |