diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | data/epiphany-1.6.pc.in | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/ephy-extensions-manager.c | 49 |
4 files changed, 60 insertions, 2 deletions
@@ -1,5 +1,16 @@ 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. + +2005-01-03 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-window.h: Remove ephy_window_print(). diff --git a/data/epiphany-1.6.pc.in b/data/epiphany-1.6.pc.in index bd81d700b..856c03079 100644 --- a/data/epiphany-1.6.pc.in +++ b/data/epiphany-1.6.pc.in @@ -3,6 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/epiphany-@EPIPHANY_MAJOR@ extensionsdir=@libdir@/epiphany-@EPIPHANY_MAJOR@/extensions +loaderdir=@libdir@/epiphany-@EPIPHANY_MAJOR@/loaders Name: Epiphany Browser Description: GNOME Web Browser diff --git a/src/Makefile.am b/src/Makefile.am index 526075ba6..eb0b110cf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -98,6 +98,7 @@ libephymain_la_CPPFLAGS = \ -I$(top_srcdir)/src/bookmarks \ -DSHARE_DIR=\"$(pkgdatadir)\" \ -DEXTENSIONS_DIR=\""$(libdir)/epiphany-$(EPIPHANY_MAJOR)/extensions"\" \ + -DLOADER_DIR=\""$(libdir)/epiphany-$(EPIPHANY_MAJOR)/loaders"\" \ -DDATADIR=\""$(datadir)"\" \ -DPIXMAP_DIR=\""$(datadir)/pixmaps"\" \ $(AM_CPPFLAGS) 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); |