forked from AuroraMiddleware/gtk
Move the module cache files below libdir
These files contain architecture-dependent paths, and thus placing them into sysconfdir causes unnecessary hassle. Now the immodule cache file is looked for in libdir/gtk-2.0/2.10.0/immodules.cache. Belated backport of a change that was done in the run-up to 3.0.
This commit is contained in:
parent
602b44020a
commit
c884904686
@ -34,6 +34,12 @@ module path.
|
||||
If called with arguments, it looks for the specified modules. The arguments
|
||||
may be absolute or relative paths.
|
||||
</para>
|
||||
<para>
|
||||
Normally, the output of <command>gtk-query-immodules-2.0</command> is written
|
||||
to <filename><replaceable>libdir</replaceable>/gtk-2.0/2.10.0/immodules.cache</filename>, where GTK+ looks for it by default. If it is written to some other
|
||||
location, the environment variable <link linkend="GTK_IM_MODULE_FILE"><envar>GTK_IM_MODULE_FILE</envar></link>
|
||||
can be set to point GTK+ at the file.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Environment</title>
|
||||
|
@ -274,11 +274,10 @@ additional environment variables.
|
||||
|
||||
<para>
|
||||
Specifies the file listing the IM modules to load. This environment
|
||||
variable overrides the <literal>im_module_file</literal> specified in
|
||||
the RC files, which in turn overrides the default value
|
||||
<filename><replaceable>sysconfdir</replaceable>/gtk-2.0/gtk.immodules</filename>
|
||||
(<replaceable>sysconfdir</replaceable> is the sysconfdir specified when GTK+ was configured,
|
||||
usually <filename>/usr/local/etc</filename>.)
|
||||
variable overrides the <literal>im_module_file</literal> specified in
|
||||
the RC files, which in turn overrides the default value
|
||||
<filename><replaceable>libdir</replaceable>/gtk-2.0/2.10.0/immodules.cache</filename>
|
||||
(<replaceable>libdir</replaceable> has the same meaning here as explained for <envar>GTK_PATH</envar>).
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
|
@ -450,7 +450,7 @@ gtk_rc_get_im_module_file (void)
|
||||
if (im_module_file)
|
||||
result = g_strdup (im_module_file);
|
||||
else
|
||||
result = g_build_filename (GTK_SYSCONFDIR, "gtk-2.0", "gtk.immodules", NULL);
|
||||
result = gtk_rc_make_default_dir ("immodules.cache");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* GTK+
|
||||
* querymodules.c:
|
||||
*
|
||||
* Copyright (C) 2000 Red Hat Software
|
||||
* Copyright (C) 2000-2013 Red Hat Software
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@ -10,7 +10,7 @@
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
@ -49,28 +49,28 @@ escape_string (const char *str)
|
||||
while (TRUE)
|
||||
{
|
||||
char c = *str++;
|
||||
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\0':
|
||||
goto done;
|
||||
case '\n':
|
||||
g_string_append (result, "\\n");
|
||||
break;
|
||||
case '\"':
|
||||
g_string_append (result, "\\\"");
|
||||
break;
|
||||
{
|
||||
case '\0':
|
||||
goto done;
|
||||
case '\n':
|
||||
g_string_append (result, "\\n");
|
||||
break;
|
||||
case '\"':
|
||||
g_string_append (result, "\\\"");
|
||||
break;
|
||||
#ifdef G_OS_WIN32
|
||||
/* Replace backslashes in path with forward slashes, so that
|
||||
* it reads in without problems.
|
||||
*/
|
||||
case '\\':
|
||||
g_string_append (result, "/");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_string_append_c (result, c);
|
||||
}
|
||||
/* Replace backslashes in path with forward slashes, so that
|
||||
* it reads in without problems.
|
||||
*/
|
||||
case '\\':
|
||||
g_string_append (result, "/");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_string_append_c (result, c);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
@ -89,7 +89,7 @@ static gboolean
|
||||
query_module (const char *dir, const char *name)
|
||||
{
|
||||
void (*list) (const GtkIMContextInfo ***contexts,
|
||||
guint *n_contexts);
|
||||
guint *n_contexts);
|
||||
void (*init) (GTypeModule *type_module);
|
||||
void (*exit) (void);
|
||||
GtkIMContext *(*create) (const gchar *context_id);
|
||||
@ -107,7 +107,7 @@ query_module (const char *dir, const char *name)
|
||||
path = g_strdup (name);
|
||||
else
|
||||
path = g_build_filename (dir, name, NULL);
|
||||
|
||||
|
||||
module = g_module_open (path, 0);
|
||||
|
||||
if (!module)
|
||||
@ -115,7 +115,7 @@ query_module (const char *dir, const char *name)
|
||||
g_fprintf (stderr, "Cannot load module %s: %s\n", path, g_module_error());
|
||||
error = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (module &&
|
||||
g_module_symbol (module, "im_module_list", &list_ptr) &&
|
||||
g_module_symbol (module, "im_module_init", &init_ptr) &&
|
||||
@ -137,20 +137,20 @@ query_module (const char *dir, const char *name)
|
||||
(*list) (&contexts, &n_contexts);
|
||||
|
||||
for (i=0; i<n_contexts; i++)
|
||||
{
|
||||
print_escaped (contexts[i]->context_id);
|
||||
print_escaped (contexts[i]->context_name);
|
||||
print_escaped (contexts[i]->domain);
|
||||
print_escaped (contexts[i]->domain_dirname);
|
||||
print_escaped (contexts[i]->default_locales);
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
{
|
||||
print_escaped (contexts[i]->context_id);
|
||||
print_escaped (contexts[i]->context_name);
|
||||
print_escaped (contexts[i]->domain);
|
||||
print_escaped (contexts[i]->domain_dirname);
|
||||
print_escaped (contexts[i]->default_locales);
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_fprintf (stderr, "%s does not export GTK+ IM module API: %s\n", path,
|
||||
g_module_error ());
|
||||
g_module_error ());
|
||||
error = TRUE;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ query_module (const char *dir, const char *name)
|
||||
g_module_close (module);
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
@ -169,14 +169,14 @@ int main (int argc, char **argv)
|
||||
gboolean error = FALSE;
|
||||
|
||||
g_printf ("# GTK+ Input Method Modules file\n"
|
||||
"# Automatically generated file, do not edit\n"
|
||||
"# Created by %s from gtk+-%d.%d.%d\n"
|
||||
"#\n",
|
||||
argv[0],
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
"# Automatically generated file, do not edit\n"
|
||||
"# Created by %s from gtk+-%d.%d.%d\n"
|
||||
"#\n",
|
||||
argv[0],
|
||||
GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
|
||||
|
||||
|
||||
if (argc == 1) /* No arguments given */
|
||||
if (argc == 1) /* No arguments given */
|
||||
{
|
||||
char **dirs;
|
||||
int i;
|
||||
@ -189,22 +189,22 @@ int main (int argc, char **argv)
|
||||
dirs = pango_split_file_list (path);
|
||||
dirs_done = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
|
||||
|
||||
for (i=0; dirs[i]; i++)
|
||||
for (i = 0; dirs[i]; i++)
|
||||
if (!g_hash_table_lookup (dirs_done, dirs[i]))
|
||||
{
|
||||
GDir *dir = g_dir_open (dirs[i], 0, NULL);
|
||||
if (dir)
|
||||
{
|
||||
const char *dent;
|
||||
GDir *dir = g_dir_open (dirs[i], 0, NULL);
|
||||
if (dir)
|
||||
{
|
||||
const char *dent;
|
||||
|
||||
while ((dent = g_dir_read_name (dir)))
|
||||
{
|
||||
if (g_str_has_suffix (dent, SOEXT))
|
||||
error |= query_module (dirs[i], dent);
|
||||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
}
|
||||
while ((dent = g_dir_read_name (dir)))
|
||||
{
|
||||
if (g_str_has_suffix (dent, SOEXT))
|
||||
error |= query_module (dirs[i], dent);
|
||||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
}
|
||||
|
||||
g_hash_table_insert (dirs_done, dirs[i], GUINT_TO_POINTER (TRUE));
|
||||
}
|
||||
@ -214,12 +214,12 @@ int main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
cwd = g_get_current_dir ();
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
error |= query_module (cwd, argv[i]);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
error |= query_module (cwd, argv[i]);
|
||||
|
||||
g_free (cwd);
|
||||
}
|
||||
|
||||
|
||||
return error ? 1 : 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user