forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
de2332ee9a
commit
ba7a95175b
@ -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 ===
|
||||
|
@ -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) \
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user