[gtk+/gtk-2-24] Add support for loading gtk2-only modules



commit 436fe38cae8f035f737aad28781183a0becdcec9
Author: Lars Uebernickel <lars uebernic de>
Date:   Tue Feb 3 11:21:59 2015 +0100

    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

 docs/reference/gtk/running.sgml |   14 ++++++++++++--
 gtk/gtkmain.c                   |   13 ++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index 74720c1..1721ba2 100644
--- a/docs/reference/gtk/running.sgml
+++ b/docs/reference/gtk/running.sgml
@@ -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>
 
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index d6686f9..4fb791d 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]