Commit 69915aa7 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Implement a search path for GTK+ modules.

Sat Sep  8 16:19:02 2001  Owen Taylor  <otaylor@redhat.com>

 	* gtk/gtkmain.c: Implement a search path for GTK+ modules.

 	* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
 	in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
 	than in gtk-2.0/major.minor.micro/<type>/. This
 	works better for a search path for modules.

 	* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
 	gtk_binary_version variable holding major.minor.(micro-binary_age).

 	* modules/input/Makefile.am (moduledir): Fix installation
 	directory to match change in lookup location.

 	* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
 	suffixes. Needs to be handled in g_module_build_path().

	* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
	appropriate.
parent 13ff5903
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
Sat Sep 8 16:19:02 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c: Implement a search path for GTK+ modules.
* configure.in gtk/gtkrc.c gtk/Makefile.am: Look for modules
in gtk-2.0/<type>/major.minor.(micro-binary_age) rather
than in gtk-2.0/major.minor.micro/<type>/. This
works better for a search path for modules.
* gtk+-2.0.pc.in gtk+-2.0-uninstalled.pc.in: Add
gtk_binary_version variable holding major.minor.(micro-binary_age).
* modules/input/Makefile.am (moduledir): Fix installation
directory to match change in lookup location.
* gtk/gtkmain.c (gtk_init_check): Remove OS/2 code for dll
suffixes. Needs to be handled in g_module_build_path().
* gtk/gtkrc.c gtk/queryimmodules.c: Use g_build_filename() where
appropriate.
Tue Sep 11 13:59:12 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkrc.c (insert_rc_property): Fixed reversed comparison
......
......@@ -58,6 +58,12 @@ AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# Define a string for the earliest version that this release has
# binary compatibility with. This is used for module locations.
#
GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT
AC_SUBST(GTK_BINARY_VERSION)
#
# gdk-pixbuf gets versioned separately, and for now, using standard
# libtool versioning, not GTK+-style versioning
......
......@@ -678,3 +678,27 @@ gdk_x11_font_get_xfont (GdkFont *font)
return ((GdkFontPrivateX *)font)->xfont;
}
/**
* gdk_x11_font_get_name:
* @font: a #GdkFont.
*
* Return the X Logical Font Description (for font->type == GDK_FONT_FONT)
* or comma separated list of XLFDs (for font->type == GDK_FONT_FONTSET)
* that was used to load the font. If the same font was loaded
* via multiple names, which name is returned is undefined.
*
* Return value: the name of the font. This string is owned
* by GDK and must not be modified or freed.
**/
G_CONST_RETURN char *
gdk_x11_font_get_name (GdkFont *font)
{
GdkFontPrivateX *private = (GdkFontPrivateX *)font;
g_return_val_if_fail (font != NULL, NULL);
g_assert (private->names);
return private->names->data;
}
......@@ -125,8 +125,9 @@ gboolean gdk_net_wm_supports (GdkAtom property);
#ifndef GDK_DISABLE_DEPRECATED
Display *gdk_x11_font_get_xdisplay (GdkFont *font);
gpointer gdk_x11_font_get_xfont (GdkFont *font);
Display * gdk_x11_font_get_xdisplay (GdkFont *font);
gpointer gdk_x11_font_get_xfont (GdkFont *font);
G_CONST_RETURN char *gdk_x11_font_get_name (GdkFont *font);
#define GDK_FONT_XDISPLAY(font) (gdk_x11_font_get_xdisplay (font))
#define GDK_FONT_XFONT(font) (gdk_x11_font_get_xfont (font))
......
target=@gdktarget@
gtk_binary_version=@GTK_BINARY_VERSION@
Name: GTK+ Uninstalled
Description: GIMP Tool Kit (${target} target), Not Installed
Version: @VERSION@
......
......@@ -4,6 +4,8 @@ libdir=@libdir@
includedir=@includedir@
target=@gdktarget@
gtk_binary_version=@GTK_BINARY_VERSION@
Name: GTK+
Description: GIMP Tool Kit (${target} target)
Version: @VERSION@
......
......@@ -9,6 +9,7 @@ INCLUDES = @STRIP_BEGIN@ \
-DGTK_SYSCONFDIR=\"$(sysconfdir)\" \
-DGTK_LOCALEDIR=\"$(gtklocaledir)\" \
-DGTK_VERSION=\"@GTK_VERSION@\" \
-DGTK_BINARY_VERSION=\"@GTK_BINARY_VERSION@\" \
-DTESTGTK_RCFILE=\"`pwd`/$(srcdir)/testgtkrc\" \
-DG_DISABLE_CONST_RETURNS \
-I$(top_builddir)/gtk \
......
......@@ -39,6 +39,9 @@
#ifdef G_OS_UNIX
#include <unistd.h>
#endif
#include <pango/pango-utils.h> /* For pango_split_file_list */
#include "gtkdnd.h"
#include "gtkversion.h"
#include "gtkmain.h"
......@@ -174,23 +177,6 @@ gtk_check_version (guint required_major,
return NULL;
}
#ifdef __EMX__
static gchar *
add_dll_suffix (gchar *module_name)
{
gchar *suffix = strrchr (module_name, '.');
if (!suffix || stricmp(suffix, ".dll"))
{
gchar *old = module_name;
module_name = g_strconcat (module_name, ".dll", NULL);
g_free (old);
}
return (module_name);
}
#endif
#undef gtk_init_check
/* This checks to see if the process is running suid or sgid
......@@ -238,13 +224,145 @@ check_setugid (void)
return TRUE;
}
static gchar **
get_module_path (void)
{
gchar *module_path = g_getenv ("GTK_MODULE_PATH");
gchar *exe_prefix = g_getenv("GTK_EXE_PREFIX");
gchar **result;
gchar *default_dir;
if (exe_prefix)
default_dir = g_build_filename (exe_prefix, "lib", "gtk-2.0", "modules", NULL);
else
default_dir = g_build_filename (GTK_LIBDIR, "gtk-2.0", "modules", NULL);
module_path = g_strconcat (module_path ? module_path : "",
module_path ? G_SEARCHPATH_SEPARATOR_S : "",
default_dir, NULL);
result = pango_split_file_list (module_path);
g_free (default_dir);
g_free (module_path);
return result;
}
static GModule *
find_module (gchar **module_path,
const gchar *name)
{
GModule *module;
gchar *module_name;
gint i;
if (g_path_is_absolute (name))
return g_module_open (name, G_MODULE_BIND_LAZY);
for (i = 0; module_path[i]; i++)
{
gchar *version_directory;
version_directory = g_build_filename (module_path[i], GTK_BINARY_VERSION, NULL);
module_name = g_module_build_path (version_directory, name);
g_free (version_directory);
if (g_file_test (module_name, G_FILE_TEST_EXISTS))
{
g_free (module_name);
return g_module_open (module_name, G_MODULE_BIND_LAZY);
}
g_free (module_name);
module_name = g_module_build_path (module_path[i], name);
if (g_file_test (module_name, G_FILE_TEST_EXISTS))
{
g_free (module_name);
return g_module_open (module_name, G_MODULE_BIND_LAZY);
}
g_free (module_name);
}
/* As last resort, try loading without an absolute path (using system
* library path)
*/
module_name = g_module_build_path (NULL, name);
module = g_module_open (module_name, G_MODULE_BIND_LAZY);
g_free(module_name);
return module;
}
static GSList *
load_module (GSList *gtk_modules,
gchar **module_path,
const gchar *name)
{
GtkModuleInitFunc modinit_func = NULL;
GModule *module = NULL;
if (g_module_supported ())
{
module = find_module (module_path, name);
if (module &&
g_module_symbol (module, "gtk_module_init", (gpointer*) &modinit_func) &&
modinit_func)
{
if (!g_slist_find (gtk_modules, modinit_func))
{
g_module_make_resident (module);
gtk_modules = g_slist_prepend (gtk_modules, modinit_func);
}
else
{
g_module_close (module);
module = NULL;
}
}
}
if (!modinit_func)
{
g_message ("Failed to load module \"%s\": %s",
module ? g_module_name (module) : name,
g_module_error ());
if (module)
g_module_close (module);
}
return gtk_modules;
}
static GSList *
load_modules (const char *module_str)
{
gchar **module_path = get_module_path ();
gchar **module_names = pango_split_file_list (module_str);
GSList *gtk_modules = NULL;
gint i;
for (i = 0; module_names[i]; i++)
gtk_modules = load_module (gtk_modules, module_path, module_names[i]);
gtk_modules = g_slist_reverse (gtk_modules);
g_strfreev (module_names);
g_strfreev (module_path);
return gtk_modules;
}
gboolean
gtk_init_check (int *argc,
char ***argv)
{
GString *gtk_modules_string = NULL;
GSList *gtk_modules = NULL;
GSList *slist;
gchar *env_string = NULL;
gchar *env_string;
if (gtk_initialized)
return TRUE;
......@@ -280,24 +398,7 @@ gtk_init_check (int *argc,
env_string = getenv ("GTK_MODULES");
if (env_string)
{
gchar **modules, **as;
#ifndef __EMX__
modules = g_strsplit (env_string, G_SEARCHPATH_SEPARATOR_S, -1);
#else
modules = g_strsplit (env_string, ";", -1);
#endif
for (as = modules; *as; as++)
{
if (**as)
gtk_modules = g_slist_prepend (gtk_modules, *as);
else
g_free (*as);
}
g_free (modules);
env_string = NULL;
}
gtk_modules_string = g_string_new (env_string);
if (argc && argv)
{
......@@ -321,7 +422,14 @@ gtk_init_check (int *argc,
(*argv)[i] = NULL;
if (module_name && *module_name)
gtk_modules = g_slist_prepend (gtk_modules, g_strdup (module_name));
{
if (gtk_modules_string)
g_string_append_c (gtk_modules_string, G_SEARCHPATH_SEPARATOR);
else
gtk_modules_string = g_string_new (NULL);
g_string_append (gtk_modules_string, module_name);
}
}
else if (strcmp ("--g-fatal-warnings", (*argv)[i]) == 0)
{
......@@ -397,56 +505,12 @@ gtk_init_check (int *argc,
if (gtk_debug_flags & GTK_DEBUG_UPDATES)
gdk_window_set_debug_updates (TRUE);
/* load gtk modules */
gtk_modules = g_slist_reverse (gtk_modules);
for (slist = gtk_modules; slist; slist = slist->next)
if (gtk_modules_string)
{
gchar *module_name;
GModule *module = NULL;
GtkModuleInitFunc modinit_func = NULL;
module_name = slist->data;
slist->data = NULL;
#ifndef __EMX__
if (!g_path_is_absolute (module_name))
{
gchar *old = module_name;
module_name = g_module_build_path (NULL, module_name);
g_free (old);
}
#else
module_name = add_dll_suffix (module_name);
#endif
if (g_module_supported ())
{
module = g_module_open (module_name, G_MODULE_BIND_LAZY);
if (module &&
g_module_symbol (module, "gtk_module_init", (gpointer*) &modinit_func) &&
modinit_func)
{
if (!g_slist_find (gtk_modules, modinit_func))
{
g_module_make_resident (module);
slist->data = modinit_func;
}
else
{
g_module_close (module);
module = NULL;
}
}
}
if (!modinit_func)
{
g_message ("Failed to load module \"%s\": %s",
module ? g_module_name (module) : module_name,
g_module_error ());
if (module)
g_module_close (module);
}
g_free (module_name);
gtk_modules = load_modules (gtk_modules_string->str);
g_string_free (gtk_modules_string, TRUE);
}
#ifdef ENABLE_NLS
......
......@@ -324,11 +324,11 @@ gtk_rc_make_default_dir (const gchar *type)
#ifndef G_OS_WIN32
var = getenv("GTK_EXE_PREFIX");
if (var)
path = g_strconcat (var, "/lib/gtk-2.0/" GTK_VERSION "/", type, NULL);
path = g_build_filename (var, "lib", "gtk-2.0", type, GTK_BINARY_VERSION, NULL);
else
path = g_strconcat (GTK_LIBDIR "/gtk-2.0/" GTK_VERSION "/", type, NULL);
path = g_build_filename (GTK_LIBDIR, "gtk-2.0,", type, GTK_BINARY_VERSION, NULL);
#else
path = g_strconcat ("%s\\%s", get_themes_directory (), type);
path = g_build_filename (get_themes_directory (), type, NULL);
#endif
return path;
......@@ -361,9 +361,9 @@ gtk_rc_get_im_module_file (void)
result = g_strdup (im_module_file);
else
#ifndef G_OS_WIN32
result = g_strdup (GTK_SYSCONFDIR G_DIR_SEPARATOR_S "gtk-2.0" G_DIR_SEPARATOR_S "gtk.immodules");
result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL);
#else
result = g_strdup_printf ("%s\\gtk.immodules", g_win32_get_package_installation_directory (GETTEXT_PACKAGE, get_gtk_dll_name ()));
result = g_build_filename (g_win32_get_package_installation_directory (GETTEXT_PACKAGE, get_gtk_dll_name ()), "gtk.immodules", NULL);
#endif
}
......@@ -378,9 +378,9 @@ gtk_rc_get_theme_dir(void)
#ifndef G_OS_WIN32
var = getenv("GTK_DATA_PREFIX");
if (var)
path = g_strconcat (var, "/share/themes", NULL);
path = g_build_filename (var, "share", "themes", NULL);
else
path = g_strconcat (GTK_DATA_PREFIX, "/share/themes", NULL);
path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
#else
path = g_strdup (get_themes_directory ());
#endif
......@@ -408,30 +408,18 @@ gtk_rc_append_default_module_path(void)
#ifndef G_OS_WIN32
var = getenv("GTK_EXE_PREFIX");
if (var)
path = g_strconcat(var, "/lib/gtk-2.0/" GTK_VERSION "/engines", NULL);
path = g_build_filename (var, "lib", "gtk-2.0", GTK_VERSION, "engines", NULL);
else
path = g_strdup (GTK_LIBDIR "/gtk-2.0/" GTK_VERSION "/engines");
path = g_build_filename (GTK_LIBDIR, "gtk-2.0", GTK_VERSION, "engines", NULL);
#else
path = g_strconcat (get_themes_directory (), "\\engines", NULL);
path = g_build_filename (get_themes_directory (), "engines", NULL);
#endif
module_path[n++] = path;
var = g_get_home_dir ();
if (var)
{
gchar *sep;
/* Don't duplicate the directory separator, causes trouble at
* least on Windows.
*/
if (var[strlen (var) -1] != G_DIR_SEPARATOR)
sep = G_DIR_SEPARATOR_S;
else
sep = "";
/* This produces something like ~/.gtk-2.0/2.0/engines */
path = g_strconcat (var, sep,
".gtk-2.0" G_DIR_SEPARATOR_S
GTK_VERSION G_DIR_SEPARATOR_S
"engines", NULL);
path = g_build_filename (var, ".gtk-2.0", GTK_VERSION, "engines", NULL);
module_path[n++] = path;
}
module_path[n] = NULL;
......@@ -467,9 +455,9 @@ gtk_rc_add_initial_default_files (void)
else
{
#ifndef G_OS_WIN32
str = g_strdup (GTK_SYSCONFDIR G_DIR_SEPARATOR_S "gtk-2.0" G_DIR_SEPARATOR_S "gtkrc");
str = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtkrc", NULL);
#else
str = g_strdup_printf ("%s\\gtkrc", g_win32_get_package_installation_directory (GETTEXT_PACKAGE, get_gtk_dll_name ()));
str = g_build_filename (g_win32_get_package_installation_directory (GETTEXT_PACKAGE, get_gtk_dll_name ()), "gtkrc", NULL);
#endif
gtk_rc_add_default_file (str);
......@@ -478,12 +466,7 @@ gtk_rc_add_initial_default_files (void)
var = g_get_home_dir ();
if (var)
{
gchar *sep;
if (var[strlen (var) -1] != G_DIR_SEPARATOR)
sep = G_DIR_SEPARATOR_S;
else
sep = "";
str = g_strdup_printf ("%s%s.gtkrc-2.0", var, sep);
str = g_build_filename (var, ".gtkrc-2.0", NULL);
gtk_rc_add_default_file (str);
g_free (str);
}
......@@ -682,32 +665,18 @@ gtk_rc_parse_named (GtkRcContext *context,
gchar *subpath;
if (type)
subpath = g_strconcat (G_DIR_SEPARATOR_S "gtk-2.0-",
type,
subpath = g_strconcat ("gtk-2.0-", type,
G_DIR_SEPARATOR_S "gtkrc",
NULL);
else
subpath = g_strdup (G_DIR_SEPARATOR_S "gtk-2.0" G_DIR_SEPARATOR_S "gtkrc");
subpath = g_strdup ("gtk-2.0" G_DIR_SEPARATOR_S "gtkrc");
/* First look in the users home directory
*/
home_dir = g_get_home_dir ();
if (home_dir)
{
gchar *sep;
/* Don't duplicate the directory separator, causes trouble at
* least on Windows.
*/
if (home_dir[strlen (home_dir) -1] != G_DIR_SEPARATOR)
sep = G_DIR_SEPARATOR_S;
else
sep = "";
path = g_strconcat (home_dir, sep,
".themes" G_DIR_SEPARATOR_S ,
name,
subpath,
NULL);
path = g_build_filename (home_dir, ".themes", name, subpath, NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS))
{
g_free (path);
......@@ -715,10 +684,10 @@ gtk_rc_parse_named (GtkRcContext *context,
}
}
if (!name)
if (!path)
{
gchar *theme_dir = gtk_rc_get_theme_dir ();
gchar *path = g_strconcat (theme_dir, G_DIR_SEPARATOR_S, name, subpath);
path = g_build_filename (theme_dir, name, subpath, NULL);
g_free (theme_dir);
if (!g_file_test (path, G_FILE_TEST_EXISTS))
......@@ -887,18 +856,11 @@ gtk_rc_parse_file (GtkRcContext *context,
rc_file->canonical_name = rc_file->name;
else
{
GString *str;
gchar *cwd;
cwd = g_get_current_dir ();
str = g_string_new (cwd);
rc_file->canonical_name = g_build_filename (cwd, rc_file->name, NULL);
g_free (cwd);
g_string_append_c (str, G_DIR_SEPARATOR);
g_string_append (str, rc_file->name);
rc_file->canonical_name = str->str;
g_string_free (str, FALSE);
}
}
......@@ -2740,7 +2702,7 @@ gtk_rc_check_pixmap_dir (const gchar *dir, const gchar *pixmap_file)
gchar *buf;
gint fd;
buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", dir, pixmap_file);
buf = g_build_filename (dir, pixmap_file, NULL);
fd = open (buf, O_RDONLY);
if (fd >= 0)
......@@ -2814,8 +2776,7 @@ gtk_rc_find_module_in_path (const gchar *module_file)
for (i = 0; (i < GTK_RC_MAX_MODULE_PATHS) && (module_path[i] != NULL); i++)
{
buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
module_path[i], module_file);
buf = g_build_filename (module_path[i], module_file, NULL);
fd = open (buf, O_RDONLY);
if (fd >= 0)
......
......@@ -65,10 +65,10 @@ query_module (const char *dir, const char *name)
gchar *path;
gboolean error = FALSE;
if (name[0] == G_DIR_SEPARATOR)
if (g_path_is_absolute (name))
path = g_strdup (name);
else
path = g_strconcat (dir, G_DIR_SEPARATOR_S, name, NULL);
path = g_build_filename (dir, name, NULL);
module = g_module_open (path, 0);
......
......@@ -22,7 +22,7 @@ LDADDS = @STRIP_BEGIN@ \
@GTK_DEP_LIBS@ \
@STRIP_END@
moduledir = $(libdir)/gtk-2.0/$(GTK_VERSION)/immodules
moduledir = $(libdir)/gtk-2.0/immodules/$(GTK_BINARY_VERSION)
im_xim_la_LDFLAGS = -rpath $(moduledir) -avoid-version -module
im_xim_la_SOURCES = \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment