summaryrefslogtreecommitdiff
path: root/gdk-pixbuf
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2004-03-15 13:07:04 +0000
committerTor Lillqvist <tml@src.gnome.org>2004-03-15 13:07:04 +0000
commitba7a95175bc33b37642a198dd6d7642c331f9002 (patch)
tree629fbfcb889249b3c3538391394664b1c3cb4e22 /gdk-pixbuf
parentde2332ee9afc4b2abc278497021923206b74bd74 (diff)
downloadgtk+-ba7a95175bc33b37642a198dd6d7642c331f9002.tar.gz
Merges from stable branch that had been left out. (#136282, J. Ali Harlow)
2004-03-15 Tor Lillqvist <tml@iki.fi> Merges from stable branch that had been left out. (#136282, J. Ali Harlow) Changes for run-time lookup of installation location on Win32: * Makefile.am (INCLUDES): Define GTK_PREFIX as $(prefix). * gdk-pixbuf-io.c (get_sysconfdir): New function, look up installation location at runtime and deduce GTK_SYSCONFDIR from it. (get_toplevel): Similar, for the top-level installation directory. (correct_prefix): Replace compile-time prefix with run-time prefix. (get_libdir): Remove, not used any longer. (gdk_pixbuf_io_init): Call correct_prefix() on Win32. * queryloaders.c (query_module): [Win32] Change backslahses into slashes in path.
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r--gdk-pixbuf/ChangeLog21
-rw-r--r--gdk-pixbuf/Makefile.am1
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c79
-rw-r--r--gdk-pixbuf/queryloaders.c13
4 files changed, 91 insertions, 23 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 5382c771a1..7d2a06bef8 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,24 @@
+2004-03-15 Tor Lillqvist <tml@iki.fi>
+
+ Merges from stable branch that had been left out. (#136282, J. Ali
+ Harlow)
+
+ Changes for run-time lookup of installation location on Win32:
+
+ * Makefile.am (INCLUDES): Define GTK_PREFIX as $(prefix).
+
+ * gdk-pixbuf-io.c (get_sysconfdir): New function, look up
+ installation location at runtime and deduce GTK_SYSCONFDIR
+ from it.
+ (get_toplevel): Similar, for the top-level installation directory.
+ (correct_prefix): Replace compile-time prefix with run-time
+ prefix.
+ (get_libdir): Remove, not used any longer.
+ (gdk_pixbuf_io_init): Call correct_prefix() on Win32.
+
+ * queryloaders.c (query_module): [Win32] Change backslahses into
+ slashes in path.
+
Tue Mar 9 09:33:28 2004 Owen Taylor <otaylor@redhat.com>
* === Released 2.3.6 ===
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index 9b1d5b512f..562a53e40b 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -261,6 +261,7 @@ INCLUDES = \
-DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \
-DG_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_PREFIX=\"$(prefix)\" \
$(INCLUDED_LOADER_DEFINE) \
$(GTK_DEBUG_FLAGS) \
$(GDK_PIXBUF_DEP_CFLAGS) \
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 92ddb55b68..b916421d05 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -170,6 +170,59 @@ skip_space (const char **pos)
return !(*p == '\0');
}
+#ifdef G_OS_WIN32
+
+/* DllMain function needed to tuck away the gdk-pixbuf DLL name */
+G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
+
+static char *
+get_toplevel (void)
+{
+ static char *toplevel = NULL;
+
+ if (toplevel == NULL)
+ toplevel = g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "");
+
+ return toplevel;
+}
+
+static char *
+get_sysconfdir (void)
+{
+ static char *sysconfdir = NULL;
+
+ if (sysconfdir == NULL)
+ sysconfdir = g_win32_get_package_installation_subdirectory
+ (GETTEXT_PACKAGE, dll_name, "etc");
+
+ return sysconfdir;
+}
+
+#undef GTK_SYSCONFDIR
+#define GTK_SYSCONFDIR get_sysconfdir()
+
+static void
+correct_prefix (gchar **path)
+{
+ if (strncmp (*path, GTK_PREFIX "/", strlen (GTK_PREFIX "/")) == 0 ||
+ strncmp (*path, GTK_PREFIX "\\", strlen (GTK_PREFIX "\\")) == 0)
+ {
+ /* This is an entry put there by gdk-pixbuf-query-loaders on the
+ * packager's system. On Windows a prebuilt GTK+ package can be
+ * installed in a random location. The gdk-pixbuf.loaders file
+ * distributed in such a package contains paths from the package
+ * builder's machine. Replace the build-time prefix with the
+ * installation prefix on this machine.
+ */
+ gchar *tem = *path;
+ *path = g_strconcat (get_toplevel (), tem + strlen (GTK_PREFIX), NULL);
+ g_free (tem);
+ }
+}
+
+#endif
+
static gchar *
gdk_pixbuf_get_module_file (void)
{
@@ -214,6 +267,9 @@ gdk_pixbuf_io_init ()
/* Blank line marking the end of a module
*/
if (module && *p != '#') {
+#ifdef G_OS_WIN32
+ correct_prefix (&module->module_path);
+#endif
file_formats = g_slist_prepend (file_formats, module);
module = NULL;
}
@@ -336,29 +392,6 @@ gdk_pixbuf_io_init ()
g_free (filename);
}
-#ifdef G_OS_WIN32
-
-/* DllMain function needed to tuck away the gdk-pixbuf DLL name */
-
-G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
-
-static char *
-get_libdir (void)
-{
- static char *libdir = NULL;
-
- if (libdir == NULL)
- libdir = g_win32_get_package_installation_subdirectory
- (GETTEXT_PACKAGE, dll_name, "lib\\gtk-2.0\\" GTK_BINARY_VERSION "\\loaders");
-
- return libdir;
-}
-
-#undef PIXBUF_LIBDIR
-#define PIXBUF_LIBDIR get_libdir ()
-
-#endif
-
/* actually load the image handler - gdk_pixbuf_get_module only get a */
/* reference to the module to load, it doesn't actually load it */
/* perhaps these actions should be combined in one function */
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
index f5428f30da..e2f6bfc910 100644
--- a/gdk-pixbuf/queryloaders.c
+++ b/gdk-pixbuf/queryloaders.c
@@ -162,6 +162,19 @@ query_module (const char *dir, const char *file)
GdkPixbufFormat *info;
GdkPixbufModule *vtable;
+#ifdef G_OS_WIN32
+ /* Replace backslashes in path with forward slashes, so that
+ * it reads in without problems.
+ */
+ {
+ char *p = path;
+ while (*p) {
+ if (*p == '\\')
+ *p = '/';
+ p++;
+ }
+ }
+#endif
info = g_new0 (GdkPixbufFormat, 1);
vtable = g_new0 (GdkPixbufModule, 1);