diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-01-04 01:12:31 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-04 01:12:31 +0800 |
commit | 61e3a5c5501f9d0789fcd9565fd934e84e6262dc (patch) | |
tree | cae5ada8d5ab127d1d8002126659ddf26a0c317b /src/ephy-extensions-manager.c | |
parent | 9361618f18ff024b4913e2a6987920d510b8499d (diff) | |
download | gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar.gz gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar.bz2 gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar.lz gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar.xz gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.tar.zst gsoc2013-epiphany-61e3a5c5501f9d0789fcd9565fd934e84e6262dc.zip |
Add loader directory to the .pc file.
2005-01-03 Christian Persch <chpe@cvs.gnome.org>
* data/epiphany-1.6.pc.in:
Add loader directory to the .pc file.
* src/ephy-extensions-manager.c: (sanitise_type),
(get_loader_for_type), (ephy_extensions_manager_finalize):
Load new loaders with the sblib loader.
Diffstat (limited to 'src/ephy-extensions-manager.c')
-rw-r--r-- | src/ephy-extensions-manager.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index 7419a550b..1477b05cd 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -707,12 +707,30 @@ find_loader (const LoaderInfo *info, return strcmp (info->type, type); } +static char * +sanitise_type (const char *string) +{ + char *str, *p; + + str = g_strdup (string); + for (p = str; *p != '\0'; p++) + { + if (!g_ascii_isalpha (*p)) *p = '-'; + } + + return str; +} + static EphyLoader * get_loader_for_type (EphyExtensionsManager *manager, - const char *type) + const char *type) { LoaderInfo *info; GList *l; + GData *attr = NULL; + char *path, *name, *stype; + EphyLoader *shlib_loader; + GObject *loader; LOG ("Looking for loader for type '%s'", type) @@ -736,7 +754,33 @@ get_loader_for_type (EphyExtensionsManager *manager, return g_object_ref (info->loader); } - /* try to load a loader */ + stype = sanitise_type (type); + name = g_strconcat ("lib", stype, "loader.", G_MODULE_SUFFIX, NULL); + path = g_build_filename (LOADER_DIR, name, NULL); + g_datalist_init (&attr); + g_datalist_set_data (&attr, "library", path); + + shlib_loader = get_loader_for_type (manager, "shlib"); + g_return_val_if_fail (shlib_loader != NULL, NULL); + + loader = ephy_loader_get_object (shlib_loader, &attr); + g_datalist_clear (&attr); + g_free (stype); + g_free (name); + g_free (path); + + if (EPHY_IS_LOADER (loader)) + { + info = g_new (LoaderInfo, 1); + info->type = g_strdup (type); + info->loader = EPHY_LOADER (loader); + + manager->priv->factories = + g_list_append (manager->priv->factories, info); + + return g_object_ref (info->loader); + } + g_return_val_if_reached (NULL); return NULL; @@ -1225,6 +1269,7 @@ ephy_extensions_manager_finalize (GObject *object) g_list_foreach (priv->extensions, (GFunc) g_object_unref, NULL); g_list_free (priv->extensions); + /* FIXME release loaded loaders */ g_list_foreach (priv->factories, (GFunc) free_loader_info, NULL); g_list_free (priv->factories); |