Add support for loading gtk2-only modules

Introduce GTK2_MODULES environment variable for modules that don't work
in gtk3. The list of modules is now $GTK2_MODULES:$GTK_MODULES.

https://bugzilla.gnome.org/show_bug.cgi?id=743917
This commit is contained in:
Lars Uebernickel
2015-02-03 11:21:59 +01:00
committed by Lars Uebernickel
parent e48ae6f85b
commit 436fe38cae
2 changed files with 24 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ some additional commandline options.
<para>
A list of modules to load in addition to those specified in the
<envar>GTK_MODULES</envar> environment variable and the
<envar>GTK2_MODULES</envar> environment variable and the
<literal>gtk-modules</literal> setting.
</para>
</formalpara>
@@ -196,14 +196,24 @@ additional environment variables.
</formalpara>
<formalpara>
<title><envar>GTK_MODULES</envar></title>
<title><envar>GTK2_MODULES</envar></title>
<para>
A list of modules to load. Note that GTK+ also allows to specify modules to load via a commandline option (<option>--gtk-module</option>) and with the <literal>gtk-modules</literal> setting.
</para>
</formalpara>
<formalpara>
<title><envar>GTK_MODULES</envar></title>
<para>
A list of modules to load in addition to the ones in the <envar>GTK_MODULES</envar> variable.
</para>
<warning>
Note that this environment variable is read by GTK+ 3 too,
which may not have the same set of modules available for loading.
Use <envar>GTK2_MODULES</envar> for modules that are only compatible
with GTK+ 2.
</warning>
</formalpara>

View File

@@ -690,9 +690,20 @@ do_pre_parse_initialization (int *argc,
}
#endif /* G_ENABLE_DEBUG */
env_string = g_getenv ("GTK_MODULES");
env_string = g_getenv ("GTK2_MODULES");
if (env_string)
gtk_modules_string = g_string_new (env_string);
env_string = g_getenv ("GTK_MODULES");
if (env_string)
{
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, env_string);
}
}
static void