summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-09-11 20:24:40 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-09-11 20:24:40 +0000
commit69915aa7104beebdcfbc6d42592481843069c403 (patch)
tree933c4c9172a34de05399eb080a541c0bd6254979
parent13ff590365e84e5470c72bf42bab98177fbc167f (diff)
downloadgtk+-69915aa7104beebdcfbc6d42592481843069c403.tar.gz
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.
-rw-r--r--ChangeLog21
-rw-r--r--ChangeLog.pre-2-021
-rw-r--r--ChangeLog.pre-2-1021
-rw-r--r--ChangeLog.pre-2-221
-rw-r--r--ChangeLog.pre-2-421
-rw-r--r--ChangeLog.pre-2-621
-rw-r--r--ChangeLog.pre-2-821
-rw-r--r--configure.in6
-rw-r--r--gdk/x11/gdkfont-x11.c24
-rw-r--r--gdk/x11/gdkx.h5
-rw-r--r--gtk+-2.0-uninstalled.pc.in2
-rw-r--r--gtk+-2.0.pc.in2
-rw-r--r--gtk/Makefile.am1
-rw-r--r--gtk/gtkmain.c234
-rw-r--r--gtk/gtkrc.c83
-rw-r--r--gtk/queryimmodules.c4
-rw-r--r--modules/input/Makefile.am2
17 files changed, 359 insertions, 151 deletions
diff --git a/ChangeLog b/ChangeLog
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,24 @@
+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
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index d2f54bb003..af7b9d9cb6 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,24 @@
+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
diff --git a/configure.in b/configure.in
index 59beb590dc..4f1ee278a8 100644
--- a/configure.in
+++ b/configure.in
@@ -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
diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c
index efec6f2c43..1115c011ba 100644
--- a/gdk/x11/gdkfont-x11.c
+++ b/gdk/x11/gdkfont-x11.c
@@ -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;
+}
+
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index 00b57f4a1e..2f61dfdc3b 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -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))
diff --git a/gtk+-2.0-uninstalled.pc.in b/gtk+-2.0-uninstalled.pc.in
index 48adef3158..4a8dd2f6eb 100644
--- a/gtk+-2.0-uninstalled.pc.in
+++ b/gtk+-2.0-uninstalled.pc.in
@@ -1,5 +1,7 @@
target=@gdktarget@
+gtk_binary_version=@GTK_BINARY_VERSION@
+
Name: GTK+ Uninstalled
Description: GIMP Tool Kit (${target} target), Not Installed
Version: @VERSION@
diff --git a/gtk+-2.0.pc.in b/gtk+-2.0.pc.in
index 4c6c1bcb0c..97bd6e649b 100644
--- a/gtk+-2.0.pc.in
+++ b/gtk+-2.0.pc.in
@@ -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@
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 42ebc87561..4bd9f48b85 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -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 \
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index f23031eef5..9eeebb7ed4 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 672f76efc0..c83f0b1cde 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -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)
diff --git a/gtk/queryimmodules.c b/gtk/queryimmodules.c
index ff4987b2ea..d60b3661e5 100644
--- a/gtk/queryimmodules.c
+++ b/gtk/queryimmodules.c
@@ -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);
diff --git a/modules/input/Makefile.am b/modules/input/Makefile.am
index 9d6cf304d2..5f9fbf8946 100644
--- a/modules/input/Makefile.am
+++ b/modules/input/Makefile.am
@@ -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 = \