commit 5e77ca7f845aebda23d30d5d349c1aaf825392e6
Author: Ray Strode <rstrode@redhat.com>
Date:   Sun Jul 13 01:29:41 2008 -0400

    Move set_gtk_module call to before starting the registry

diff --git a/ChangeLog b/ChangeLog
index 09606dc..e852e52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-13  Ray Strode  <halfline@gnome.org>
+
+	* compat/at-spi-registryd-wrapper.c (main):
+	Move set_gtk_module call to before starting the
+	registry
+
 2008-06-25  Lucas Rocha  <lucasr@gnome.org>
 
 	*  gnome-session/logout.c (gsm_logout_get_dialog): check if VT is
diff --git a/compat/at-spi-registryd-wrapper.c b/compat/at-spi-registryd-wrapper.c
index aee269f..aaf1ab3 100644
--- a/compat/at-spi-registryd-wrapper.c
+++ b/compat/at-spi-registryd-wrapper.c
@@ -142,6 +142,8 @@ main (int argc, char **argv)
   gdk_window_set_events (root, GDK_PROPERTY_CHANGE_MASK);
   gdk_window_add_filter (root, registry_ior_watch, NULL);
 
+  set_gtk_modules (gsm);
+
   if (!g_spawn_command_line_async (AT_SPI_REGISTRYD_DIR "/at-spi-registryd", &error))
     {
       show_error (gsm);
@@ -152,7 +154,6 @@ main (int argc, char **argv)
 
   gdk_window_remove_filter (root, registry_ior_watch, NULL);
 
-  set_gtk_modules (gsm);
   g_object_unref (gsm);
 
   return 0;

commit a3e22a74e5b0caf7e0ccd17fa84e8ef3eb2a24e9
Author: Ray Strode <rstrode@redhat.com>
Date:   Sun Jul 13 01:37:20 2008 -0400

    Add new gsm_util_setenv utility function to push environment
    changes to the session bus daemon

diff --git a/ChangeLog b/ChangeLog
index e852e52..6f35e6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2008-07-13  Ray Strode  <halfline@gnome.org>
 
+	* gnome-session/util.c
+	(gsm_util_update_activation_environment), (gsm_util_setenv):
+	New functions to push environment changes up to the
+	session bus daemon.
+	* gnome-session/dbus.c (gsm_dbus_server_setenv):
+	* gnome-session/main.c (main):
+	* gnome-session/xsmp.c (gsm_xsmp_init):
+	Use gsm_util_setenv instead of g_setenv.
+
+2008-07-13  Ray Strode  <halfline@gnome.org>
+
 	* compat/at-spi-registryd-wrapper.c (main):
 	Move set_gtk_module call to before starting the
 	registry
diff --git a/gnome-session/dbus.c b/gnome-session/dbus.c
index 0cd01c9..cd605a7 100644
--- a/gnome-session/dbus.c
+++ b/gnome-session/dbus.c
@@ -236,7 +236,8 @@ gsm_dbus_server_setenv (GsmDBusServer  *dbus,
       return FALSE;
     }
 
-  g_setenv (variable, value, TRUE);
+  gsm_util_setenv (variable, value);
+
   return TRUE;
 }
 
diff --git a/gnome-session/main.c b/gnome-session/main.c
index 0d06f31..4543084 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -112,7 +112,7 @@ main (int argc, char **argv)
    * was specified on the command line.
    */
   display_str = gdk_get_display ();
-  g_setenv ("DISPLAY", display_str, TRUE);
+  gsm_util_setenv ("DISPLAY", display_str);
   g_free (display_str);
 
   /* Start up gconfd and dbus-daemon (in parallel) if they're not
diff --git a/gnome-session/util.c b/gnome-session/util.c
index 6810007..d6e52ed 100644
--- a/gnome-session/util.c
+++ b/gnome-session/util.c
@@ -26,6 +26,8 @@
 #include <gtk/gtkmain.h>
 #include <gtk/gtkmessagedialog.h>
 
+#include <dbus/dbus-glib.h>
+
 #include "util.h"
 
 gchar **
@@ -109,3 +111,75 @@ gsm_util_text_is_blank (const gchar *str)
 
   return TRUE;
 }
+
+static gboolean
+gsm_util_update_activation_environment (const char  *variable,
+					const char  *value,
+					GError     **error)
+{
+  DBusGConnection *dbus_connection;
+  DBusGProxy      *bus_proxy;
+  GHashTable      *environment;
+  gboolean         environment_updated;
+
+  environment_updated = FALSE;
+  bus_proxy = NULL;
+  environment = NULL;
+
+  dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
+
+  if (dbus_connection == NULL)
+    return FALSE;
+
+  bus_proxy = dbus_g_proxy_new_for_name_owner (dbus_connection,
+                                               DBUS_SERVICE_DBUS,
+                                               DBUS_PATH_DBUS,
+                                               DBUS_INTERFACE_DBUS,
+                                               error);
+
+  if (bus_proxy == NULL)
+    goto out;
+
+  environment = g_hash_table_new (g_str_hash, g_str_equal);
+
+  g_hash_table_insert (environment, (void *) variable, (void *) value);
+
+  if (!dbus_g_proxy_call (bus_proxy,
+                          "UpdateActivationEnvironment", error,
+                          DBUS_TYPE_G_STRING_STRING_HASHTABLE,
+                          environment, G_TYPE_INVALID,
+                          G_TYPE_INVALID))
+    goto out;
+
+  environment_updated = TRUE;
+
+out:
+
+  if (bus_proxy != NULL)
+    g_object_unref (bus_proxy);
+
+  if (environment != NULL)
+    g_hash_table_destroy (environment);
+
+  return environment_updated;
+}
+
+void
+gsm_util_setenv (const char *variable,
+                 const char *value)
+{
+  GError *bus_error;
+
+  g_setenv (variable, value, TRUE);
+
+  bus_error = NULL;
+
+  /* If this fails it isn't fatal, it means some things like session
+   * management and keyring won't work in activated clients.
+   */
+  if (!gsm_util_update_activation_environment (variable, value, &bus_error))
+    {
+      g_warning ("Could not make bus activated clients aware of %s=%s environment variable: %s", variable, value, bus_error->message);
+      g_error_free (bus_error);
+    }
+}
diff --git a/gnome-session/util.h b/gnome-session/util.h
index ed76843..2016a60 100644
--- a/gnome-session/util.h
+++ b/gnome-session/util.h
@@ -28,6 +28,9 @@ gchar**   gsm_util_get_autostart_dirs   (void);
 
 gboolean  gsm_util_text_is_blank        (const char *str);
 
+void      gsm_util_setenv               (const char *variable,
+                                         const char *value);
+
 G_END_DECLS
 
 #endif /* __GSM_UTIL_H__ */
diff --git a/gnome-session/xsmp.c b/gnome-session/xsmp.c
index e7e9b6d..b6c410e 100644
--- a/gnome-session/xsmp.c
+++ b/gnome-session/xsmp.c
@@ -186,7 +186,7 @@ gsm_xsmp_init (void)
 
   network_id_list = IceComposeNetworkIdList (num_local_xsmp_sockets,
 					     xsmp_sockets);
-  g_setenv ("SESSION_MANAGER", network_id_list, TRUE);
+  gsm_util_setenv ("SESSION_MANAGER", network_id_list);
   g_debug ("SESSION_MANAGER=%s\n", network_id_list);
   free (network_id_list);
 }

commit 2948eca1f81d34f901e43184ea176394025707b1
Author: Ray Strode <rstrode@redhat.com>
Date:   Sun Jul 13 01:41:07 2008 -0400

    start gconf after starting dbus, since gconf uses dbus

diff --git a/gnome-session/main.c b/gnome-session/main.c
index 4543084..2fc3392 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -119,15 +119,15 @@ main (int argc, char **argv)
    * already running. This requires us to initialize XSMP too, because
    * we want $SESSION_MANAGER to be set before launching dbus-daemon.
    */
-  gsm_gconf_init ();
   gsm_xsmp_init ();
   gsm_dbus_init ();
+  gsm_gconf_init ();
 
   /* Now make sure they succeeded. (They'll call
    * gsm_initialization_error() if they failed.)
    */
-  gsm_gconf_check ();
   gsm_dbus_check ();
+  gsm_gconf_check ();
 
   global_session = gsm_session_new (failsafe);
 
