diff --git a/imsettings-fix-lxde-fail.patch b/imsettings-fix-lxde-fail.patch new file mode 100644 index 0000000..01521e3 --- /dev/null +++ b/imsettings-fix-lxde-fail.patch @@ -0,0 +1,513 @@ + 2010-03-23 Akira TAGOH + + * backends/lxde/main.c: revise. run as the helper program + not the dbus service. + + * src/factory.c: revert the changes of LXDE support code. + +Index: src/factory.c +=================================================================== +--- src/factory.c (リビジョン 387) ++++ src/factory.c (リビジョン 389) +@@ -78,7 +78,6 @@ + IMSettingsRequest *gtk_req; + IMSettingsRequest *xim_req; + IMSettingsRequest *qt_req; +- IMSettingsRequest *lxde_req; + DBusConnection *req_conn; + GSList *im_running; + IMSettingsMonitor *monitor; +@@ -872,8 +871,6 @@ + g_object_unref(priv->xim_req); + if (priv->qt_req) + g_object_unref(priv->qt_req); +- if (priv->lxde_req) +- g_object_unref(priv->lxde_req); + if (priv->notify) { + /* XXX: workaround to avoid aborting on dbus. */ + if (dbus_connection_get_is_connected(priv->req_conn)) +@@ -1019,8 +1016,6 @@ + imsettings_request_change_to(priv->gtk_req, imm, error); + imm = imsettings_info_get_xim(info); + imsettings_request_change_to_with_signal(priv->xim_req, imm); +- imm = imsettings_info_get_gtkimm(info); +- imsettings_request_change_to(priv->lxde_req, imm, error); + #if 0 + imm = imsettings_info_get_qtimm(info); + imsettings_request_change_to(priv->qt_req, imm, error); +@@ -1033,7 +1028,6 @@ + + imsettings_request_send_signal_changed(priv->gtk_req, module); + imsettings_request_send_signal_changed(priv->xim_req, module); +- imsettings_request_send_signal_changed(priv->lxde_req, module); + #if 0 + imsettings_request_send_signal_changed(priv->qt_req, module); + #endif +@@ -1161,7 +1155,6 @@ + */ + imsettings_request_change_to(priv->gtk_req, gtkimm ? gtkimm : "", error); + imsettings_request_change_to_with_signal(priv->xim_req, xim ? xim : "none"); +- imsettings_request_change_to(priv->lxde_req, gtkimm ? gtkimm : "", error); + #if 0 + imsettings_request_change_to(priv->qt_req, NULL, error); + #endif +@@ -1236,7 +1229,6 @@ + if (update_xinputrc) { + imsettings_request_send_signal_changed(priv->gtk_req, "none"); + imsettings_request_send_signal_changed(priv->xim_req, "none"); +- imsettings_request_send_signal_changed(priv->lxde_req, "none"); + #if 0 + imsettings_request_send_signal_changed(priv->qt_req, "none"); + #endif +@@ -1377,7 +1369,6 @@ + + priv->gtk_req = imsettings_request_new(priv->req_conn, IMSETTINGS_GCONF_INTERFACE_DBUS); + priv->xim_req = imsettings_request_new(priv->req_conn, IMSETTINGS_XIM_INTERFACE_DBUS); +- priv->lxde_req = imsettings_request_new(priv->req_conn, IMSETTINGS_LXDE_INTERFACE_DBUS); + // priv->qt_req = imsettings_request_new(priv->req_conn, IMSETTINGS_QT_INTERFACE_DBUS); + priv->monitor = imsettings_monitor_new(NULL, NULL, NULL); + priv->pid2id = g_hash_table_new(g_direct_hash, g_direct_equal); +Index: backends/lxde/introspection.xml +=================================================================== +--- backends/lxde/introspection.xml (リビジョン 387) ++++ backends/lxde/introspection.xml (リビジョン 389) +@@ -1,9 +0,0 @@ +- +- +- +- +- +- +- +- +- +Index: backends/lxde/lxde-im-settings-daemon.service.in +=================================================================== +--- backends/lxde/lxde-im-settings-daemon.service.in (リビジョン 387) ++++ backends/lxde/lxde-im-settings-daemon.service.in (リビジョン 389) +@@ -1,3 +0,0 @@ +-[D-BUS Service] +-Name=com.redhat.imsettings.LXDE +-Exec=@libexecdir@/lxde-im-settings-daemon +Index: backends/lxde/main.c +=================================================================== +--- backends/lxde/main.c (リビジョン 387) ++++ backends/lxde/main.c (リビジョン 389) +@@ -28,49 +28,29 @@ + #include + #include + #include +-#include +-#include +-#include +-#include +-#include "imsettings/imsettings.h" ++#include ++#include + #include "imsettings/imsettings-utils.h" + + +-typedef struct _IMSettingsLxdeClass IMSettingsLxdeClass; +-typedef struct _IMSettingsLxde IMSettingsLxde; +- +-struct _IMSettingsLxdeClass { +- GObjectClass parent_class; +-}; +- +-struct _IMSettingsLxde { +- GObject parent_instance; +- gchar *owner; +-}; +- +- +-GType imsettings_lxde_get_type(void) G_GNUC_CONST; +-IMSettingsLxde *imsettings_lxde_new(void); +- +- +-G_DEFINE_TYPE (IMSettingsLxde, imsettings_lxde, G_TYPE_OBJECT); +- + /* + * Private functions + */ +-static gboolean +-lxde_imsettings_change_to(GObject *object, +- const gchar *module, +- gboolean *ret, +- GError **error) ++static void ++_notify_cb(GConfClient *client, ++ guint ctxt_id, ++ GConfEntry *entry, ++ gpointer user_data) + { ++ GConfValue *gval = gconf_entry_get_value(entry); ++ const gchar *val; + GKeyFile *key = g_key_file_new(); + gchar *confdir = g_build_filename(g_get_user_config_dir(), "lxde", NULL); + gchar *conf = g_build_filename(confdir, "config", NULL); + gchar *s; + gsize len = 0; + +- *ret = FALSE; ++ val = gconf_value_get_string(gval); + if (!g_key_file_load_from_file(key, conf, 0, NULL)) { + if (!g_key_file_load_from_file(key, LXDE_CONFIGDIR G_DIR_SEPARATOR_S "config", 0, NULL)) { + g_warning("Unable to load the lxde configuration file."); +@@ -78,201 +58,78 @@ + } + } + +- g_key_file_set_string(key, "GTK", "sGtk/IMModule", module); ++ g_key_file_set_string(key, "GTK", "sGtk/IMModule", val); + + if ((s = g_key_file_to_data(key, &len, NULL)) != NULL) { + if (g_mkdir_with_parents(confdir, 0700) != 0) { + int save_errno = errno; + +- g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(save_errno), +- "Failed to create the user config dir: %s", +- g_strerror(save_errno)); ++ g_warning("Failed to create the user config dir: %s", g_strerror(save_errno)); + g_free(s); + goto end; + } +- if (g_file_set_contents(conf, s, len, error)) { +- if (g_spawn_command_line_sync("lxde-settings-daemon reload", NULL, NULL, NULL, error)) { +- *ret = TRUE; ++ if (g_file_set_contents(conf, s, len, NULL)) { ++ if (!g_spawn_command_line_sync("lxde-settings-daemon reload", NULL, NULL, NULL, NULL)) { ++ g_warning("Unable to reload the LXDE settings"); + } + } else { + g_warning("Unable to store the configuration into %s", conf); + } + } else { +- g_set_error(error, IMSETTINGS_GERROR, IMSETTINGS_GERROR_FAILED, +- "Unable to obtain the configuration from the instance."); ++ g_warning("Unable to obtain the configuration from the instance."); + } + g_free(s); + end: + g_free(conf); + g_free(confdir); + g_key_file_free(key); +- +- return *ret; + } + +-#include "lxde-imsettings-glue.h" +- +-static void +-imsettings_lxde_class_init(IMSettingsLxdeClass *klass) +-{ +- dbus_g_object_type_install_info(imsettings_lxde_get_type(), +- &dbus_glib_lxde_imsettings_object_info); +-} +- +-static void +-imsettings_lxde_init(IMSettingsLxde *lxde) +-{ +-} +- +-static void +-_disconnected(IMSettingsLxde *lxde) +-{ +- GMainLoop *loop; +- +- d(g_print("***\n*** Disconnected\n***\n")); +- loop = g_object_get_data(G_OBJECT (lxde), "imsettings-lxde-loop-main"); +- g_main_loop_quit(loop); +-} +- +-static DBusHandlerResult +-imsettings_lxde_message_filter(DBusConnection *connection, +- DBusMessage *message, +- void *data) +-{ +- IMSettingsLxde *lxde = G_TYPE_CHECK_INSTANCE_CAST (data, imsettings_lxde_get_type(), IMSettingsLxde); +- GMainLoop *loop; +- +- if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { +- _disconnected(lxde); +- } else if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { +- gchar *service, *old_owner, *new_owner; +- +- dbus_message_get_args(message, NULL, +- DBUS_TYPE_STRING, &service, +- DBUS_TYPE_STRING, &old_owner, +- DBUS_TYPE_STRING, &new_owner, +- DBUS_TYPE_INVALID); +- if (strcmp(service, IMSETTINGS_LXDE_INTERFACE_DBUS) == 0) { +- d(g_print("OwnerChanged: `%s'->`%s' for %s\n", old_owner, new_owner, IMSETTINGS_LXDE_INTERFACE_DBUS)); +- if (lxde->owner == NULL) { +- lxde->owner = g_strdup(new_owner); +- } +- if (old_owner && strcmp(old_owner, lxde->owner) == 0) { +- _disconnected(lxde); +- } +- +- return DBUS_HANDLER_RESULT_HANDLED; +- } +- } else if (dbus_message_is_signal(message, IMSETTINGS_LXDE_INTERFACE_DBUS, "Reload")) { +- gboolean force = FALSE; +- +- dbus_message_get_args(message, NULL, DBUS_TYPE_BOOLEAN, &force, DBUS_TYPE_INVALID); +- d(g_print("Reloading%s\n", (force ? " forcibly" : ""))); +- if (force) { +- loop = g_object_get_data(G_OBJECT (lxde), "imsettings-lxde-loop-main"); +- g_main_loop_quit(loop); +- } +- +- return DBUS_HANDLER_RESULT_HANDLED; +- } +- +- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +-} +- + /* + * Public functions + */ +-IMSettingsLxde * +-imsettings_lxde_new(void) +-{ +- return (IMSettingsLxde *)g_object_new(imsettings_lxde_get_type(), NULL); +-} +- + int + main(int argc, + char **argv) + { +- DBusError derror; +- DBusConnection *conn; +- DBusGConnection *gconn; +- IMSettingsLxde *lxde; +- GMainLoop *loop; +- gint flags, ret; +- gboolean arg_replace = FALSE; +- GOptionContext *ctx = g_option_context_new(NULL); +- GOptionEntry entries[] = { +- {"replace", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_NONE, &arg_replace, N_("Replace the running settings daemon with new instance."), NULL}, +- {NULL, 0, 0, 0, NULL, NULL, NULL} +- }; + GError *error = NULL; ++ GConfClient *client = NULL; ++ GMainLoop *loop; ++ GConfEntry *entry; ++ guint ctxt_id; + +-#ifdef ENABLE_NLS +- bindtextdomain (GETTEXT_PACKAGE, IMSETTINGS_LOCALEDIR); +-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET +- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +-#endif /* HAVE_BIND_TEXTDOMAIN_CODESET */ +- textdomain (GETTEXT_PACKAGE); +-#endif /* ENABLE_NLS */ +- +- g_type_init(); +- dbus_error_init(&derror); +- +- /* deal with the arguments */ +- g_option_context_add_main_entries(ctx, entries, GETTEXT_PACKAGE); +- if (!g_option_context_parse(ctx, &argc, &argv, &error)) { +- if (error != NULL) { +- g_print("%s\n", error->message); +- } else { +- g_warning(_("Unknown error in parsing the command lines.")); +- } +- exit(1); ++ client = gconf_client_get_default(); ++ if (client == NULL) { ++ g_printerr("Failed to obtain the default GConfClient instance.\n"); ++ goto end; + } +- g_option_context_free(ctx); +- +- gconn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); +- conn = dbus_g_connection_get_connection(gconn); +- +- flags = DBUS_NAME_FLAG_ALLOW_REPLACEMENT | DBUS_NAME_FLAG_DO_NOT_QUEUE; +- if (arg_replace) { +- flags |= DBUS_NAME_FLAG_REPLACE_EXISTING; ++ gconf_client_add_dir(client, "/desktop/gnome/interface", ++ GCONF_CLIENT_PRELOAD_ONELEVEL, &error); ++ if (error) { ++ g_printerr("Failed to listen on the gconf dir: %s\n", ++ error->message); ++ goto end; + } +- +- ret = dbus_bus_request_name(conn, IMSETTINGS_LXDE_SERVICE_DBUS, flags, &derror); +- if (dbus_error_is_set(&derror)) { +- g_printerr("Failed to acquire IMSettings service for %s:\n %s\n", IMSETTINGS_LXDE_SERVICE_DBUS, derror.message); +- dbus_error_free(&derror); +- +- return 1; ++ if ((ctxt_id = gconf_client_notify_add(client, "/desktop/gnome/interface/gtk-im-module", ++ _notify_cb, NULL, NULL, &error)) == 0) { ++ g_printerr("Failed to listen on the gconf key: %s\n", ++ error->message); ++ goto end; + } +- if (ret == DBUS_REQUEST_NAME_REPLY_EXISTS) { +- g_printerr("IMSettings service for %s already running. exiting.\n", IMSETTINGS_LXDE_SERVICE_DBUS); + +- return 1; +- } else if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { +- g_printerr("Not primary owner of the service, exiting.\n"); +- +- return 1; ++ /* set a initial value */ ++ entry = gconf_client_get_entry(client, "/desktop/gnome/interface/gtk-im-module", NULL, TRUE, &error); ++ if (error) { ++ g_printerr("Failed to obtain gtk-im-module from gconf: %s\n", ++ error->message); ++ } else { ++ _notify_cb(client, ctxt_id, entry, NULL); + } +- +- lxde = imsettings_lxde_new(); +- +- dbus_bus_add_match(conn, +- "type='signal'," +- "interface='" DBUS_INTERFACE_DBUS "'," +- "sender='" DBUS_SERVICE_DBUS "'", +- &derror); +- dbus_bus_add_match(conn, "type='signal',interface='" IMSETTINGS_LXDE_INTERFACE_DBUS "'", &derror); +- dbus_connection_add_filter(conn, imsettings_lxde_message_filter, lxde, NULL); +- +- dbus_g_connection_register_g_object(gconn, IMSETTINGS_LXDE_PATH_DBUS, G_OBJECT (lxde)); +- + loop = g_main_loop_new(NULL, FALSE); +- g_object_set_data(G_OBJECT (lxde), "imsettings-lxde-loop-main", loop); + g_main_loop_run(loop); ++ end: ++ if (client) ++ g_object_unref(client); + +- g_main_loop_unref(loop); +- dbus_g_connection_unref(gconn); +- g_object_unref(lxde); +- + return 0; + } +Index: backends/lxde/Makefile.am +=================================================================== +--- backends/lxde/Makefile.am (リビジョン 387) ++++ backends/lxde/Makefile.am (リビジョン 389) +@@ -4,86 +4,47 @@ + INCLUDES = \ + -DIMSETTINGS_LOCALEDIR="\"$(datadir)/locale\"" \ + -DLXDE_CONFIGDIR="\"$(sysconfdir)/lxde\"" \ +- -I$(top_srcdir)/imsettings \ +- $(IMSETTINGS_CFLAGS) \ ++ $(GCONF_CFLAGS) \ + $(LXDE_CFLAGS) \ + $(NULL) + LIBS = \ + @LDFLAGS@ \ +- $(IMSETTINGS_LIBS) \ ++ $(GCONF_LIBS) \ + $(LXDE_LIBS) \ +- $(top_builddir)/imsettings/libimsettings.la \ + $(NULL) +-DEPS = \ +- $(top_builddir)/imsettings/libimsettings.la \ +- $(NULL) + EXTRA_DIST = \ +- introspection.xml \ +- lxde-im-settings-daemon.service.in \ ++ $(autostart_in_files) \ + $(NULL) +-MAINTAINERCLEANFILES = \ +- $(lxde_built_public_headers) \ +- $(lxde_built_private_headers) \ +- $(lxde_built_sources) \ +- $(stamp_files) \ ++DISTCLEANFILES = \ ++ $(autostart_DATA) \ + $(NULL) + +- + ## + # Local definitions +-lxde_public_headers = \ +- $(NULL) +-lxde_private_headers = \ +- $(NULL) +-lxde_built_public_headers = \ +- $(NULL) +-lxde_built_private_headers = \ +- lxde-imsettings-glue.h \ +- $(NULL) +-# +-lxde_built_sources = \ +- $(NULL) + lxde_sources = \ + main.c \ +- $(lxde_built_sources) \ + $(NULL) +-# +-stamp_files = \ +- stamp-glue.h \ +- $(NULL) + + + ## + # Local Rules +-main.c: lxde-imsettings-glue.h +- @true +-lxde-imsettings-glue.h: stamp-glue.h +- @true +-stamp-glue.h: @REBUILD@ $(srcdir)/introspection.xml Makefile +- dbus-binding-tool --prefix=lxde_imsettings \ +- --mode=glib-server \ +- --output=lxde-imsettings-glue.h $(srcdir)/introspection.xml && \ +- echo timestamp > $(@F) ++@INTLTOOL_DESKTOP_RULE@ + +-%.service: %.service.in $(top_builddir)/config.log +- sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ +- +- + ## + # Target platform +-libexec_PROGRAMS = lxde-im-settings-daemon +-# +-noinst_HEADERS = \ +- $(lxde_private_headers) \ +- $(lxde_built_private_headers) \ ++bin_PROGRAMS = \ ++ imsettings-lxde-helper \ + $(NULL) + # +-lxde_im_settings_daemon_SOURCES = \ ++imsettings_lxde_helper_SOURCES = \ + $(lxde_sources) \ + $(NULL) +-lxde_im_settings_daemon_CFLAGS = \ +- -DG_LOG_DOMAIN="\"LXDE-IM-Settings-Daemon\"" \ ++imsettings_lxde_helper_CFLAGS = \ ++ -DG_LOG_DOMAIN="\"imsettings-lxde-helper\"" \ + $(NULL) + # +-servicedir = $(DBUS_SERVICE_DIR) +-service_DATA = lxde-im-settings-daemon.service ++autostartdir = $(sysconfdir)/xdg/autostart ++autostart_in_files = \ ++ imsettings-lxde-helper.desktop.in \ ++ $(NULL) ++autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) +Index: backends/lxde/imsettings-lxde-helper.desktop.in +=================================================================== +--- backends/lxde/imsettings-lxde-helper.desktop.in (リビジョン 0) ++++ backends/lxde/imsettings-lxde-helper.desktop.in (リビジョン 389) +@@ -0,0 +1,9 @@ ++[Desktop Entry] ++Encoding=UTF-8 ++Version=1.0 ++Type=Application ++_Name=Helper application for imsettings ++_Comment=Helper application that delivers GTK+ immodule name between GConf and lxde-settings-daemon ++OnlyShowIn=LXDE; ++Exec=imsettings-lxde-helper ++Terminal=false diff --git a/imsettings.spec b/imsettings.spec index 98d92d8..38e380d 100644 --- a/imsettings.spec +++ b/imsettings.spec @@ -1,11 +1,12 @@ Name: imsettings Version: 0.108.0 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ URL: http://code.google.com/p/imsettings/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: desktop-file-utils BuildRequires: intltool gettext +BuildRequires: libtool automake autoconf BuildRequires: dbus-devel >= 0.23, dbus-glib-devel >= 0.74, glib2 >= 2.16 BuildRequires: libgxim-devel >= 0.3.1, libnotify-devel %if !0%{?rhel} @@ -19,6 +20,7 @@ Source1: imsettings-kde.sh Patch0: imsettings-constraint-of-language.patch Patch1: imsettings-disable-xim.patch Patch2: imsettings-none.conf-gtk-xim-default.patch +Patch3: imsettings-fix-lxde-fail.patch Summary: Delivery framework for general Input Method configuration Group: Applications/System @@ -88,6 +90,8 @@ This package contains a plugin to get this working on Xfce. %patch0 -p1 -b .0-lang %patch1 -p1 -b .1-xim %patch2 -p1 -b .2-xim +%patch3 -p0 -b .3-lxde +autoreconf -Im4macros -f %build %configure \ @@ -117,8 +121,8 @@ rm -f $RPM_BUILD_ROOT%{_bindir}/imsettings-xfce-helper # still not stable rm -f $RPM_BUILD_ROOT%{_datadir}/dbus-1/services/qt-im-settings-daemon.service rm -f $RPM_BUILD_ROOT%{_libexecdir}/qt-im-settings-daemon -rm -f $RPM_BUILD_ROOT%{_datadir}/dbus-1/services/lxde-im-settings-daemon.service -rm -f $RPM_BUILD_ROOT%{_libexecdir}/lxde-im-settings-daemon +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/xdg/autostart/imsettings-lxde-helper.desktop +rm -f $RPM_BUILD_ROOT%{_bindir}/imsettings-lxde-helper # workaround for KDE mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kde/env @@ -218,6 +222,9 @@ fi %changelog +* Thu Apr 15 2010 Akira TAGOH - 0.108.0-2 +- Fix issue the invocation of IM always fails in the internal status. (#582448) + * Tue Mar 23 2010 Akira TAGOH - 0.108.0-1 - New upstream release. - Fix the abort issue. (#570462)