aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-04 01:12:31 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-04 01:12:31 +0800
commit61e3a5c5501f9d0789fcd9565fd934e84e6262dc (patch)
treecae5ada8d5ab127d1d8002126659ddf26a0c317b
parent9361618f18ff024b4913e2a6987920d510b8499d (diff)
downloadgsoc2013-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.
-rw-r--r--ChangeLog11
-rw-r--r--data/epiphany-1.6.pc.in1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/ephy-extensions-manager.c49
4 files changed, 60 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cf2eab7bf..5a39563c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);