From 0b612dfb8ab52a61896b9079acd2d76a360f8666 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Mon, 22 Apr 2013 20:16:31 +0900 Subject: [PATCH] Fix make dist errors. Review URL: https://codereview.appspot.com/8850043 --- bindings/pygobject/Makefile.am | 6 +++++- bindings/vala/Makefile.am | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bindings/pygobject/Makefile.am b/bindings/pygobject/Makefile.am index 3980bc6..6360397 100644 --- a/bindings/pygobject/Makefile.am +++ b/bindings/pygobject/Makefile.am @@ -27,7 +27,11 @@ overrides_PYTHON = \ gi/overrides/IBus.py \ $(NULL) -TESTS = test-override-ibus.py +TESTS = + +if ENABLE_TESTS +TESTS += test-override-ibus.py +endif TESTS_ENVIRONMENT = \ PYTHONPATH=$(top_srcdir)/tests:$${PYTHONPATH:+:$$PYTHONPATH} \ diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am index aba3454..381ef31 100644 --- a/bindings/vala/Makefile.am +++ b/bindings/vala/Makefile.am @@ -50,4 +50,6 @@ EXTRA_DIST = \ xi.vapi \ $(NULL) +DIST_SOURCES = $(VAPIGEN_VAPIS) + -include $(top_srcdir)/git.mk -- 1.8.0 From 4e175e3337337f2c261088d4576ea63a144cee3a Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 24 Apr 2013 13:44:35 +0900 Subject: [PATCH] Use EXTRA_DIST instead of DIST_SOURCES. Review URL: https://codereview.appspot.com/8698047 --- bindings/vala/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bindings/vala/Makefile.am b/bindings/vala/Makefile.am index 381ef31..be45e41 100644 --- a/bindings/vala/Makefile.am +++ b/bindings/vala/Makefile.am @@ -42,7 +42,10 @@ ibus_1_0_vapi_FILES = \ vapidir = $(datadir)/vala/vapi vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps) +MAINTAINERCLEANFILES = $(VAPIGEN_VAPIS) + EXTRA_DIST = \ + $(VAPIGEN_VAPIS) \ IBus-1.0.metadata \ IBus-1.0-custom.vala \ ibus-1.0.deps \ @@ -50,6 +53,4 @@ EXTRA_DIST = \ xi.vapi \ $(NULL) -DIST_SOURCES = $(VAPIGEN_VAPIS) - -include $(top_srcdir)/git.mk -- 1.8.0 From 667b7f0b96e5a7e1190e606a9c680bcbda8c2a88 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 30 Apr 2013 21:46:02 +0900 Subject: [PATCH] Implement embed_preedit_text. BUG=http://code.google.com/p/ibus/issues/detail?id=1606 Review URL: https://codereview.appspot.com/8112044 --- bus/ibusimpl.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++------- src/ibusbus.c | 54 ++++++++++ src/ibusbus.h | 24 +++++ ui/gtk3/panel.vala | 23 ++++ 4 files changed, 370 insertions(+), 41 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 6218578..594216a 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -51,11 +51,13 @@ struct _BusIBusImpl { /* a fake input context for global engine support */ BusInputContext *fake_context; - /* a list of engines that are started by a user (without the --ibus command line flag.) */ + /* a list of engines that are started by a user (without the --ibus + * command line flag.) */ GList *register_engine_list; - /* if TRUE, ibus-daemon uses a keysym translated by the system (i.e. XKB) as-is. - * otherwise, ibus-daemon itself converts keycode into keysym. */ + /* if TRUE, ibus-daemon uses a keysym translated by the system + * (i.e. XKB) as-is. otherwise, ibus-daemon itself converts keycode + * into keysym. */ gboolean use_sys_layout; gboolean embed_preedit_text; @@ -65,7 +67,8 @@ struct _BusIBusImpl { BusInputContext *focused_context; BusPanelProxy *panel; - /* a default keymap of ibus-daemon (usually "us") which is used only when use_sys_layout is FALSE. */ + /* a default keymap of ibus-daemon (usually "us") which is used only + * when use_sys_layout is FALSE. */ IBusKeymap *keymap; gboolean use_global_engine; @@ -92,45 +95,70 @@ static guint _signals[LAST_SIGNAL] = { 0 }; */ /* functions prototype */ -static void bus_ibus_impl_destroy (BusIBusImpl *ibus); +static void bus_ibus_impl_destroy (BusIBusImpl *ibus); static void bus_ibus_impl_service_method_call - (IBusService *service, - GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *method_name, - GVariant *parameters, - GDBusMethodInvocation - *invocation); -static void bus_ibus_impl_registry_changed (BusIBusImpl *ibus); + (IBusService *service, + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation + *invocation); +static GVariant * + bus_ibus_impl_service_get_property + (IBusService *service, + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error); +static gboolean + bus_ibus_impl_service_set_property + (IBusService *service, + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *value, + GError **error); +static void bus_ibus_impl_registry_changed + (BusIBusImpl *ibus); static void bus_ibus_impl_global_engine_changed - (BusIBusImpl *ibus); + (BusIBusImpl *ibus); static void bus_ibus_impl_set_context_engine_from_desc - (BusIBusImpl *ibus, - BusInputContext *context, - IBusEngineDesc *desc); + (BusIBusImpl *ibus, + BusInputContext *context, + IBusEngineDesc *desc); static BusInputContext *bus_ibus_impl_create_input_context - (BusIBusImpl *ibus, - BusConnection *connection, - const gchar *client); + (BusIBusImpl *ibus, + BusConnection *connection, + const gchar *client); static IBusEngineDesc - *bus_ibus_impl_get_engine_desc (BusIBusImpl *ibus, - const gchar *engine_name); + *bus_ibus_impl_get_engine_desc + (BusIBusImpl *ibus, + const gchar *engine_name); static void bus_ibus_impl_set_focused_context - (BusIBusImpl *ibus, - BusInputContext *context); + (BusIBusImpl *ibus, + BusInputContext *context); /* some callback functions */ -static void _context_engine_changed_cb (BusInputContext *context, - BusIBusImpl *ibus); - -/* The interfaces available in this class, which consists of a list of methods this class implements and - * a list of signals this class may emit. Method calls to the interface that are not defined in this XML - * will be automatically rejected by the GDBus library (see src/ibusservice.c for details.) */ +static void _context_engine_changed_cb + (BusInputContext *context, + BusIBusImpl *ibus); + +/* The interfaces available in this class, which consists of a list of + * methods this class implements and a list of signals this class may emit. + * Method calls to the interface that are not defined in this XML will + * be automatically rejected by the GDBus library (see src/ibusservice.c + * for details.) */ static const gchar introspection_xml[] = "\n" " \n" + " \n" " \n" " \n" " \n" @@ -193,12 +221,20 @@ G_DEFINE_TYPE (BusIBusImpl, bus_ibus_impl, IBUS_TYPE_SERVICE) static void bus_ibus_impl_class_init (BusIBusImplClass *class) { - IBUS_OBJECT_CLASS (class)->destroy = (IBusObjectDestroyFunc) bus_ibus_impl_destroy; + IBUS_OBJECT_CLASS (class)->destroy = + (IBusObjectDestroyFunc) bus_ibus_impl_destroy; /* override the parent class's implementation. */ - IBUS_SERVICE_CLASS (class)->service_method_call = bus_ibus_impl_service_method_call; - /* register the xml so that bus_ibus_impl_service_method_call will be called on a method call defined in the xml (e.g. 'GetAddress'.) */ - ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml); + IBUS_SERVICE_CLASS (class)->service_method_call = + bus_ibus_impl_service_method_call; + IBUS_SERVICE_CLASS (class)->service_get_property = + bus_ibus_impl_service_get_property; + IBUS_SERVICE_CLASS (class)->service_set_property = + bus_ibus_impl_service_set_property; + /* register the xml so that bus_ibus_impl_service_method_call will be + * called on a method call defined in the xml (e.g. 'GetAddress'.) */ + ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), + introspection_xml); } /** @@ -1278,9 +1314,49 @@ _ibus_preload_engines (BusIBusImpl *ibus, } /** + * _ibus_get_embed_preedit_text: + * + * Implement the "EmbedPreeditText" method call of + * the org.freedesktop.IBus interface. + */ +static GVariant * +_ibus_get_embed_preedit_text (BusIBusImpl *ibus, + GDBusConnection *connection, + GError **error) +{ + if (error) { + *error = NULL; + } + + return g_variant_new_boolean (ibus->embed_preedit_text); +} + +/** + * _ibus_set_embed_preedit_text: + * + * Implement the "EmbedPreeditText" method call of + * the org.freedesktop.IBus interface. + */ +static gboolean +_ibus_set_embed_preedit_text (BusIBusImpl *ibus, + GDBusConnection *connection, + GVariant *value, + GError **error) +{ + if (error) { + *error = NULL; + } + + ibus->embed_preedit_text = g_variant_get_boolean (value); + + return TRUE; +} + +/** * bus_ibus_impl_service_method_call: * - * Handle a D-Bus method call whose destination and interface name are both "org.freedesktop.IBus" + * Handle a D-Bus method call whose destination and interface name are + * both "org.freedesktop.IBus" */ static void bus_ibus_impl_service_method_call (IBusService *service, @@ -1294,7 +1370,8 @@ bus_ibus_impl_service_method_call (IBusService *service, { if (g_strcmp0 (interface_name, "org.freedesktop.IBus") != 0) { IBUS_SERVICE_CLASS (bus_ibus_impl_parent_class)->service_method_call ( - service, connection, sender, object_path, interface_name, method_name, + service, connection, sender, object_path, + interface_name, method_name, parameters, invocation); return; } @@ -1325,13 +1402,164 @@ bus_ibus_impl_service_method_call (IBusService *service, gint i; for (i = 0; i < G_N_ELEMENTS (methods); i++) { if (g_strcmp0 (methods[i].method_name, method_name) == 0) { - methods[i].method_callback ((BusIBusImpl *) service, parameters, invocation); + methods[i].method_callback ((BusIBusImpl *) service, + parameters, + invocation); return; } } - /* notreached - unknown method calls that are not in the introspection_xml should be handled by the GDBus library. */ - g_return_if_reached (); + g_warning ("service_method_call received an unknown method: %s", + method_name ? method_name : "(null)"); +} + +/** + * bus_ibus_impl_service_get_property: + * + * Handle org.freedesktop.DBus.Properties.Get + */ +static GVariant * +bus_ibus_impl_service_get_property (IBusService *service, + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error) +{ + gint i; + + static const struct { + const gchar *method_name; + GVariant * (* method_callback) (BusIBusImpl *, + GDBusConnection *, + GError **); + } methods [] = { + { "EmbedPreeditText", _ibus_get_embed_preedit_text }, + }; + + if (g_strcmp0 (interface_name, IBUS_INTERFACE_IBUS) != 0) { + return IBUS_SERVICE_CLASS ( + bus_ibus_impl_parent_class)->service_get_property ( + service, connection, sender, object_path, + interface_name, property_name, + error); + } + + for (i = 0; i < G_N_ELEMENTS (methods); i++) { + if (g_strcmp0 (methods[i].method_name, property_name) == 0) { + return methods[i].method_callback ((BusIBusImpl *) service, + connection, + error); + } + } + + g_warning ("service_get_property received an unknown property: %s", + property_name ? property_name : "(null)"); + return NULL; +} + +static void +_emit_properties_changed (BusIBusImpl *service, + GDBusConnection *connection, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *value, + gboolean is_changed) +{ + GVariantBuilder *builder; + GVariantBuilder *invalidated_builder; + GError *error = NULL; + + builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY); + invalidated_builder = g_variant_builder_new (G_VARIANT_TYPE ("as")); + + if (is_changed) { + g_variant_builder_add (builder, "{sv}", property_name, value); + } else { + g_variant_builder_add (invalidated_builder, "s", property_name); + } + + g_dbus_connection_emit_signal (connection, + NULL, + object_path, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + g_variant_new ("(sa{sv}as)", + interface_name, + builder, + invalidated_builder), + &error); + + if (error) { + g_warning ("Failed to emit property %s in %s.%s: %s", + property_name, + "org.freedesktop.DBus.Properties", + "PropertiesChanged", + error->message); + g_error_free (error); + } +} + +/** + * bus_ibus_impl_service_set_property: + * + * Handle org.freedesktop.DBus.Properties.Set + */ +static gboolean +bus_ibus_impl_service_set_property (IBusService *service, + GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *value, + GError **error) +{ + gint i; + + static const struct { + const gchar *method_name; + gboolean (* method_callback) (BusIBusImpl *, + GDBusConnection *, + GVariant *, + GError **); + } methods [] = { + { "EmbedPreeditText", _ibus_set_embed_preedit_text }, + }; + + if (g_strcmp0 (interface_name, IBUS_INTERFACE_IBUS) != 0) { + return IBUS_SERVICE_CLASS ( + bus_ibus_impl_parent_class)->service_set_property ( + service, connection, sender, object_path, + interface_name, property_name, + value, error); + } + + for (i = 0; i < G_N_ELEMENTS (methods); i++) { + if (g_strcmp0 (methods[i].method_name, property_name) == 0) { + gboolean retval = methods[i].method_callback ( + (BusIBusImpl *) service, + connection, + value, + error); + + _emit_properties_changed ((BusIBusImpl *) service, + connection, + object_path, + interface_name, + property_name, + value, + retval); + + return retval; + } + } + + g_warning ("service_set_property received an unknown property: %s", + property_name ? property_name : "(null)"); + return FALSE; } BusIBusImpl * diff --git a/src/ibusbus.c b/src/ibusbus.c index 66a8486..5fa03c3 100644 --- a/src/ibusbus.c +++ b/src/ibusbus.c @@ -2068,6 +2068,60 @@ ibus_bus_preload_engines_async_finish (IBusBus *bus, return _async_finish_void (res, error); } +GVariant * +ibus_bus_get_ibus_property (IBusBus *bus, + const gchar *property_name) +{ + GVariant *result; + GVariant *retval = NULL; + + g_return_val_if_fail (IBUS_IS_BUS (bus), NULL); + g_return_val_if_fail (property_name != NULL, NULL); + + result = ibus_bus_call_sync (bus, + IBUS_SERVICE_IBUS, + IBUS_PATH_IBUS, + "org.freedesktop.DBus.Properties", + "Get", + g_variant_new ("(ss)", + IBUS_INTERFACE_IBUS, + property_name), + G_VARIANT_TYPE ("(v)")); + + if (result) { + g_variant_get (result, "(v)", &retval); + g_variant_unref (result); + } + + return retval; +} + +void +ibus_bus_set_ibus_property (IBusBus *bus, + const gchar *property_name, + GVariant *value) +{ + GVariant *result; + + g_return_if_fail (IBUS_IS_BUS (bus)); + g_return_if_fail (property_name != NULL); + + result = ibus_bus_call_sync (bus, + IBUS_SERVICE_IBUS, + IBUS_PATH_IBUS, + "org.freedesktop.DBus.Properties", + "Set", + g_variant_new ("(ssv)", + IBUS_INTERFACE_IBUS, + property_name, + value), + NULL); + + if (result) { + g_variant_unref (result); + } +} + static GVariant * ibus_bus_call_sync (IBusBus *bus, const gchar *bus_name, diff --git a/src/ibusbus.h b/src/ibusbus.h index 1288317..6344337 100644 --- a/src/ibusbus.h +++ b/src/ibusbus.h @@ -1043,5 +1043,29 @@ gboolean ibus_bus_preload_engines_async_finish GAsyncResult *res, GError **error); +/** + * ibus_bus_get_ibus_property: + * @bus: An #IBusBus. + * @property_name: property name in org.freedesktop.DBus.Properties.Get + * @returns: (transfer full): The value in org.freedesktop.DBus.Properties.Get + * The returned value must be freed with g_variant_unref(). + * + * Get org.freedesktop.DBus.Properties. + */ +GVariant * ibus_bus_get_ibus_property (IBusBus *bus, + const gchar *property_name); + +/** + * ibus_bus_set_ibus_property: + * @bus: An #IBusBus. + * @property_name: property name in org.freedesktop.DBus.Properties.Set + * @value: value in org.freedesktop.DBus.Properties.Set + * + * Set org.freedesktop.DBus.Properties. + */ +void ibus_bus_set_ibus_property (IBusBus *bus, + const gchar *property_name, + GVariant *value); + G_END_DECLS #endif diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala index 0d7a5b2..8090a42 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala @@ -282,6 +282,22 @@ class Panel : IBus.PanelService { m_use_system_keyboard_layout = var_use_system_kbd_layout.get_boolean(); } + private void set_embed_preedit_text(Variant? variant) { + Variant var_embed_preedit = variant; + + if (var_embed_preedit == null) { + var_embed_preedit = m_config.get_value("general", + "embed_preedit_text"); + } + + if (var_embed_preedit == null) { + return; + } + + m_bus.set_ibus_property("EmbedPreeditText", + var_embed_preedit); + } + public void set_config(IBus.Config config) { if (m_config != null) { m_config.value_changed.disconnect(config_value_changed_cb); @@ -293,6 +309,7 @@ class Panel : IBus.PanelService { if (m_config != null) { m_config.value_changed.connect(config_value_changed_cb); m_config.watch("general", "preload_engines"); + m_config.watch("general", "embed_preedit_text"); m_config.watch("general", "engines_order"); m_config.watch("general", "switcher_delay_time"); m_config.watch("general", "use_system_keyboard_layout"); @@ -307,6 +324,7 @@ class Panel : IBus.PanelService { unbind_switch_shortcut(); bind_switch_shortcut(null); set_switcher_delay_time(null); + set_embed_preedit_text(null); } else { update_engines(null, null); } @@ -408,6 +426,11 @@ class Panel : IBus.PanelService { set_use_system_keyboard_layout(variant); return; } + + if (section == "general" && name == "embed_preedit_text") { + set_embed_preedit_text(variant); + return; + } } private void handle_engine_switch(Gdk.Event event, bool revert) { -- 1.8.0 From 927e9f58da9b4a9898403c8e339109e2ad2fa966 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Mon, 13 May 2013 11:47:29 +0900 Subject: [PATCH] Check GtkIMContext:input-purpose to disable IM on lock screen Recent GtkIMContext has "input-purpose" property, which can be used to check if the target widget is a password entry, in a more reliable way. BUG=none R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/7064059 --- client/gtk2/ibusimcontext.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index 49598b4..3694dd4 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -803,6 +803,18 @@ ibus_im_context_focus_in (GtkIMContext *context) return; /* don't set focus on password entry */ +#if GTK_CHECK_VERSION (3, 6, 0) + { + GtkInputPurpose purpose; + + g_object_get (G_OBJECT (context), + "input-purpose", &purpose, + NULL); + + if (purpose == GTK_INPUT_PURPOSE_PASSWORD) + return; + } +#endif if (ibusimcontext->client_window != NULL) { GtkWidget *widget; -- 1.8.0 From f3d80dc026853c1024cdf6bda31b1496939cb095 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Mon, 13 May 2013 16:36:19 +0900 Subject: [PATCH] Defalut triggers key is changed to space. We have been used space as the default triggers key. GNOME3 and Windows7 applied space as the default trigger key and IBus follows it for the consistent key between desktops. BUG=RH#953404 Review URL: https://codereview.appspot.com/9081043 --- data/ibus.schemas.in | 2 +- setup/main.py | 2 +- ui/gtk3/panel.vala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in index 54ccb4c..9263adc 100644 --- a/data/ibus.schemas.in +++ b/data/ibus.schemas.in @@ -59,7 +59,7 @@ ibus list string - [<Control>space] + [<Super>space] Trigger shortcut keys for gtk_accelerator_parse The shortcut keys for turning input method on or off diff --git a/setup/main.py b/setup/main.py index 707faa4..0281ac7 100644 --- a/setup/main.py +++ b/setup/main.py @@ -89,7 +89,7 @@ class Setup(object): if variant != None: shortcuts = variant.unpack() else: - shortcuts = ['space'] + shortcuts = ['space'] button = self.__builder.get_object("button_%s" % label) entry = self.__builder.get_object("entry_%s" % label) diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala index 8090a42..0c793f4 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala @@ -49,7 +49,7 @@ class Panel : IBus.PanelService { private Gtk.CssProvider m_css_provider; private int m_switcher_delay_time = 400; private bool m_use_system_keyboard_layout = false; - private const string ACCELERATOR_SWITCH_IME_FOREWARD = "space"; + private const string ACCELERATOR_SWITCH_IME_FOREWARD = "space"; private GLib.List m_keybindings = new GLib.List(); @@ -74,7 +74,7 @@ class Panel : IBus.PanelService { m_candidate_panel.page_down.connect((w) => this.page_down()); m_switcher = new Switcher(); - // The initial shortcut is "space" + // The initial shortcut is "space" bind_switch_shortcut(null); if (m_switcher_delay_time >= 0) { -- 1.8.0 From 3c96d67404da274c34631ad821da736cf55a2b62 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 15 May 2013 12:03:54 +0900 Subject: [PATCH] Add man files of /usr/bin files. Review URL: https://codereview.appspot.com/9413043 --- bus/Makefile.am | 21 ++++++++++++-- bus/ibus-daemon.1.in | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup/Makefile.am | 18 ++++++++++-- setup/ibus-setup.1.in | 33 ++++++++++++++++++++++ tools/Makefile.am | 21 ++++++++++++-- tools/ibus.1.in | 58 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 222 insertions(+), 6 deletions(-) create mode 100644 bus/ibus-daemon.1.in create mode 100644 setup/ibus-setup.1.in create mode 100644 tools/ibus.1.in diff --git a/bus/Makefile.am b/bus/Makefile.am index 7024b8f..f06b70c 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -2,8 +2,8 @@ # # ibus - The Input Bus # -# Copyright (c) 2007-2010 Peng Huang -# Copyright (c) 2007-2010 Red Hat, Inc. +# Copyright (c) 2007-2013 Peng Huang +# Copyright (c) 2007-2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -162,6 +162,7 @@ test_stress_LDADD = \ EXTRA_DIST = \ $(desktop_in_files) \ + $(man_one_in_files) \ marshalers.list \ $(NULL) @@ -169,6 +170,11 @@ DISTCLEANFILES = \ $(desktop_DATA) \ $(NULL) +CLEANFILES = \ + $(man_one_DATA) \ + $(man_one_files) \ + $(NULL) + $(libibus): $(MAKE) -C $(top_builddir)/src @@ -182,4 +188,15 @@ desktop_in_files = ibus.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ +man_one_in_files = ibus-daemon.1.in +man_one_files = $(man_one_in_files:.1.in=.1) +man_one_DATA =$(man_one_files:.1=.1.gz) +man_onedir = $(datadir)/man/man1 +%.1: %.1.in + $(AM_V_GEN) sed \ + -e 's|@VERSION[@]|$(VERSION)|g' $< > $@.tmp && \ + mv $@.tmp $@ +%.1.gz: %.1 + $(AM_V_GEN) gzip -c $< > $@.tmp && mv $@.tmp $@ + -include $(top_srcdir)/git.mk diff --git a/bus/ibus-daemon.1.in b/bus/ibus-daemon.1.in new file mode 100644 index 0000000..74e7431 --- /dev/null +++ b/bus/ibus-daemon.1.in @@ -0,0 +1,77 @@ +.\" This file is distributed under the same license as the ibus +.\" package. +.\" Copyright (C) Takao Fujiwara , 2013. +.\" Copyright (c) Peng Huang , 2013. +.\" +.TH IBUS-DAEMON "1" "April 2010" "@VERSION@" "User Commands" +.SH NAME +.B ibus\-daemon +\- daemon program for ibus + +.SH SYNOPSIS +.B ibus\-daemon +[\fIOPTION\fR]... + +.SH DESCRIPTION + +.PP +IBus is an Intelligent Input Bus. It is a new input framework for Linux +OS. It provides full featured and user friendly input method user +interface. It also may help developers to develop input method easily. + +.PP +.B ibus\-daemon +is a daemon program for ibus and it is also a start up program for users +to activate ibus daemon, engines and panel. + +.SS "Help Options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +Show help options + +.SS "Application Options:" +.TP +\fB\-d\fR, \fB\-\-daemonize\fR +run ibus as background process. +.TP +\fB\-s\fR, \fB\-\-single\fR +do not execute panel and config module. +.TP +\fB\-x\fR, \fB\-\-xim\fR +execute ibus XIM server. +.TP +\fB\-n\fR, \fB\-\-desktop\fR=\fIname\fR +specify the name of desktop session. [default=gnome] +.TP +\fB\-p\fR, \fB\-\-panel\fR=\fIcmdline\fR +specify the cmdline of panel program. +.TP +\fB\-c\fR, \fB\-\-config\fR=\fIcmdline\fR +specify the cmdline of config program. +.TP +\fB\-a\fR, \fB\-\-address\fR=\fIaddress\fR +specify the address of ibus daemon. +.TP +\fB\-r\fR, \fB\-\-replace\fR +if there is an old ibus\-daemon is running, it will be replaced. +.TP +\fB\-t\fR, \fB\-\-re\-scan\fR +force to re\-scan components, and re\-create registry cache. +.TP +\fB\-o\fR, \fB\-\-timeout\fR=\fItimeout\fR [default is 2000] +dbus reply timeout in milliseconds. +.TP +\fB\-j\fR, \fB\-\-monitor\-timeout\fR=\fItimeout\fR [default is 0] +timeout of poll changes of engines in seconds. 0 to disable it. +.TP +\fB\-m\fR, \fB\-\-mem\-profile\fR +enable memory profile, send SIGUSR2 to print out the memory profile. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbose. + +.SH BUGS +If you find a bug, please report it at http://code.google.com/p/ibus/issues/list + +.SH "SEE ALSO" +.BR ibus (1) diff --git a/setup/Makefile.am b/setup/Makefile.am index 9618d7f..5274f19 100644 --- a/setup/Makefile.am +++ b/setup/Makefile.am @@ -2,8 +2,8 @@ # # ibus - The Input Bus # -# Copyright (c) 2007-2010 Peng Huang -# Copyright (c) 2007-2010 Red Hat, Inc. +# Copyright (c) 2007-2013 Peng Huang +# Copyright (c) 2007-2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -42,12 +42,26 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) desktopdir = $(datadir)/applications @INTLTOOL_DESKTOP_RULE@ +man_one_in_files = ibus-setup.1.in +man_one_files = $(man_one_in_files:.1.in=.1) +man_one_DATA =$(man_one_files:.1=.1.gz) +man_onedir = $(datadir)/man/man1 +%.1: %.1.in + $(AM_V_GEN) sed \ + -e 's|@VERSION[@]|$(VERSION)|g' $< > $@.tmp && \ + mv $@.tmp $@ +%.1.gz: %.1 + $(AM_V_GEN) gzip -c $< > $@.tmp && mv $@.tmp $@ + CLEANFILES = \ + $(man_one_DATA) \ + $(man_one_files) \ *.pyc \ ibus-setup \ $(NULL) EXTRA_DIST = \ + $(man_one_in_files) \ ibus-setup.in \ setup.ui \ ibus-setup.desktop.in \ diff --git a/setup/ibus-setup.1.in b/setup/ibus-setup.1.in new file mode 100644 index 0000000..3daafe4 --- /dev/null +++ b/setup/ibus-setup.1.in @@ -0,0 +1,33 @@ +.\" This file is distributed under the same license as the ibus +.\" package. +.\" Copyright (C) LI Daobing , 2008. +.\" Copyright (C) Takao Fujiwara , 2013. +.\" Copyright (c) Peng Huang , 2013. +.\" +.TH "IBUS-SETUP" 1 "November 2008" "@VERSION@" "User Commands" +.SH NAME +.B ibus-setup +\- configuration program for ibus + +.SH "SYNOPSIS" +.B ibus-setup + +.SH "DESCRIPTION" + +.PP +IBus is an Intelligent Input Bus. It is a new input framework for Linux +OS. It provides full featured and user friendly input method user +interface. It also may help developers to develop input method easily. + +.PP +.B ibus-setup +is the configuration program for IBus. + +.PP +Homepage: http://code.google.com/p/ibus/ + +.SH BUGS +If you find a bug, please report it at http://code.google.com/p/ibus/issues/list + +.SH "SEE ALSO" +.BR ibus (1) diff --git a/tools/Makefile.am b/tools/Makefile.am index 5aa1099..65d1877 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -2,8 +2,8 @@ # # ibus - The Input Bus # -# Copyright (c) 2007-2010 Peng Huang -# Copyright (c) 2007-2010 Red Hat, Inc. +# Copyright (c) 2007-2013 Peng Huang +# Copyright (c) 2007-2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -75,8 +75,25 @@ bash_completion_DATA= \ $(NULL) bash_completiondir=@datadir@/bash-completion/completions +man_one_in_files = ibus.1.in +man_one_files = $(man_one_in_files:.1.in=.1) +man_one_DATA =$(man_one_files:.1=.1.gz) +man_onedir = $(datadir)/man/man1 +%.1: %.1.in + $(AM_V_GEN) sed \ + -e 's|@VERSION[@]|$(VERSION)|g' $< > $@.tmp && \ + mv $@.tmp $@ +%.1.gz: %.1 + $(AM_V_GEN) gzip -c $< > $@.tmp && mv $@.tmp $@ + EXTRA_DIST = \ + $(man_one_in_files) \ ibus.bash \ $(NULL) +CLEANFILES = \ + $(man_one_DATA) \ + $(man_one_files) \ + $(NULL) + -include $(top_srcdir)/git.mk diff --git a/tools/ibus.1.in b/tools/ibus.1.in new file mode 100644 index 0000000..05bf63d --- /dev/null +++ b/tools/ibus.1.in @@ -0,0 +1,58 @@ +.\" This file is distributed under the same license as the ibus +.\" package. +.\" Copyright (C) Takao Fujiwara , 2013. +.\" Copyright (c) Peng Huang , 2013. +.\" +.TH "IBUS" 1 "May 2013" "@VERSION@" "User Commands" +.SH NAME +.B ibus +\- command line utility for ibus + +.SH "SYNOPSIS" +.B ibus +\fICOMMAND\fR [\fIOPTION\fR]... + +.SH "DESCRIPTION" + +.PP +IBus is an Intelligent Input Bus. It is a new input framework for Linux +OS. It provides full featured and user friendly input method user +interface. It also may help developers to develop input method easily. + +.PP +.B ibus +is a command line utility which can restart or exit ibus-daemon, +get or set the current ibus engine or list the ibus engines. + +.PP +Homepage: http://code.google.com/p/ibus/ + +.SH "COMMAND" +.TP +\fBhelp\fR +Show the commands list. +.TP +\fBengine\fR [\fBENGINE_NAME\fR] +Show the curent ibus engine when +.B ENGINE_NAME +is not given. Set +.B ENGINE_NAME +to the current ibus engine. +.TP +\fBexit\fR +Exit ibus-daemon. +.TP +\fBlist-engine\fR +Show ibus engines list. +.TP +\fBrestart\fR +Restart ibus-daemon. +.TP +\fBversion\fR +Show the ibus version. +.TP +\fBwatch\fR +Under construction. + +.SH BUGS +If you find a bug, please report it at http://code.google.com/p/ibus/issues/list. -- 1.8.0 From 62f07b7a6904b8b03a59f3baf413becb2d5d9e14 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 17 May 2013 12:12:54 +0900 Subject: [PATCH] Let users know the default hotkey is Super+space with libnotify. Review URL: https://codereview.appspot.com/9407043 --- configure.ac | 20 +++++++++-- data/ibus.schemas.in | 14 ++++++++ ui/gtk3/Makefile.am | 19 +++++++++-- ui/gtk3/panel.vala | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 141 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 3036792..781bbf5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,8 @@ # # ibus - The Input Bus # -# Copyright (c) 2007-2010 Peng Huang -# Copyright (c) 2007-2010 Red Hat, Inc. +# Copyright (c) 2007-2013 Peng Huang +# Copyright (c) 2007-2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -498,6 +498,21 @@ if test x"$enable_engine" = x"yes"; then enable_engine="yes (enabled, use --disable-engine to disable)" fi +# --disable-libnotify +AC_ARG_ENABLE(libnotify, + AS_HELP_STRING([--disable-libnotify], + [Disable to link libnotify]), + [enable_libnotify=$enableval], + [enable_libnotify=yes] +) +AM_CONDITIONAL([ENABLE_LIBNOTIFY], [test x"$enable_libnotify" = x"yes"]) +if test x"$enable_libnotify" = x"yes"; then + PKG_CHECK_MODULES(LIBNOTIFY, [ + libnotify >= 0.7 + ]) + enable_libnotify="yes (enabled, use --disable-libnotify to disable)" +fi + # Check iso-codes. PKG_CHECK_MODULES(ISOCODES, [ iso-codes @@ -574,6 +589,7 @@ Build options: No snooper regexes "$NO_SNOOPER_APPS" Panel icon "$IBUS_ICON_KEYBOARD" Enable surrounding-text $enable_surrounding_text + Enable libnotify $enable_libnotify Run test cases $enable_tests ]) diff --git a/data/ibus.schemas.in b/data/ibus.schemas.in index 9263adc..9cfe83b 100644 --- a/data/ibus.schemas.in +++ b/data/ibus.schemas.in @@ -42,6 +42,20 @@ + /schemas/desktop/ibus/general/version + /desktop/ibus/general/version + ibus + string + + + Saved version number + The saved version number will be used to check the + difference between the version of the previous installed + ibus and one of the current ibus. + + + + /schemas/desktop/ibus/general/hotkey/trigger /desktop/ibus/general/hotkey/trigger ibus diff --git a/ui/gtk3/Makefile.am b/ui/gtk3/Makefile.am index 43454bc..2038814 100644 --- a/ui/gtk3/Makefile.am +++ b/ui/gtk3/Makefile.am @@ -2,8 +2,8 @@ # # ibus - The Input Bus # -# Copyright (c) 2007-2010 Peng Huang -# Copyright (c) 2007-2010 Red Hat, Inc. +# Copyright (c) 2007-2013 Peng Huang +# Copyright (c) 2007-2013 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -83,6 +83,21 @@ AM_VALAFLAGS = \ --pkg=xi \ $(NULL) +if ENABLE_LIBNOTIFY +AM_CFLAGS += \ + @LIBNOTIFY_CFLAGS@ \ + $(NULL) + +AM_LDADD += \ + @LIBNOTIFY_LIBS@ \ + $(NULL) + +AM_VALAFLAGS += \ + --pkg=libnotify \ + -D ENABLE_LIBNOTIFY \ + $(NULL) +endif + libexec_PROGRAMS = ibus-ui-gtk3 ibus_ui_gtk3_SOURCES = \ diff --git a/ui/gtk3/panel.vala b/ui/gtk3/panel.vala index 0c793f4..39aca08 100644 --- a/ui/gtk3/panel.vala +++ b/ui/gtk3/panel.vala @@ -298,6 +298,95 @@ class Panel : IBus.PanelService { var_embed_preedit); } + private int compare_versions(string version1, string version2) { + string[] version1_list = version1.split("."); + string[] version2_list = version2.split("."); + int major1, minor1, micro1, major2, minor2, micro2; + + if (version1 == version2) { + return 0; + } + + // The initial dconf value of "version" is "". + if (version1 == "") { + return -1; + } + if (version2 == "") { + return 1; + } + + assert(version1_list.length >= 3); + assert(version2_list.length >= 3); + + major1 = int.parse(version1_list[0]); + minor1 = int.parse(version1_list[1]); + micro1 = int.parse(version1_list[2]); + + major2 = int.parse(version2_list[0]); + minor2 = int.parse(version2_list[1]); + micro2 = int.parse(version2_list[2]); + + if (major1 == minor1 && minor1 == minor2 && micro1 == micro2) { + return 0; + } + if ((major1 > major2) || + (major1 == major2 && minor1 > minor2) || + (major1 == major2 && minor1 == minor2 && + micro1 > micro2)) { + return 1; + } + return -1; + } + + private void update_version_1_5_3() { +#if ENABLE_LIBNOTIFY + if (!Notify.is_initted()) { + Notify.init ("ibus"); + } + + var notification = new Notify.Notification( + _("IBus Update"), + _("Super+space is now the default hotkey."), + "ibus"); + notification.set_timeout(30 * 1000); + notification.set_category("hotkey"); + + try { + notification.show(); + } catch (GLib.Error e){ + warning ("Notification is failed for IBus 1.5.3: %s", e.message); + } +#else + warning(_("Super+space is now the default hotkey.")); +#endif + } + + private void set_version() { + Variant var_prev_version = m_config.get_value("general", "version"); + Variant var_current_version = null; + string prev_version = "".dup(); + string current_version = null; + + if (var_prev_version != null) { + prev_version = var_prev_version.dup_string(); + } + + if (compare_versions(prev_version, "1.5.3") < 0) { + update_version_1_5_3(); + } + + current_version = "%d.%d.%d".printf(IBus.MAJOR_VERSION, + IBus.MINOR_VERSION, + IBus.MICRO_VERSION); + + if (prev_version == current_version) { + return; + } + + var_current_version = new Variant.string(current_version); + m_config.set_value("general", "version", var_current_version); + } + public void set_config(IBus.Config config) { if (m_config != null) { m_config.value_changed.disconnect(config_value_changed_cb); @@ -325,11 +414,12 @@ class Panel : IBus.PanelService { bind_switch_shortcut(null); set_switcher_delay_time(null); set_embed_preedit_text(null); + set_custom_font(); + + set_version(); } else { update_engines(null, null); } - - set_custom_font(); } private void exec_setxkbmap(IBus.EngineDesc engine) { -- 1.8.0