[at-spi] Add --enable-relocate feature to allow coexistence with AT-SPI/D-Bus
- From: Li Yuan <liyuan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [at-spi] Add --enable-relocate feature to allow coexistence with AT-SPI/D-Bus
- Date: Thu, 29 Oct 2009 09:31:54 +0000 (UTC)
commit 31e4b15b3056454c665ae5f231152d5cbe0309b4
Author: Li Yuan <li yuan sun com>
Date: Thu Oct 29 16:13:54 2009 +0800
Add --enable-relocate feature to allow coexistence with AT-SPI/D-Bus
Bug #599244.
at-spi.schemas.in | 11 +++
atk-bridge/Makefile.am | 7 ++-
configure.in | 7 ++
pyatspi/Makefile.am | 14 ++++-
pyatspi/pyatspi-corba.pth.in | 1 +
registryd/Makefile.am | 16 +++-
registryd/at-spi-registryd.desktop.in.in.in | 2 +-
registryd/registry-main.c | 97 ++++++++++++++++++++++++---
8 files changed, 139 insertions(+), 16 deletions(-)
---
diff --git a/at-spi.schemas.in b/at-spi.schemas.in
index f8bb32a..2fffdb9 100644
--- a/at-spi.schemas.in
+++ b/at-spi.schemas.in
@@ -13,5 +13,16 @@
support.</long>
</locale>
</schema>
+ <schema>
+ <key>/schemas/desktop/gnome/interface/at-spi-corba</key>
+ <applyto>/desktop/gnome/interface/at-spi-corba</applyto>
+ <owner>gnome</owner>
+ <type>bool</type>
+ <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>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
diff --git a/atk-bridge/Makefile.am b/atk-bridge/Makefile.am
index bf6a044..8b68cee 100644
--- a/atk-bridge/Makefile.am
+++ b/atk-bridge/Makefile.am
@@ -1,6 +1,11 @@
NULL =
-moduledir = $(libdir)/gtk-2.0/modules
+if RELOCATE
+ moduledir = $(libdir)/gtk-2.0/modules/at-spi-corba/modules
+else
+ moduledir = $(libdir)/gtk-2.0/modules
+endif
+
module_LTLIBRARIES = libatk-bridge.la
libatk_bridge_la_SOURCES = \
diff --git a/configure.in b/configure.in
index 4463cf8..cb0a166 100644
--- a/configure.in
+++ b/configure.in
@@ -209,6 +209,12 @@ 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)
+if test x$enable_relocate = xyes ; then
+ AC_DEFINE(RELOCATE, , [Relocate to coexist with D-Bus])
+fi
+AM_CONDITIONAL(RELOCATE, test x$enable_relocate = xyes)
+
dnl CFLAGS="$CFLAGS -Wall"
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
@@ -266,6 +272,7 @@ cspi/Makefile
cspi/bonobo/Makefile
pyatspi/Makefile
pyatspi/__init__.py
+pyatspi/pyatspi-corba.pth
])
echo "AT-SPI setup:
diff --git a/pyatspi/Makefile.am b/pyatspi/Makefile.am
index e41016f..5c3abdb 100644
--- a/pyatspi/Makefile.am
+++ b/pyatspi/Makefile.am
@@ -6,4 +6,16 @@ pyatspi_PYTHON = \
registry.py \
utils.py
-pyatspidir=$(pyexecdir)/pyatspi
+if RELOCATE
+ pyatspidir=$(pyexecdir)/pyatspi-corba/pyatspi
+else
+ pyatspidir=$(pyexecdir)/pyatspi
+endif
+
+if RELOCATE
+install-exec-local:
+ @$(MKDIR_P) $(DESTDIR)$(pyexecdir)
+ cp pyatspi-corba.pth $(DESTDIR)$(pyexecdir)
+uninstall-local:
+ @rm $(DESTDIR)$(pyexecdir)/pyatspi-corba.pth
+endif
diff --git a/pyatspi/pyatspi-corba.pth.in b/pyatspi/pyatspi-corba.pth.in
new file mode 100644
index 0000000..e816e6a
--- /dev/null
+++ b/pyatspi/pyatspi-corba.pth.in
@@ -0,0 +1 @@
+import commands, sys; a = commands.getoutput('gconftool-2 --get /desktop/gnome/interface/at-spi-corba'); (a == 'true') and sys.path.insert(0, '@prefix@/lib/python PYTHON_VERSION@/site-packages/pyatspi-corba')
diff --git a/registryd/Makefile.am b/registryd/Makefile.am
index 68828db..f3b3f2b 100644
--- a/registryd/Makefile.am
+++ b/registryd/Makefile.am
@@ -10,7 +10,8 @@ INCLUDES = -I$(top_srcdir) \
-I$(top_builddir)/libspi \
-I$(top_srcdir)/libspi \
$(WARN_CFLAGS) \
- $(REGISTRYD_CFLAGS)
+ $(REGISTRYD_CFLAGS) \
+ -DGTK_LIBDIR=\"$(libdir)\"
at_spi_registryd_SOURCES = \
desktop.c \
@@ -35,9 +36,17 @@ 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@
@@ -47,8 +56,7 @@ CLEANFILES = \
$(server_dot_in) \
$(default_session_DATA) \
$(default_session_in_files)
-
+
DISTCLEANFILES = \
$(default_session_in_in_files)
-
diff --git a/registryd/at-spi-registryd.desktop.in.in.in b/registryd/at-spi-registryd.desktop.in.in.in
index f7e9362..b3a0c66 100644
--- a/registryd/at-spi-registryd.desktop.in.in.in
+++ b/registryd/at-spi-registryd.desktop.in.in.in
@@ -4,7 +4,7 @@ _Name=AT SPI Registry Wrapper
Exec= registryddir@/at-spi-registryd
OnlyShowIn=GNOME;
NoDisplay=true
-AutostartCondition=GNOME /desktop/gnome/interface/accessibility
+AutostartCondition=GNOME /desktop/gnome/interface/@gconfkey@
X-GNOME-AutoRestart=true
X-GNOME-Autostart-Phase=Initialization
X-GNOME-Bugzilla-Bugzilla=GNOME
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index c2c6909..09cf05e 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -36,6 +36,9 @@
#define spi_get_display() GDK_DISPLAY()
static void registry_set_ior (SpiRegistry *registry);
+#ifdef RELOCATE
+static void set_gtk_path (DBusGProxy *gsm);
+#endif
static void set_gtk_modules (DBusGProxy *gsm);
#define SM_DBUS_NAME "org.gnome.SessionManager"
@@ -217,6 +220,9 @@ main (int argc, char **argv)
"org.gnome.SessionManager",
"/org/gnome/SessionManager",
"org.gnome.SessionManager");
+#ifdef RELOCATE
+ set_gtk_path (gsm);
+#endif
set_gtk_modules (gsm);
registry_set_ior (registry);
@@ -267,6 +273,75 @@ registry_set_ior (SpiRegistry *registry){
}
+#ifdef RELOCATE
+static void
+set_gtk_path (DBusGProxy *gsm)
+{
+ const char *old;
+ char *corba_path;
+ char *value;
+ gboolean found;
+ GError *error;
+ int i, j;
+
+ corba_path = g_build_filename (GTK_LIBDIR,
+ "gtk-2.0",
+ "modules",
+ "at-spi-corba",
+ NULL);
+
+ old = g_getenv ("GTK_PATH");
+ if (old != NULL) {
+ char **old_path;
+ char **path;
+
+ old_path = g_strsplit (old, ":", -1);
+ found = FALSE;
+ for (i = 0; old_path[i]; i++) {
+ if (!strcmp (old_path[i], corba_path)) {
+ found = TRUE;
+ }
+ }
+ path = g_new (char *, i + (found ? 0 : 1) + 1);
+ if (!found) {
+ path[0] = corba_path;
+ for (i = 0; old_path[i]; i++) {
+ path[i + 1] = old_path[i];
+ }
+ path[i + 1] = NULL;
+ } else {
+ for (i = 0; old_path[i]; i++) {
+ path[i] = old_path[i];
+ }
+ path[i] = NULL;
+ }
+ value = g_strjoinv (":", path);
+ g_free (path);
+ g_strfreev (old_path);
+ } else {
+ value = g_strdup (corba_path);
+ }
+
+ if (gsm != NULL) {
+ error = NULL;
+ if (!dbus_g_proxy_call (gsm, "Setenv", &error,
+ G_TYPE_STRING, "GTK_PATH",
+ G_TYPE_STRING, value,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ g_warning ("Could not set GTK_PATH: %s", error->message);
+ g_error_free (error);
+ }
+ } else {
+ g_setenv ("GTK_PATH", value, TRUE);
+ }
+
+ g_free (value);
+ g_free (corba_path);
+ return;
+}
+#endif
+
static void
set_gtk_modules (DBusGProxy *gsm)
{
@@ -314,15 +389,19 @@ set_gtk_modules (DBusGProxy *gsm)
value = g_strdup ("gail:atk-bridge");
}
- error = NULL;
- if (!dbus_g_proxy_call (gsm, "Setenv", &error,
- G_TYPE_STRING, "GTK_MODULES",
- G_TYPE_STRING, value,
- G_TYPE_INVALID,
- G_TYPE_INVALID)) {
- g_warning ("Could not set GTK_MODULES: %s", error->message);
- g_error_free (error);
- }
+ if (gsm != NULL) {
+ error = NULL;
+ if (!dbus_g_proxy_call (gsm, "Setenv", &error,
+ G_TYPE_STRING, "GTK_MODULES",
+ G_TYPE_STRING, value,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ g_warning ("Could not set GTK_MODULES: %s", error->message);
+ g_error_free (error);
+ }
+ } else {
+ g_setenv ("GTK_MODULES", value, TRUE);
+ }
g_free (value);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]