[at-spi] Make AT-SPI/CORBA the default and relocate AT-SPI/D-Bus.



commit 57bc7eaab4f1e549a032d5e5abf937252d7d1820
Author: Willie Walker <walker willie gmail com>
Date:   Fri Feb 5 14:05:05 2010 -0500

    Make AT-SPI/CORBA the default and relocate AT-SPI/D-Bus.

 at-spi.schemas.in         |    2 +-
 configure.in              |    2 +-
 pyatspi/__init__.py.in    |   33 ++++++++++++++++++++-------------
 registryd/Makefile.am     |    7 -------
 registryd/registry-main.c |   18 +++++++++++++++---
 5 files changed, 37 insertions(+), 25 deletions(-)
---
diff --git a/at-spi.schemas.in b/at-spi.schemas.in
index 2fffdb9..4f415f3 100644
--- a/at-spi.schemas.in
+++ b/at-spi.schemas.in
@@ -21,7 +21,7 @@ support.</long>
       <default>false</default>
       <locale name="C">
         <short>Enable CORBA-based AT-SPI infrastructure</short>
-        <long>In combination with /desktop/gnome/interface/accessibility, this key is needed to enable the CORBA-based AT-SPI infrastructure.  Otherwise, the D-Bus AT-SPI infrastructure will be used.</long>
+        <long>In combination with /desktop/gnome/interface/accessibility, this key is needed to enable the CORBA-based AT-SPI infrastructure if the CORBA-based AT-SPI infrastructure has been relocated.  It is ignored if the CORBA-based AT-SPI infrastructure has not been relocated.</long>
       </locale>
     </schema>
   </schemalist>
diff --git a/configure.in b/configure.in
index 5426167..a7950fe 100644
--- a/configure.in
+++ b/configure.in
@@ -211,7 +211,7 @@ if test x$enable_sm = xyes ; then
 	AC_SUBST(SM_LIBS)
 fi
 
-AC_ARG_ENABLE(relocate, [  --enable-relocate  Relocate to coexist with D-Bus [default=yes]], enable_relocate="$enableval", enable_relocate=yes)
+AC_ARG_ENABLE(relocate, [  --enable-relocate  Relocate to coexist with D-Bus [default=no]], enable_relocate="$enableval", enable_relocate=no)
 if test x$enable_relocate = xyes ; then
 	AC_DEFINE(RELOCATE, , [Relocate to coexist with D-Bus])
 fi
diff --git a/pyatspi/__init__.py.in b/pyatspi/__init__.py.in
index 87adb8a..aed0d8e 100644
--- a/pyatspi/__init__.py.in
+++ b/pyatspi/__init__.py.in
@@ -33,23 +33,29 @@ IBM Corporation under the BSD license, available at
 U{http://www.opensource.org/licenses/bsd-license.php}
 '''
 
-try:
-  gconf = None
-  gconfClient = None
-  import gconf
-  gconfClient = gconf.client_get_default()
-  useDbus = gconfClient.get_bool("/desktop/gnome/interface/at-spi-dbus")
-except:
-  useDbus = False
-finally:
-  del gconfClient
-  del gconf
+# Do not replace yourself if you've been imported explicitly by name
+# already.
+#
+import sys
+if not sys.modules.has_key('pyatspi_corba'):
+    try:
+        gconf = None
+        gconfClient = None
+        import gconf
+        gconfClient = gconf.client_get_default()
+        useDbus = \
+            gconfClient.get_bool("/desktop/gnome/interface/at-spi-dbus")
+    except:
+        useDbus = False
+    finally:
+        del gconfClient
+        del gconf
+else:
+    useDbus = False
 
 if useDbus:
-  import sys
   import pyatspi_dbus
   sys.modules['pyatspi'] = pyatspi_dbus
-  del sys
 else:
   __version__ = (@AT_SPI_MAJOR_VERSION@, @AT_SPI_MINOR_VERSION@, @AT_SPI_MICRO_VERSION@)
 
@@ -90,4 +96,5 @@ else:
   del reg
   del orb
 
+del sys
 del useDbus
diff --git a/registryd/Makefile.am b/registryd/Makefile.am
index f3b3f2b..ddf0e4f 100644
--- a/registryd/Makefile.am
+++ b/registryd/Makefile.am
@@ -36,17 +36,10 @@ default_session_DATA = $(default_session_in_files:.desktop.in=.desktop)
 
 @INTLTOOL_DESKTOP_RULE@
 
-if RELOCATE
-%.desktop.in: %.desktop.in.in Makefile.am
-	sed -e "s,\ registryddir\@,$(libexecdir)," \
-		< $< | sed -e "s,\ gconfkey\@,at-spi-corba," \
-		> $@
-else
 %.desktop.in: %.desktop.in.in Makefile.am
 	sed -e "s,\ registryddir\@,$(libexecdir)," \
 		< $< | sed -e "s,\ gconfkey\@,accessibility," \
 		> $@
-endif
 
 @INTLTOOL_SERVER_RULE@
 
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index bfd0c9b..a745878 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -43,7 +43,11 @@ static void set_gtk_path (DBusGProxy *gsm);
 #endif
 static void set_gtk_modules (DBusGProxy *gsm);
 
+#ifdef RELOCATE
 #define CORBA_GCONF_KEY  "/desktop/gnome/interface/at-spi-corba"
+#else
+#define DBUS_GCONF_KEY  "/desktop/gnome/interface/at-spi-dbus"
+#endif
 
 #define SM_DBUS_NAME      "org.gnome.SessionManager"
 #define SM_DBUS_PATH      "/org/gnome/SessionManager"
@@ -188,13 +192,21 @@ main (int argc, char **argv)
   GError          *error;
 
   GConfClient *gconf_client;
-  gboolean corba_set;
+  gboolean need_to_quit;
 
+  /* If we've been relocated, we will only run if the at-spi-corba gconf key
+   * has been set.  If we have not been relocated, we will exit if the
+   * at-spi-dbus key has been set.
+   */
   gconf_client = gconf_client_get_default ();
-  corba_set = gconf_client_get_bool (gconf_client, CORBA_GCONF_KEY, NULL);
+#ifdef RELOCATE
+  need_to_quit = !gconf_client_get_bool (gconf_client, CORBA_GCONF_KEY, NULL);
+#else
+  need_to_quit = gconf_client_get_bool (gconf_client, DBUS_GCONF_KEY, NULL);
+#endif
   g_object_unref (gconf_client);
 
-  if (!corba_set)
+  if (need_to_quit)
     return 0;
 
   if (!bonobo_init (&argc, argv))



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