From 2b0f9ad8472b26ae31c4245cd64c4c54d616c854 Mon Sep 17 00:00:00 2001 From: Willie Walker Date: Wed, 23 Sep 2009 08:42:57 -0400 Subject: [PATCH] Allow at-spi2-core files to co-exist with AT-SPI/CORBA (bfo#24106) --- configure.ac | 2 +- registryd/Makefile.am | 12 ++-- registryd/at-spi-registryd.desktop.in.in | 12 ---- registryd/at-spi2-registryd.desktop.in.in | 12 ++++ .../org.freedesktop.atspi.Registry.service.in | 2 +- registryd/registry-main.c | 70 ++++++++++++++++++++ 6 files changed, 90 insertions(+), 20 deletions(-) delete mode 100644 registryd/at-spi-registryd.desktop.in.in create mode 100644 registryd/at-spi2-registryd.desktop.in.in diff --git a/configure.ac b/configure.ac index 4e9d0a7..54caeb3 100644 --- a/configure.ac +++ b/configure.ac @@ -175,7 +175,7 @@ AC_CONFIG_FILES([Makefile tools/Makefile droute/Makefile registryd/Makefile - registryd/at-spi-registryd.desktop.in + registryd/at-spi2-registryd.desktop.in dbind/Makefile dbind/dbind-config.h]) diff --git a/registryd/Makefile.am b/registryd/Makefile.am index 9206a3c..f325527 100644 --- a/registryd/Makefile.am +++ b/registryd/Makefile.am @@ -1,13 +1,13 @@ -libexec_PROGRAMS = at-spi-registryd +libexec_PROGRAMS = at-spi2-registryd -at_spi_registryd_CFLAGS = $(DBUS_GLIB_CFLAGS) \ +at_spi2_registryd_CFLAGS = $(DBUS_GLIB_CFLAGS) \ $(GOBJ_CFLAGS) \ $(ATK_CFLAGS) \ $(GDK_CFLAGS) \ -I$(top_srcdir) \ -DATSPI_INTROSPECTION_PATH=\"$(pkgdatadir)/$(DEFAULT_ATSPI_INTROSPECTION_PATH)\" -at_spi_registryd_LDADD = $(DBUS_GLIB_LIBS) \ +at_spi2_registryd_LDADD = $(DBUS_GLIB_LIBS) \ $(GOBJ_CFLAGS) \ $(ATK_LIBS) \ $(GDK_LIBS) \ @@ -17,7 +17,7 @@ at_spi_registryd_LDADD = $(DBUS_GLIB_LIBS) \ $(XEVIE_LIBS) \ $(top_builddir)/droute/libdroute.la -at_spi_registryd_SOURCES = \ +at_spi2_registryd_SOURCES = \ de-marshaller.h \ de-marshaller.c \ de-types.h \ @@ -34,7 +34,7 @@ at_spi_registryd_SOURCES = \ default_sessiondir = $(sysconfdir)/xdg/autostart default_session_in_in_files = \ - at-spi-registryd.desktop.in.in + at-spi2-registryd.desktop.in.in default_session_in_files = $(default_session_in_in_files:.desktop.in.in=.desktop.in) default_session_DATA = $(default_session_in_files:.desktop.in=.desktop) @@ -48,7 +48,7 @@ default_session_DATA = $(default_session_in_files:.desktop.in=.desktop) CLEANFILES = \ $(default_session_DATA) \ $(default_session_in_files) -EXTRA_DIST = at-spi-registryd.desktop.in.in +EXTRA_DIST = at-spi2-registryd.desktop.in.in servicedir = $(DBUS_SERVICES_DIR) service_in_files = org.freedesktop.atspi.Registry.service.in diff --git a/registryd/at-spi-registryd.desktop.in.in b/registryd/at-spi-registryd.desktop.in.in deleted file mode 100644 index 6065e7d..0000000 --- a/registryd/at-spi-registryd.desktop.in.in +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Application -Name=AT SPI Registry Wrapper -Exec=@registryddir@/at-spi-registryd -OnlyShowIn=GNOME; -NoDisplay=true -AutostartCondition=GNOME /desktop/gnome/interface/accessibility -X-GNOME-Autostart-Phase=Initialization -X-GNOME-Bugzilla-Bugzilla=GNOME -X-GNOME-Bugzilla-Product=at-spi -X-GNOME-Bugzilla-Component=general -X-GNOME-Bugzilla-Version=1.9.0 diff --git a/registryd/at-spi2-registryd.desktop.in.in b/registryd/at-spi2-registryd.desktop.in.in new file mode 100644 index 0000000..9783d41 --- /dev/null +++ b/registryd/at-spi2-registryd.desktop.in.in @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=AT SPI2 Registry +Exec=@registryddir@/at-spi2-registryd +OnlyShowIn=GNOME; +NoDisplay=true +AutostartCondition=GNOME /desktop/gnome/interface/accessibility2 +X-GNOME-Autostart-Phase=Initialization +X-GNOME-Bugzilla-Bugzilla=GNOME +X-GNOME-Bugzilla-Product=at-spi +X-GNOME-Bugzilla-Component=general +X-GNOME-Bugzilla-Version=1.9.0 diff --git a/registryd/org.freedesktop.atspi.Registry.service.in b/registryd/org.freedesktop.atspi.Registry.service.in index e1c0151..6ae275d 100644 --- a/registryd/org.freedesktop.atspi.Registry.service.in +++ b/registryd/org.freedesktop.atspi.Registry.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.freedesktop.atspi.Registry -Exec=@LIBEXECDIR@/at-spi-registryd +Exec=@LIBEXECDIR@/at-spi2-registryd diff --git a/registryd/registry-main.c b/registryd/registry-main.c index 8429df3..29e6c9b 100644 --- a/registryd/registry-main.c +++ b/registryd/registry-main.c @@ -44,6 +44,7 @@ static gchar *dbus_name = NULL; static void registry_session_init (const char *previous_client_id, const char *exe); +static void set_gtk_modules (DBusConnection *bus); static GOptionEntry optentries[] = { {"dbus-name", 0, 0, G_OPTION_ARG_STRING, &dbus_name, "Well-known name to register with D-Bus", NULL}, @@ -126,6 +127,7 @@ main (int argc, char **argv) g_free (client_id); } + set_gtk_modules (bus); g_main_loop_run (mainloop); return 0; @@ -216,3 +218,71 @@ registry_session_init (const char *previous_client_id, const char *exe) #endif } +static void +set_gtk_modules (DBusConnection *bus) +{ + const char *name = "GTK_MODULES"; + const char *old; + char *value; + gboolean found_gail; + gboolean found_atk_bridge; + DBusMessage *message, *reply; + DBusError error; + int i; + + found_gail = FALSE; + found_atk_bridge = FALSE; + + old = g_getenv ("GTK_MODULES"); + if (old != NULL) { + char **old_modules; + char **modules; + + old_modules = g_strsplit (old, ":", -1); + for (i = 0; old_modules[i]; i++) { + if (!strcmp (old_modules[i], "gail")) { + found_gail = TRUE; + } else if (!strcmp (old_modules[i], "spi2atk")) { + found_atk_bridge = TRUE; + } + } + + modules = g_new (char *, i + (found_gail ? 0 : 1) + + (found_atk_bridge ? 0 : 1) + 1); + for (i = 0; old_modules[i]; i++) { + modules[i] = old_modules[i]; + } + if (!found_gail) { + modules[i++] = "gail"; + } + if (!found_atk_bridge) { + modules[i++] = "spi2atk"; + } + modules[i] = NULL; + + value = g_strjoinv (":", modules); + g_free (modules); + g_strfreev (old_modules); + } else { + value = g_strdup ("gail:spi2atk"); + } + + dbus_error_init (&error); + message = dbus_message_new_method_call ("org.gnome.SessionManager", + "/org/gnome/SessionManager", + "org.gnome.SessionManager", + "Setenv"); + dbus_message_set_no_reply (message, TRUE); + dbus_message_append_args (message, DBUS_TYPE_STRING, &name, + DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID); + + reply = dbus_connection_send_with_reply_and_block (bus, message, 2000, &error); + if (dbus_error_is_set (&error)) + g_warning ("Could not set GTK_MODULES: %s\n", error.message); + + dbus_error_free (&error); + + if (reply) + dbus_message_unref (reply); + dbus_message_unref (message); +} -- 1.5.6.5