diff options
author | dchen@redhat.com <dchen@dchen.redhat.com> | 2009-03-02 18:04:40 +1000 |
---|---|---|
committer | dchen@redhat.com <dchen@dchen.redhat.com> | 2009-03-02 18:04:40 +1000 |
commit | 51e8ab1d6a150bd9a15ba3babb62b56fbfb901e0 (patch) | |
tree | b6fe3fcacf5fdb3b9148eb7a4d3b28a0bc8cb930 | |
parent | 20b85933abf477ba50495a8793890d3511dad9f2 (diff) | |
parent | cd4d9b6ebfa4a66ba6bd89c5b7d2b34eb25864af (diff) | |
download | ibus-51e8ab1d6a150bd9a15ba3babb62b56fbfb901e0.tar.gz ibus-51e8ab1d6a150bd9a15ba3babb62b56fbfb901e0.tar.xz ibus-51e8ab1d6a150bd9a15ba3babb62b56fbfb901e0.zip |
GTKDOC
-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | bus/Makefile.am | 9 | ||||
-rw-r--r-- | bus/dbusimpl.c | 11 | ||||
-rw-r--r-- | bus/ibus.desktop | 10 | ||||
-rw-r--r-- | bus/ibusimpl.c | 264 | ||||
-rw-r--r-- | bus/inputcontext.c | 41 | ||||
-rw-r--r-- | bus/inputcontext.h | 5 | ||||
-rw-r--r-- | bus/main.c | 15 | ||||
-rw-r--r-- | bus/matchrule.c | 11 | ||||
-rw-r--r-- | bus/matchrule.h | 5 | ||||
-rw-r--r-- | bus/registry.c | 28 | ||||
-rw-r--r-- | bus/registry.h | 3 | ||||
-rw-r--r-- | bus/server.c | 20 | ||||
-rw-r--r-- | client/gtk2/ibusimcontext.c | 9 | ||||
-rw-r--r-- | configure.ac | 50 | ||||
-rw-r--r-- | data/Makefile.am | 43 | ||||
-rw-r--r-- | data/ibus.schemas | 96 | ||||
-rw-r--r-- | data/icons/Makefile.am (renamed from icons/Makefile.am) | 0 | ||||
-rw-r--r-- | data/icons/engine-default.svg (renamed from icons/engine-default.svg) | 0 | ||||
-rw-r--r-- | data/icons/ibus-help.png (renamed from icons/ibus-help.png) | bin | 13998 -> 13998 bytes | |||
-rw-r--r-- | data/icons/ibus-keyboard.svg (renamed from icons/ibus-keyboard.svg) | 0 | ||||
-rw-r--r-- | data/icons/ibus-locale.svg (renamed from icons/ibus-locale.svg) | 0 | ||||
l--------- | data/icons/ibus-setup.svg (renamed from icons/ibus-setup.svg) | 0 | ||||
-rw-r--r-- | data/icons/ibus-zh.svg (renamed from icons/ibus-zh.svg) | 0 | ||||
-rw-r--r-- | data/icons/ibus.svg (renamed from icons/ibus.svg) | 0 | ||||
-rw-r--r-- | docs/reference/ibus/Makefile.am | 5 | ||||
-rw-r--r-- | docs/reference/ibus/ibus-docs.sgml | 80 | ||||
-rw-r--r-- | ibus.sh | 6 | ||||
-rw-r--r-- | ibus/Makefile.am | 3 | ||||
-rw-r--r-- | po/fr.po | 79 | ||||
-rw-r--r-- | po/ja.po | 63 | ||||
-rw-r--r-- | po/pa.po | 63 | ||||
-rw-r--r-- | po/zh_CN.po | 64 | ||||
-rw-r--r-- | setup/enginecombobox.py | 9 | ||||
-rw-r--r-- | setup/setup.glade | 1 | ||||
-rw-r--r-- | src/ibusattribute.h | 128 | ||||
-rw-r--r-- | src/ibuscomponent.c | 6 | ||||
-rw-r--r-- | src/ibusenginedesc.c | 12 | ||||
-rw-r--r-- | src/ibusenginedesc.h | 1 | ||||
-rw-r--r-- | src/ibusobject.h | 30 | ||||
-rw-r--r-- | src/ibusserver.c | 33 | ||||
-rw-r--r-- | src/ibustext.c | 22 |
42 files changed, 968 insertions, 267 deletions
diff --git a/Makefile.am b/Makefile.am index 47a21d0..c6e8d79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ client \ setup \ bus \ - icons \ + data \ m4 \ po \ docs \ @@ -40,11 +40,17 @@ ACLOCAL_AMFLAGS = -I m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = ibus-1.0.pc +# xinitrc_SCRIPTS = \ +# ibus.sh \ +# $(NULL) +# xinitrcdir = $(sysconfdir)/X11/xinit/xinitrc.d + EXTRA_DIST = \ autogen.sh \ ibus-1.0.pc.in \ ibus.spec.in \ python-config.py \ + ibus.sh \ $(NULL) noinst_DIST = \ @@ -59,8 +65,8 @@ install-data-hook: $(MKDIR_P) $(DESTDIR)${pkgdatadir}/engine DISTCHECK_CONFIGURE_FLAGS = \ - --enable-pygconf \ --enable-gtk-doc \ + --disable-schemas-install \ $(NULL) rpm: dist @PACKAGE_NAME@.spec diff --git a/bus/Makefile.am b/bus/Makefile.am index 03ddfb3..526ac21 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -42,8 +42,13 @@ AM_LDFLAGS = \ TESTS = \ test-matchrule \ $(NULL) - -desktop_DATA = ibus.desktop +xdgautostart_DATA = \ + ibus.desktop \ + $(NULL) +xdgautostartdir = $(sysconfdir)/xdg/autostart +desktop_DATA = \ + ibus.desktop \ + $(NULL) desktopdir = $(datadir)/applications noinst_PROGRAMS = $(TESTS) diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c index f8b8566..3cc51dc 100644 --- a/bus/dbusimpl.c +++ b/bus/dbusimpl.c @@ -819,6 +819,7 @@ _connection_ibus_message_cb (BusConnection *connection, ibus_message_set_sender (message, bus_connection_get_unique_name (connection)); switch (ibus_message_get_type (message)) { +#if 1 case DBUS_MESSAGE_TYPE_ERROR: g_debug ("From :%s to %s, Error: %s : %s", ibus_message_get_sender (message), @@ -826,6 +827,7 @@ _connection_ibus_message_cb (BusConnection *connection, ibus_message_get_error_name (message), ibus_message_get_error_message (message)); break; +#endif #if 0 case DBUS_MESSAGE_TYPE_METHOD_CALL: g_debug("From %s to %s, Method %s on %s", @@ -1066,11 +1068,10 @@ bus_dbus_impl_dispatch_message_by_rule (BusDBusImpl *dbus, #endif for (link = dbus->rules; link != NULL; link = link->next) { - if (bus_match_rule_get_recipients (BUS_MATCH_RULE (link->data), - message, - &recipients)) { + recipients = bus_match_rule_get_recipients (BUS_MATCH_RULE (link->data), + message); + if (recipients != NULL) break; - } } for (link = recipients; link != NULL; link = link->next) { @@ -1078,7 +1079,7 @@ bus_dbus_impl_dispatch_message_by_rule (BusDBusImpl *dbus, if (connection != skip_connection) { ibus_connection_send (IBUS_CONNECTION (connection), message); } - g_object_unref (link->data); + g_object_unref (connection); } g_list_free (recipients); } diff --git a/bus/ibus.desktop b/bus/ibus.desktop index fd98021..6336dfd 100644 --- a/bus/ibus.desktop +++ b/bus/ibus.desktop @@ -1,11 +1,13 @@ [Desktop Entry] Encoding=UTF-8 Name=IBus -GenericName=Intelligent Input Bus -Comment=Intellignent Input Bus +GenericName=IBus input method framework +Comment=IBus input method framework Exec=ibus-daemon --xim Icon=ibus Terminal=false Type=Application -StartupNotify=false -Categories=Utility; +X-GNOME-Autostart-Phase=Panel +X-GNOME-AutoRestart=false +X-GNOME-Autostart-Notify=true +X-KDE-autostart-after=panel diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 053080f..814e831 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -23,6 +23,8 @@ #include <sys/wait.h> #include <signal.h> #include <stdlib.h> +#include <locale.h> +#include <strings.h> #include "ibusimpl.h" #include "dbusimpl.h" #include "server.h" @@ -130,22 +132,18 @@ _panel_destroy_cb (BusPanelProxy *panel, } static void -bus_ibus_impl_set_trigger (BusIBusImpl *ibus, - GValue *value) +bus_ibus_impl_set_hotkey (BusIBusImpl *ibus, + GQuark hotkey, + GValue *value) { g_assert (BUS_IS_IBUS_IMPL (ibus)); GValueArray *array; gint i; - ibus_hotkey_profile_remove_hotkey_by_event (ibus->hotkey_profile, - g_quark_from_static_string ("trigger")); + ibus_hotkey_profile_remove_hotkey_by_event (ibus->hotkey_profile, hotkey); if (value == NULL) { - ibus_hotkey_profile_add_hotkey (ibus->hotkey_profile, - IBUS_space, - IBUS_CONTROL_MASK, - g_quark_from_static_string ("trigger")); return; } @@ -160,8 +158,39 @@ bus_ibus_impl_set_trigger (BusIBusImpl *ibus, ibus_hotkey_profile_add_hotkey_from_string (ibus->hotkey_profile, g_value_get_string (str), - g_quark_from_static_string ("trigger")); + hotkey); } + +} + +static void +bus_ibus_impl_set_trigger (BusIBusImpl *ibus, + GValue *value) +{ + GQuark hotkey = g_quark_from_static_string ("trigger"); + bus_ibus_impl_set_hotkey (ibus, hotkey, value); + if (value == NULL) { + ibus_hotkey_profile_add_hotkey (ibus->hotkey_profile, + IBUS_space, + IBUS_CONTROL_MASK, + hotkey); + } +} + +static void +bus_ibus_impl_set_next_engine (BusIBusImpl *ibus, + GValue *value) +{ + GQuark hotkey = g_quark_from_static_string ("next-engine"); + bus_ibus_impl_set_hotkey (ibus, hotkey, value); +} + +static void +bus_ibus_impl_set_prev_engine (BusIBusImpl *ibus, + GValue *value) +{ + GQuark hotkey = g_quark_from_static_string ("prev-engine"); + bus_ibus_impl_set_hotkey (ibus, hotkey, value); } static void @@ -198,6 +227,78 @@ bus_ibus_impl_set_preload_engines (BusIBusImpl *ibus, g_list_foreach (engine_list, (GFunc) g_object_ref, NULL); ibus->engine_list = engine_list; + + if (ibus->engine_list) { + IBusComponent *component; + + component = ibus_component_get_from_engine ((IBusEngineDesc *) ibus->engine_list->data); + if (component && !ibus_component_is_running (component)) { + ibus_component_start (component); + } + } +} + +static gint +_engine_desc_cmp (IBusEngineDesc *desc1, + IBusEngineDesc *desc2) +{ + return - ((gint) desc1->rank) + ((gint) desc2->rank); +} + +static void +bus_ibus_impl_set_default_preload_engines (BusIBusImpl *ibus) +{ + g_assert (BUS_IS_IBUS_IMPL (ibus)); + + static gboolean done = FALSE; + GValue value = { 0 }; + GList *engines, *l; + gchar *lang, *p; + GValueArray *array; + + if (done || ibus->config == NULL) { + return; + } + + if (ibus_config_get_value (ibus->config, "general", "preload_engines", &value)) { + done = TRUE; + g_value_unset (&value); + return; + } + + done = TRUE; + lang = g_strdup (setlocale (LC_ALL, NULL)); + p = index (lang, '.'); + if (p) { + *p = '\0'; + } + + engines = bus_registry_get_engines_by_language (ibus->registry, lang); + if (engines == NULL) { + p = index (lang, '_'); + if (p) { + *p = '\0'; + engines = bus_registry_get_engines_by_language (ibus->registry, lang); + } + } + + engines = g_list_sort (engines, (GCompareFunc) _engine_desc_cmp); + g_free (lang); + + g_value_init (&value, G_TYPE_VALUE_ARRAY); + array = g_value_array_new (5); + for (l = engines; l != NULL; l = l->next) { + IBusEngineDesc *desc; + GValue name = { 0 }; + desc = (IBusEngineDesc *)l->data; + g_value_init (&name, G_TYPE_STRING); + g_value_set_string (&name, desc->name); + g_value_array_append (array, &name); + } + g_value_take_boxed (&value, array); + ibus_config_set_value (ibus->config, "general", "preload_engines", &value); + g_value_unset (&value); + g_list_free (engines); } static void @@ -214,6 +315,8 @@ bus_ibus_impl_reload_config (BusIBusImpl *ibus) void ( *func) (BusIBusImpl *, GValue *); } entries [] = { { "general/hotkey", "trigger", bus_ibus_impl_set_trigger }, + { "general/hotkey", "next_engine", bus_ibus_impl_set_next_engine }, + { "general/hotkey", "prev_engine", bus_ibus_impl_set_prev_engine }, { "general", "preload_engines", bus_ibus_impl_set_preload_engines }, { NULL, NULL, NULL }, }; @@ -253,8 +356,10 @@ _config_value_changed_cb (IBusConfig *config, gchar *key; void ( *func) (BusIBusImpl *, GValue *); } entries [] = { - { "general/hotkey", "trigger", bus_ibus_impl_set_trigger }, - { "general", "preload_engines", bus_ibus_impl_set_preload_engines }, + { "general/hotkey", "trigger", bus_ibus_impl_set_trigger }, + { "general/hotkey", "next_engine", bus_ibus_impl_set_next_engine }, + { "general/hotkey", "prev_engine", bus_ibus_impl_set_prev_engine }, + { "general", "preload_engines", bus_ibus_impl_set_preload_engines }, { NULL, NULL, NULL }, }; @@ -347,6 +452,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus, G_CALLBACK (_config_destroy_cb), ibus); + bus_ibus_impl_set_default_preload_engines (ibus); bus_ibus_impl_reload_config (ibus); } } @@ -406,7 +512,7 @@ bus_ibus_impl_destroy (BusIBusImpl *ibus) break; } if (pid == 0) { /* no child status changed */ - usleep (1000); + g_usleep (1000); timeout += 1000; if (timeout >= G_USEC_PER_SEC) { if (flag == FALSE) { @@ -504,14 +610,58 @@ _ibus_get_address (BusIBusImpl *ibus, return reply; } +static BusEngineProxy * +bus_ibus_impl_create_engine (IBusEngineDesc *engine_desc) +{ + IBusComponent *comp; + BusFactoryProxy *factory; + BusEngineProxy *engine; + + factory = bus_factory_proxy_get_from_engine (engine_desc); + + if (factory == NULL) { + /* try to execute the engine */ + comp = ibus_component_get_from_engine (engine_desc); + g_assert (comp); + + if (!ibus_component_is_running (comp)) { + ibus_component_start (comp); + + gint time = 0; + while (time < G_USEC_PER_SEC * 3) { + if (g_main_context_pending (NULL)) { + g_main_context_iteration (NULL, FALSE); + } + else { + g_usleep (50 * 1000); + time += 50 * 1000; + } + factory = bus_factory_proxy_get_from_engine (engine_desc); + if (factory != NULL) { + break; + } + } + } + factory = bus_factory_proxy_get_from_engine (engine_desc); + } + + if (factory == NULL) { + return NULL; + } + + g_object_ref (factory); + engine = bus_factory_proxy_create_engine (factory, engine_desc); + g_object_unref (factory); + + return engine; +} + static void _context_request_engine_cb (BusInputContext *context, gchar *engine_name, BusIBusImpl *ibus) { IBusEngineDesc *engine_desc = NULL; - IBusComponent *comp; - BusFactoryProxy *factory; BusEngineProxy *engine; if (engine_name == NULL || engine_name[0] == '\0') { @@ -553,44 +703,15 @@ _context_request_engine_cb (BusInputContext *context, } } - if (engine_desc == NULL) + if (engine_desc == NULL) { return; - - factory = bus_factory_proxy_get_from_engine (engine_desc); - - if (factory == NULL) { - /* try to execute the engine */ - comp = ibus_component_get_from_engine (engine_desc); - g_assert (comp); - - if (!ibus_component_is_running (comp)) { - ibus_component_start (comp); - - gint time = 0; - while (time < G_USEC_PER_SEC * 3) { - if (g_main_context_pending (NULL)) { - g_main_context_iteration (NULL, FALSE); - } - else { - g_usleep (50 * 1000); - time += 50 * 1000; - } - factory = bus_factory_proxy_get_from_engine (engine_desc); - if (factory != NULL) { - break; - } - } - } - factory = bus_factory_proxy_get_from_engine (engine_desc); } - if (factory == NULL) - return; + engine = bus_ibus_impl_create_engine (engine_desc); - engine = bus_factory_proxy_create_engine (factory, engine_desc); - - if (engine == NULL) + if (engine == NULL) { return; + } bus_input_context_set_engine (context, engine); g_object_unref (engine); @@ -600,7 +721,47 @@ static void _context_request_next_engine_cb (BusInputContext *context, BusIBusImpl *ibus) { + BusEngineProxy *engine; + IBusEngineDesc *desc; + IBusEngineDesc *next_desc = NULL; + GList *p; + + engine = bus_input_context_get_engine (context); + if (engine == NULL) { + _context_request_engine_cb (context, NULL, ibus); + return; + } + + desc = bus_engine_proxy_get_desc (engine); + + p = g_list_find (ibus->register_engine_list, desc); + if (p != NULL) { + p = p->next; + } + if (p == NULL) { + p = g_list_find (ibus->engine_list, desc); + if (p != NULL) { + p = p->next; + } + } + if (p != NULL) { + next_desc = (IBusEngineDesc*) p->data; + } + else { + if (ibus->register_engine_list) { + next_desc = (IBusEngineDesc *)ibus->register_engine_list->data; + } + else if (ibus->engine_list) { + next_desc = (IBusEngineDesc *)ibus->engine_list->data; + } + } + + if (next_desc != NULL) { + engine = bus_ibus_impl_create_engine (next_desc); + bus_input_context_set_engine (context, engine); + g_object_unref (engine); + } } static void @@ -699,8 +860,6 @@ _ibus_create_input_context (BusIBusImpl *ibus, context = bus_input_context_new (connection, client); ibus->contexts = g_list_append (ibus->contexts, context); - _context_request_engine_cb (context, NULL, ibus); - static const struct { gchar *name; GCallback callback; @@ -905,12 +1064,19 @@ _ibus_exit (BusIBusImpl *ibus, else { extern gchar **g_argv; gchar *exe; + gint fd; exe = g_strdup_printf ("/proc/%d/exe", getpid ()); if (!g_file_test (exe, G_FILE_TEST_EXISTS)) { g_free (exe); exe = g_argv[0]; } + + /* close all fds except stdin, stdout, stderr */ + for (fd = 3; fd <= sysconf (_SC_OPEN_MAX); fd ++) { + close (fd); + } + execv (exe, g_argv); g_warning ("execv %s failed!", g_argv[0]); exit (-1); diff --git a/bus/inputcontext.c b/bus/inputcontext.c index 6ba7322..d857479 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -1022,7 +1022,7 @@ bus_input_context_ibus_message (BusInputContext *context, gboolean -bus_input_context_is_focus (BusInputContext *context) +bus_input_context_has_focus (BusInputContext *context) { g_assert (BUS_IS_INPUT_CONTEXT (context)); @@ -1425,7 +1425,6 @@ bus_input_context_disable (BusInputContext *context) BusInputContextPrivate *priv; priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context); - if (priv->engine) { if (priv->has_focus) { bus_engine_proxy_focus_out (priv->engine); @@ -1443,6 +1442,17 @@ bus_input_context_disable (BusInputContext *context) priv->enabled = FALSE; } +gboolean +bus_input_context_is_enabled (BusInputContext *context) +{ + g_assert (BUS_IS_INPUT_CONTEXT (context)); + + BusInputContextPrivate *priv; + priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context); + + return priv->enabled; +} + const static struct { const gchar *name; GCallback callback; @@ -1492,7 +1502,6 @@ void bus_input_context_set_engine (BusInputContext *context, BusEngineProxy *engine) { - g_assert (BUS_IS_INPUT_CONTEXT (context)); BusInputContextPrivate *priv; @@ -1517,12 +1526,29 @@ bus_input_context_set_engine (BusInputContext *context, context); } bus_engine_proxy_set_cursor_location (priv->engine, priv->x, priv->y, priv->w, priv->h); + if (priv->enabled) { + bus_engine_proxy_enable (priv->engine); + if (priv->has_focus) { + bus_engine_proxy_focus_in (priv->engine); + } + } } g_signal_emit (context, context_signals[ENGINE_CHANGED], 0); } +BusEngineProxy * +bus_input_context_get_engine (BusInputContext *context) +{ + g_assert (BUS_IS_INPUT_CONTEXT (context)); + + BusInputContextPrivate *priv; + priv = BUS_INPUT_CONTEXT_GET_PRIVATE (context); + + return priv->engine; +} + static gboolean bus_input_context_filter_keyboard_shortcuts (BusInputContext *context, guint keyval, @@ -1549,7 +1575,6 @@ bus_input_context_filter_keyboard_shortcuts (BusInputContext *context, keyval, modifiers, 0); - if (event == trigger) { if (priv->engine == NULL) { g_signal_emit (context, context_signals[REQUEST_ENGINE], 0, NULL); @@ -1569,9 +1594,17 @@ bus_input_context_filter_keyboard_shortcuts (BusInputContext *context, return TRUE; } else if (event == next_factory) { + g_signal_emit (context, context_signals[REQUEST_NEXT_ENGINE], 0); + if (priv->engine && !priv->enabled) { + bus_input_context_enable (context); + } return TRUE; } else if (event == prev_factory) { + g_signal_emit (context, context_signals[REQUEST_PREV_ENGINE], 0); + if (priv->engine && !priv->enabled) { + bus_input_context_enable (context); + } return TRUE; } else diff --git a/bus/inputcontext.h b/bus/inputcontext.h index edebdc0..537cbef 100644 --- a/bus/inputcontext.h +++ b/bus/inputcontext.h @@ -61,18 +61,19 @@ struct _BusInputContextClass { GType bus_input_context_get_type (void); BusInputContext *bus_input_context_new (BusConnection *connection, const gchar *client); -gboolean bus_input_context_is_focus (BusInputContext *context); void bus_input_context_focus_in (BusInputContext *context); void bus_input_context_focus_out (BusInputContext *context); -void bus_input_context_enable_or_disable(BusInputContext *context); +gboolean bus_input_context_has_focus (BusInputContext *context); void bus_input_context_enable (BusInputContext *context); void bus_input_context_disable (BusInputContext *context); +gboolean bus_input_context_is_enabled (BusInputContext *context); void bus_input_context_page_up (BusInputContext *context); void bus_input_context_page_down (BusInputContext *context); void bus_input_context_cursor_up (BusInputContext *context); void bus_input_context_cursor_down (BusInputContext *context); void bus_input_context_set_engine (BusInputContext *context, BusEngineProxy *factory); +BusEngineProxy *bus_input_context_get_engine (BusInputContext *context); void bus_input_context_property_activate(BusInputContext *context, const gchar *prop_name, gint prop_state); @@ -19,6 +19,8 @@ */ #include <unistd.h> +#include <sys/types.h> +#include <pwd.h> #include <stdlib.h> #include <locale.h> #include "server.h" @@ -106,6 +108,19 @@ main (gint argc, gchar **argv) exit (-1); } + /* check uid */ + { + gchar *username = ibus_get_user_name (); + uid_t uid = getuid (); + struct passwd *pwd = getpwuid (uid); + + if (pwd == NULL || strcmp (pwd->pw_name, username) != 0) { + g_printerr ("Please run ibus-daemon with login user! Do not run ibus-daemon with sudo or su.\n"); + exit (-1); + } + } + + /* daemonize process */ if (daemonize) { if (daemon (1, 0) != 0) { g_printerr ("Can not daemonize ibus.\n"); diff --git a/bus/matchrule.c b/bus/matchrule.c index 6bf75c5..f40147a 100644 --- a/bus/matchrule.c +++ b/bus/matchrule.c @@ -649,16 +649,15 @@ bus_match_rule_remove_recipient (BusMatchRule *rule, g_warning ("Remove recipient failed"); } -gboolean +GList * bus_match_rule_get_recipients (BusMatchRule *rule, - DBusMessage *message, - GList **recipients) + DBusMessage *message) { g_assert (BUS_IS_MATCH_RULE (rule)); g_assert (message != NULL); - g_assert (recipients != NULL); GList *link; + GList *recipients = NULL; if (!bus_match_rule_match (rule, message)) return FALSE; @@ -667,9 +666,9 @@ bus_match_rule_get_recipients (BusMatchRule *rule, BusRecipient *recipient = (BusRecipient *) link->data; g_object_ref (recipient->connection); - *recipients = g_list_append (*recipients, recipient->connection); + recipients = g_list_append (recipients, recipient->connection); } - return TRUE; + return recipients; } diff --git a/bus/matchrule.h b/bus/matchrule.h index b69825d..5a965a8 100644 --- a/bus/matchrule.h +++ b/bus/matchrule.h @@ -114,10 +114,9 @@ void bus_match_rule_add_recipient void bus_match_rule_remove_recipient (BusMatchRule *rule, BusConnection *connection); -gboolean bus_match_rule_get_recipients +GList *bus_match_rule_get_recipients (BusMatchRule *rule, - DBusMessage *message, - GList **recipients); + DBusMessage *message); G_END_DECLS #endif diff --git a/bus/registry.c b/bus/registry.c index 13e1cdf..65488da 100644 --- a/bus/registry.c +++ b/bus/registry.c @@ -20,6 +20,7 @@ #include <glib/gstdio.h> #include <gio/gio.h> #include <stdlib.h> +#include <string.h> #include "registry.h" enum { @@ -403,6 +404,33 @@ bus_registry_get_engines (BusRegistry *registry) } +GList * +bus_registry_get_engines_by_language (BusRegistry *registry, + const gchar *language) +{ + g_assert (BUS_IS_REGISTRY (registry)); + g_assert (language); + + gint n; + GList *p1, *p2, *engines; + + n = strlen (language); + + p1 = bus_registry_get_engines (registry); + + engines = NULL; + + for (p2 = p1; p2 != NULL; p2 = p2->next) { + IBusEngineDesc *desc = (IBusEngineDesc *) p2->data; + if (strncmp (desc->language, language, n) == 0) { + engines = g_list_append (engines, desc); + } + } + + g_list_free (p1); + return engines; +} + IBusEngineDesc * bus_registry_find_engine_by_name (BusRegistry *registry, const gchar *name) diff --git a/bus/registry.h b/bus/registry.h index 377ac45..fb4078d 100644 --- a/bus/registry.h +++ b/bus/registry.h @@ -67,6 +67,9 @@ GType bus_registry_get_type (void); BusRegistry *bus_registry_new (void); GList *bus_registry_get_components (BusRegistry *registry); GList *bus_registry_get_engines (BusRegistry *registry); +GList *bus_registry_get_engines_by_language + (BusRegistry *registry, + const gchar *language); void bus_registry_stop_all_components (BusRegistry *registry); diff --git a/bus/server.c b/bus/server.c index 3a957db..7245bd3 100644 --- a/bus/server.c +++ b/bus/server.c @@ -17,10 +17,10 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ - +#include <unistd.h> #include <sys/stat.h> #include <sys/types.h> -#include <libgen.h> +#include <stdlib.h> #include "server.h" #include "connection.h" @@ -87,13 +87,21 @@ bus_server_listen (BusServer *server) // const gchar *address = "unix:abstract=/tmp/ibus-c" const gchar *address; gchar *path; + gboolean retval; path = g_strdup_printf("/tmp/ibus-%s", ibus_get_user_name ()); mkdir (path, 0775); - g_free(path); address = ibus_get_address (); - return ibus_server_listen (IBUS_SERVER (server), address); + retval = ibus_server_listen (IBUS_SERVER (server), address); + + if (!retval) { + g_printerr ("Can not listen on %s! Please try remove directory %s and run again.", address, path); + exit (-1); + } + + g_free(path); + return retval; } void @@ -128,8 +136,8 @@ static void bus_server_init (BusServer *server) { server->loop = g_main_loop_new (NULL, FALSE); - server->dbus = bus_dbus_impl_get_default (); - server->ibus = bus_ibus_impl_get_default (); + server->dbus = bus_dbus_impl_get_default (); + server->ibus = bus_ibus_impl_get_default (); } static void diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c index f622de1..60f8576 100644 --- a/client/gtk2/ibusimcontext.c +++ b/client/gtk2/ibusimcontext.c @@ -694,6 +694,7 @@ _ibus_context_enabled_cb (IBusInputContext *ibus_context, IBusIMContextPrivate *priv = context->priv; priv->enable = TRUE; + g_signal_emit (context, _signal_preedit_changed_id, 0); } static void @@ -704,6 +705,14 @@ _ibus_context_disabled_cb (IBusInputContext *ibus_context, IBusIMContextPrivate *priv = context->priv; priv->enable = FALSE; + + /* clear preedit */ + priv->preedit_visible = FALSE; + priv->preedit_cursor_pos = 0; + g_free (priv->preedit_string); + priv->preedit_string = NULL; + + g_signal_emit (context, _signal_preedit_changed_id, 0); } static void diff --git a/configure.ac b/configure.ac index 07f8491..c40d8b0 100644 --- a/configure.ac +++ b/configure.ac @@ -90,11 +90,38 @@ PKG_CHECK_MODULES(GDK2, [ # check for gtk-doc GTK_DOC_CHECK(1.9) + # check for dbus-glib PKG_CHECK_MODULES(DBUS, [ dbus-1 ]) +# check gconf +PKG_CHECK_MODULES(GCONF, + [gconf-2.0 >= 2.12], +) + +AC_PATH_PROG(GCONFTOOL, gconftool-2, no) +if test x"$GCONFTOOL" = xno; then + AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf]) +fi + +AM_GCONF_SOURCE_2 + +# GCONF_SERVERDIR=`$PKG_CONFIG --variable=gconf_serverdir gconf-2.0` +# old_path=$PATH +# if test x"$GCONF_SERVERDIR" != x; then +# PATH=$GCONF_SERVERDIR:$PATH +# fi +# +# AC_PATH_PROG(GCONF_SANITY_CHECK, gconf-sanity-check-2, no) +# if test x"$GCONF_SANITY_CHECK" = xno; then +# AC_MSG_ERROR([gconf-sanity-check-2 executable not found in your path - should be installed with GConf]) +# fi +# +# AC_SUBST(GCONF_SANITY_CHECK) +# PATH=$old_path + # Check for Qt4 PKG_CHECK_MODULES(QT, [QtCore >= 4.4.0 QtDBus >= 4.4.0], @@ -180,9 +207,25 @@ fi enable_qt4=no AM_CONDITIONAL(IBUS_BUILD_QT4, [test x"$enable_qt4" = x"yes" ]) -PKG_CHECK_MODULES(GCONF, - [gconf-2.0 >= 2.12], +# check for dbus-python +AC_ARG_ENABLE(dbus-python-check, + AS_HELP_STRING([--disable-dbus-python-check], + [Do not check dbus-python]), + [enable_dbus_python_check=$enableval], + [enable_dbus_python_check=yes], +) +PKG_CHECK_MODULES(DBUS_PYTHON, + [dbus-python >= 0.83.0], + [IBUS_HAS_DBUS_PYTHON=yes], + [IBUS_HAS_DBUS_PYTHON=no] ) +if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then + if test x"$enable_dbus_python_check" != x"no"; then + AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.]) + else + AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.]) + fi +fi # check iso-codes AC_ARG_ENABLE(iso-codes-check, @@ -230,7 +273,8 @@ bindings/Makefile bindings/python/Makefile util/Makefile util/IMdkit/Makefile -icons/Makefile +data/Makefile +data/icons/Makefile docs/Makefile docs/reference/Makefile docs/reference/ibus/Makefile diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..2200245 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,43 @@ +# vim:set noet ts=4: +# +# ibus - The Input Bus +# +# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA + +SUBDIRS = \ + icons \ + $(NULL) + +schemas_DATA = \ + ibus.schemas \ + $(NULL) +schemasdir = $(GCONF_SCHEMA_FILE_DIR) + +install-data-local: +if GCONF_SCHEMAS_INSTALL + if test -z "$(DESTDIR)" ; then \ + for p in $(schemas_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) \ + --makefile-install-rule $(top_builddir)/data/$$p >&1 > /dev/null; \ + done \ + fi +endif + +EXTRA_DIST = \ + $(schemas_DATA) \ + $(NULL) diff --git a/data/ibus.schemas b/data/ibus.schemas new file mode 100644 index 0000000..2bd2bb5 --- /dev/null +++ b/data/ibus.schemas @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<gconfschemafile> + <schemalist> + <schema> + <key>/schemas/desktop/ibus/general/preload_engines</key> + <applyto>/desktop/ibus/general/preload_engines</applyto> + <owner>ibus</owner> + <type>list</type> + <list_type>string</list_type> + <locale name="C"> + <short>Preload Engines</short> + <long>Preload Engines during ibus starts up</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/general/hotkey/trigger</key> + <applyto>/desktop/ibus/general/hotkey/trigger</applyto> + <owner>ibus</owner> + <type>list</type> + <list_type>string</list_type> + <default>[Control+space]</default> + <locale name="C"> + <short>Trigger Hotkey</short> + <long>Trigger hotkey for enable or disable input context</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/general/hotkey/next_engine</key> + <applyto>/desktop/ibus/general/hotkey/next_engine</applyto> + <owner>ibus</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Next Engine Hotkey</short> + <long>Next engine hotkey for switch to next input method engine</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/general/hotkey/prev_engine</key> + <applyto>/desktop/ibus/general/hotkey/prev_engine</applyto> + <owner>ibus</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Prev Engine Hotkey</short> + <long>Prev engine hotkey for switch to previous input method engine</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/panel/auto_hide</key> + <applyto>/desktop/ibus/panel/auto_hide</applyto> + <owner>ibus</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Auto Hide</short> + <long>Auto hide language panel</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/panel/lookup_table_orientation</key> + <applyto>/desktop/ibus/panel/lookup_table_orientation</applyto> + <owner>ibus</owner> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Orientation of Lookup Table</short> + <long>Orientation of Lookup Table. 0 = Horizontal, 1 = Vertical</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/panel/use_custom_font</key> + <applyto>/desktop/ibus/panel/use_custom_font</applyto> + <owner>ibus</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Use Custom Font</short> + <long>Use custom font name for language panel</long> + </locale> + </schema> + <schema> + <key>/schemas/desktop/ibus/panel/custom_font</key> + <applyto>/desktop/ibus/panel/custom_font</applyto> + <owner>ibus</owner> + <type>string</type> + <default>Sans 10</default> + <locale name="C"> + <short>Custom Font</short> + <long>Custom font name for language panel</long> + </locale> + </schema> + </schemalist> +</gconfschemafile> diff --git a/icons/Makefile.am b/data/icons/Makefile.am index 5a6617c..5a6617c 100644 --- a/icons/Makefile.am +++ b/data/icons/Makefile.am diff --git a/icons/engine-default.svg b/data/icons/engine-default.svg index e27018c..e27018c 100644 --- a/icons/engine-default.svg +++ b/data/icons/engine-default.svg diff --git a/icons/ibus-help.png b/data/icons/ibus-help.png Binary files differindex aff3318..aff3318 100644 --- a/icons/ibus-help.png +++ b/data/icons/ibus-help.png diff --git a/icons/ibus-keyboard.svg b/data/icons/ibus-keyboard.svg index 4a19adc..4a19adc 100644 --- a/icons/ibus-keyboard.svg +++ b/data/icons/ibus-keyboard.svg diff --git a/icons/ibus-locale.svg b/data/icons/ibus-locale.svg index 0d737d9..0d737d9 100644 --- a/icons/ibus-locale.svg +++ b/data/icons/ibus-locale.svg diff --git a/icons/ibus-setup.svg b/data/icons/ibus-setup.svg index ed6fc03..ed6fc03 120000 --- a/icons/ibus-setup.svg +++ b/data/icons/ibus-setup.svg diff --git a/icons/ibus-zh.svg b/data/icons/ibus-zh.svg index 7747876..7747876 100644 --- a/icons/ibus-zh.svg +++ b/data/icons/ibus-zh.svg diff --git a/icons/ibus.svg b/data/icons/ibus.svg index 87063a9..87063a9 100644 --- a/icons/ibus.svg +++ b/data/icons/ibus.svg diff --git a/docs/reference/ibus/Makefile.am b/docs/reference/ibus/Makefile.am index ea9fdec..63d9e5e 100644 --- a/docs/reference/ibus/Makefile.am +++ b/docs/reference/ibus/Makefile.am @@ -25,7 +25,8 @@ SCANGOBJ_OPTIONS= # Extra options to supply to gtkdoc-scan. # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS=--rebuild-sections +# SCAN_OPTIONS=--rebuild-sections +SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb. # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml @@ -42,7 +43,7 @@ FIXXREF_OPTIONS= # Used for dependencies. The docs will be rebuilt if any of these change. # e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h # e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB= +HFILE_GLOB=$(top_srcdir)/src/*.h CFILE_GLOB= # Header files to ignore when scanning. diff --git a/docs/reference/ibus/ibus-docs.sgml b/docs/reference/ibus/ibus-docs.sgml index 83f69c9..57711f5 100644 --- a/docs/reference/ibus/ibus-docs.sgml +++ b/docs/reference/ibus/ibus-docs.sgml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> <book id="index" xmlns:xi="http://www.w3.org/2003/XInclude"> <bookinfo> - <title>ibus Reference Manual</title> + <title>IBus Reference Manual</title> <releaseinfo> for ibus 1.1.0 The latest version of this documentation can be found on-line at @@ -12,37 +12,51 @@ </bookinfo> <chapter> - <title>API Reference</title> - <xi:include href="xml/ibusfactory.xml"/> - <xi:include href="xml/ibusattribute.xml"/> - <xi:include href="xml/ibusinputcontext.xml"/> - <xi:include href="xml/ibusobservedpath.xml"/> - <xi:include href="xml/ibusengine.xml"/> - <xi:include href="xml/ibusservice.xml"/> - <xi:include href="xml/ibuslookuptable.xml"/> - <xi:include href="xml/ibusproxy.xml"/> - <xi:include href="xml/ibusserver.xml"/> - <xi:include href="xml/ibuscomponent.xml"/> - <xi:include href="xml/ibusconnection.xml"/> - <xi:include href="xml/ibusproperty.xml"/> - <xi:include href="xml/ibustext.xml"/> - <xi:include href="xml/ibusserializable.xml"/> - <xi:include href="xml/ibushotkey.xml"/> - <xi:include href="xml/ibusbus.xml"/> - <xi:include href="xml/ibusenginedesc.xml"/> - <xi:include href="xml/ibusobject.xml"/> - <xi:include href="xml/ibusconfig.xml"/> - <xi:include href="xml/ibusmessage.xml"/> - <xi:include href="xml/ibusdebug.xml"/> - <xi:include href="xml/ibusmarshalers.xml"/> - <xi:include href="xml/keyname-table.xml"/> - <xi:include href="xml/ibustypes.xml"/> - <xi:include href="xml/ibuserror.xml"/> - <xi:include href="xml/ibuspendingcall.xml"/> - <xi:include href="xml/ibuskeysyms.xml"/> - <xi:include href="xml/ibusenumtypes.xml"/> - <xi:include href="xml/ibusxml.xml"/> - <xi:include href="xml/ibusshare.xml"/> - <xi:include href="xml/ibusinternal.xml"/> + <title>API Overviews</title> + <para> + </para> + </chapter> + <chapter> + <title>User Interfaces</title> + <para>These APIs directly related to User interfaces, such as + pre-edit buffer, auxiliary text, language bar, button, + radio boxes, and so on. + </para> + <xi:include href="xml/ibusattribute.xml"/> + <xi:include href="xml/ibuslookuptable.xml"/> + <xi:include href="xml/ibusobservedpath.xml"/> + <xi:include href="xml/ibusproperty.xml"/> + <xi:include href="xml/ibustext.xml"/> + <xi:include href="xml/ibuskeysyms.xml"/> + </chapter> + <chapter> + <title>Others</title> + <para> + </para> + <xi:include href="xml/ibusbus.xml"/> + <xi:include href="xml/ibuscomponent.xml"/> + <xi:include href="xml/ibusconfig.xml"/> + <xi:include href="xml/ibusconnection.xml"/> + <xi:include href="xml/ibusdebug.xml"/> + <xi:include href="xml/ibusengine.xml"/> + <xi:include href="xml/ibusenginedesc.xml"/> + <xi:include href="xml/ibusenumtypes.xml"/> + <xi:include href="xml/ibuserror.xml"/> + <xi:include href="xml/ibusfactory.xml"/> + <xi:include href="xml/ibushotkey.xml"/> + <xi:include href="xml/ibusinputcontext.xml"/> + <xi:include href="xml/ibusinternal.xml"/> + <xi:include href="xml/ibusmarshalers.xml"/> + <xi:include href="xml/ibusmessage.xml"/> + <xi:include href="xml/ibusobject.xml"/> + <xi:include href="xml/ibuspendingcall.xml"/> + <xi:include href="xml/ibusproxy.xml"/> + <xi:include href="xml/ibusserver.xml"/> + <xi:include href="xml/ibusservice.xml"/> + <xi:include href="xml/ibusserializable.xml"/> + <xi:include href="xml/ibusshare.xml"/> + <xi:include href="xml/ibustypes.xml"/> + <xi:include href="xml/ibusxml.xml"/> + <xi:include href="xml/keyname-table.xml"/> </chapter> </book> @@ -0,0 +1,6 @@ +[ -z "$XIM" ] && export XIM="ibus" +[ -z "$XMODIFIERS" ] && export XMODIFIERS="@im=ibus" +[ -z "$GTK_IM_MODULE" ] && export GTK_IM_MODULE="ibus" +[ -z "$QT_IM_MODULE" ] && export QT_IM_MODULE="xim" +[ -z "$XIM_PROGRAM" ] && export XIM_PROGRAM="ibus-daemon" +[ -z "$XIM_ARGS" ] && export XIM_ARGS="--daemonize --xim" diff --git a/ibus/Makefile.am b/ibus/Makefile.am index fba01c6..d7ef092 100644 --- a/ibus/Makefile.am +++ b/ibus/Makefile.am @@ -49,6 +49,9 @@ ibus_PYTHON = \ observedpath.py \ utility.py \ config.py \ + $(NULL) + +nodist_ibus_PYTHON = \ _config.py \ $(NULL) @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ibus VERSION\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-02-20 10:58+1000\n" +"POT-Creation-Date: 2009-02-24 18:14+0800\n" "PO-Revision-Date: 2009-02-06 01:55+0100\n" "Last-Translator: Julroy67 <julroy67@gmail.com>\n" "Language-Team: French <julroy67@gmail.com>\n" @@ -18,25 +18,28 @@ msgstr "" "X-Poedit-Language: French\n" "X-Poedit-Country: FRANCE\n" -#: ibus/lang.py:40 ui/gtk/panel.py:312 ui/gtk/panel.py:313 ui/gtk/panel.py:314 -#: ui/gtk/panel.py:315 +#: ibus/lang.py:40 ui/gtk/panel.py:307 ui/gtk/panel.py:308 ui/gtk/panel.py:309 +#: ui/gtk/panel.py:310 msgid "Other" msgstr "Autre" #: ui/gtk/panel.py:97 -#, fuzzy -msgid "IBus - Running" -msgstr "IBus - Démarré" +msgid "IBus input method framework" +msgstr "" #: ui/gtk/panel.py:282 msgid "Restart" msgstr "" -#: ui/gtk/panel.py:381 +#: ui/gtk/panel.py:337 +msgid "No input method" +msgstr "" + +#: ui/gtk/panel.py:383 msgid "IBus is an intelligent input bus for Linux/Unix." msgstr "IBus est un IME intelligent pour Linux/Unix" -#: ui/gtk/panel.py:385 +#: ui/gtk/panel.py:387 msgid "translator-credits" msgstr "HUMBERT Julien <julroy67@gmail.com>" @@ -113,6 +116,7 @@ msgstr "" msgid "IBus Preferences" msgstr "" +<<<<<<< HEAD:po/fr.po #: setup/setup.glade:48 setup/setup.glade:67 setup/setup.glade:86 msgid "..." msgstr "…" @@ -138,6 +142,33 @@ msgid "Lookup table orientation:" msgstr "Orientation de la table :" #: setup/setup.glade:239 +======= +#: setup/setup.glade:44 setup/setup.glade:63 setup/setup.glade:81 +msgid "..." +msgstr "…" + +#: setup/setup.glade:145 +msgid "Previous engine:" +msgstr "Moteur précédent :" + +#: setup/setup.glade:161 +msgid "Next engine:" +msgstr "Moteur suivant :" + +#: setup/setup.glade:177 +msgid "Trigger:" +msgstr "Déclencheur :" + +#: setup/setup.glade:194 +msgid "<b>Keyboard Shortcuts</b>" +msgstr "<b>Raccourcis claviers</b>" + +#: setup/setup.glade:226 +msgid "Lookup table orientation:" +msgstr "Orientation de la table :" + +#: setup/setup.glade:238 +>>>>>>> cd4d9b6ebfa4a66ba6bd89c5b7d2b34eb25864af:po/fr.po msgid "" "Horizontal\n" "Vertical" @@ -153,11 +184,11 @@ msgstr "Cacher automatiquement la barre de langue" msgid "Use custom font" msgstr "Utiliser une police personnalisée" -#: setup/setup.glade:290 +#: setup/setup.glade:291 msgid "<b>Font and Style</b>" msgstr "" -#: setup/setup.glade:316 +#: setup/setup.glade:314 #, fuzzy msgid "Start ibus on login" msgstr "Démarrer automatiquement IBus lors de la connexion" @@ -171,28 +202,27 @@ msgstr "<b>Interface Utilisateur</b>" msgid "General" msgstr "Général" -#: setup/setup.glade:422 +#: setup/setup.glade:425 msgid "gtk-add" msgstr "gtk-add" -#: setup/setup.glade:432 +#: setup/setup.glade:439 msgid "gtk-remove" msgstr "gtk-remove" -#: setup/setup.glade:445 +#: setup/setup.glade:453 msgid "gtk-go-up" msgstr "gtk-go-up" -#: setup/setup.glade:458 +#: setup/setup.glade:467 msgid "gtk-go-down" msgstr "gtk-go-down" -#: setup/setup.glade:483 -#, fuzzy -msgid "Engines" -msgstr "Moteur" +#: setup/setup.glade:496 +msgid "Input Methods" +msgstr "" -#: setup/setup.glade:499 +#: setup/setup.glade:512 msgid "" "<big><b>IBus</b></big>\n" "<small>The intelligent input bus</small>\n" @@ -208,13 +238,20 @@ msgstr "" "\n" "\n" -#: setup/setup.glade:524 +#: setup/setup.glade:537 msgid "About" msgstr "À propos" -#: setup/setup.glade:546 +#: setup/setup.glade:556 msgid "gtk-close" msgstr "gtk-close" +#, fuzzy +#~ msgid "IBus - Running" +#~ msgstr "IBus - Démarré" + #~ msgid "IBus - Setup" #~ msgstr "IBus - Configuration" + +#~ msgid "Engine" +#~ msgstr "Moteur" @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ibus VERSION\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-02-20 10:58+1000\n" +"POT-Creation-Date: 2009-02-24 18:14+0800\n" "PO-Revision-Date: 2008-08-28 17:31+0900\n" "Last-Translator: UTUMI Hirosi <utuhiro78@yahoo.co.jp>\n" "Language-Team: Japanese <gnome-translation@gnome.gr.jp>\n" @@ -16,24 +16,28 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ibus/lang.py:40 ui/gtk/panel.py:312 ui/gtk/panel.py:313 ui/gtk/panel.py:314 -#: ui/gtk/panel.py:315 +#: ibus/lang.py:40 ui/gtk/panel.py:307 ui/gtk/panel.py:308 ui/gtk/panel.py:309 +#: ui/gtk/panel.py:310 msgid "Other" msgstr "" #: ui/gtk/panel.py:97 -msgid "IBus - Running" -msgstr "IBus - 実行中" +msgid "IBus input method framework" +msgstr "" #: ui/gtk/panel.py:282 msgid "Restart" msgstr "" -#: ui/gtk/panel.py:381 +#: ui/gtk/panel.py:337 +msgid "No input method" +msgstr "" + +#: ui/gtk/panel.py:383 msgid "IBus is an intelligent input bus for Linux/Unix." msgstr "" -#: ui/gtk/panel.py:385 +#: ui/gtk/panel.py:387 msgid "translator-credits" msgstr "UTUMI Hirosi <utuhiro78@yahoo.co.jp>" @@ -108,31 +112,31 @@ msgstr "" msgid "IBus Preferences" msgstr "" -#: setup/setup.glade:48 setup/setup.glade:67 setup/setup.glade:86 +#: setup/setup.glade:44 setup/setup.glade:63 setup/setup.glade:81 msgid "..." msgstr "..." -#: setup/setup.glade:148 +#: setup/setup.glade:145 msgid "Previous engine:" msgstr "前のエンジン:" -#: setup/setup.glade:164 +#: setup/setup.glade:161 msgid "Next engine:" msgstr "次のエンジン:" -#: setup/setup.glade:180 +#: setup/setup.glade:177 msgid "Trigger:" msgstr "トリガー:" -#: setup/setup.glade:197 +#: setup/setup.glade:194 msgid "<b>Keyboard Shortcuts</b>" msgstr "<b>キーボードショートカット</b>" -#: setup/setup.glade:228 +#: setup/setup.glade:226 msgid "Lookup table orientation:" msgstr "候補ウィンドウの向き:" -#: setup/setup.glade:239 +#: setup/setup.glade:238 msgid "" "Horizontal\n" "Vertical" @@ -148,11 +152,11 @@ msgstr "言語バーを自動で隠す" msgid "Use custom font" msgstr "カスタムフォントを使う" -#: setup/setup.glade:290 +#: setup/setup.glade:291 msgid "<b>Font and Style</b>" msgstr "" -#: setup/setup.glade:316 +#: setup/setup.glade:314 #, fuzzy msgid "Start ibus on login" msgstr "セッションログイン時に IBus を自動的に起動" @@ -165,29 +169,28 @@ msgstr "" msgid "General" msgstr "一般" -#: setup/setup.glade:422 +#: setup/setup.glade:425 msgid "gtk-add" msgstr "" -#: setup/setup.glade:432 +#: setup/setup.glade:439 #, fuzzy msgid "gtk-remove" msgstr "gtk-close" -#: setup/setup.glade:445 +#: setup/setup.glade:453 msgid "gtk-go-up" msgstr "" -#: setup/setup.glade:458 +#: setup/setup.glade:467 msgid "gtk-go-down" msgstr "" -#: setup/setup.glade:483 -#, fuzzy -msgid "Engines" -msgstr "エンジン" +#: setup/setup.glade:496 +msgid "Input Methods" +msgstr "" -#: setup/setup.glade:499 +#: setup/setup.glade:512 msgid "" "<big><b>IBus</b></big>\n" "<small>The intelligent input bus</small>\n" @@ -197,17 +200,23 @@ msgid "" "\n" msgstr "" -#: setup/setup.glade:524 +#: setup/setup.glade:537 msgid "About" msgstr "About" -#: setup/setup.glade:546 +#: setup/setup.glade:556 msgid "gtk-close" msgstr "gtk-close" +#~ msgid "IBus - Running" +#~ msgstr "IBus - 実行中" + #~ msgid "IBus - Setup" #~ msgstr "IBus - セットアップ" +#~ msgid "Engine" +#~ msgstr "エンジン" + #~ msgid "Started" #~ msgstr "開始" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ibus\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-02-20 10:58+1000\n" +"POT-Creation-Date: 2009-02-24 18:14+0800\n" "PO-Revision-Date: 2008-10-17 14:15+0530\n" "Last-Translator: Amanpreet Singh <aalam@users.sf.net>\n" "Language-Team: Punjabi/Panjabi <punjabi-l10n@lists.sf.net>\n" @@ -16,24 +16,28 @@ msgstr "" "X-Generator: Lokalize 0.2\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -#: ibus/lang.py:40 ui/gtk/panel.py:312 ui/gtk/panel.py:313 ui/gtk/panel.py:314 -#: ui/gtk/panel.py:315 +#: ibus/lang.py:40 ui/gtk/panel.py:307 ui/gtk/panel.py:308 ui/gtk/panel.py:309 +#: ui/gtk/panel.py:310 msgid "Other" msgstr "ਹੋਰ" #: ui/gtk/panel.py:97 -msgid "IBus - Running" -msgstr "IBus - ਚੱਲ ਰਿਹਾ ਹੈ" +msgid "IBus input method framework" +msgstr "" #: ui/gtk/panel.py:282 msgid "Restart" msgstr "" -#: ui/gtk/panel.py:381 +#: ui/gtk/panel.py:337 +msgid "No input method" +msgstr "" + +#: ui/gtk/panel.py:383 msgid "IBus is an intelligent input bus for Linux/Unix." msgstr "IBus ਲੀਨਕਸ/ਯੂਨੈਕਸ ਲਈ ਮਾਹਰ ਇੰਪੁੱਟ ਬੱਸ ਹੈ।" -#: ui/gtk/panel.py:385 +#: ui/gtk/panel.py:387 msgid "translator-credits" msgstr "ਅਮਨਪਰੀਤ ਸਿੰਘ ਆਲਮ" @@ -107,31 +111,31 @@ msgstr "" msgid "IBus Preferences" msgstr "" -#: setup/setup.glade:48 setup/setup.glade:67 setup/setup.glade:86 +#: setup/setup.glade:44 setup/setup.glade:63 setup/setup.glade:81 msgid "..." msgstr "..." -#: setup/setup.glade:148 +#: setup/setup.glade:145 msgid "Previous engine:" msgstr "ਪਿਛਲਾ ਇੰਜਣ" -#: setup/setup.glade:164 +#: setup/setup.glade:161 msgid "Next engine:" msgstr "ਅਗਲਾ ਇੰਜਣ:" -#: setup/setup.glade:180 +#: setup/setup.glade:177 msgid "Trigger:" msgstr "ਟਰਿੱਗਰ:" -#: setup/setup.glade:197 +#: setup/setup.glade:194 msgid "<b>Keyboard Shortcuts</b>" msgstr "<b>ਕੀਬੋਰਡ ਸ਼ਾਰਟਕੱਟ</b>" -#: setup/setup.glade:228 +#: setup/setup.glade:226 msgid "Lookup table orientation:" msgstr "ਖੋਜ ਟੇਬਲ ਸਥਿਤੀ:" -#: setup/setup.glade:239 +#: setup/setup.glade:238 msgid "" "Horizontal\n" "Vertical" @@ -147,11 +151,11 @@ msgstr "ਭਾਸ਼ਾ ਪੱਟੀ ਆਟੋਮੈਟਿਕ ਓਹਲੇ ਕ msgid "Use custom font" msgstr "ਪਸੰਦੀਦਾ ਫੋਂਟ ਵਰਤੋਂ" -#: setup/setup.glade:290 +#: setup/setup.glade:291 msgid "<b>Font and Style</b>" msgstr "" -#: setup/setup.glade:316 +#: setup/setup.glade:314 #, fuzzy msgid "Start ibus on login" msgstr "ਸ਼ੈਸ਼ਨ ਲਾਗਇਨ ਨਾਲ IBus ਆਟੋਮੈਟਿਕ ਚਾਲੂ ਕਰੋ" @@ -165,28 +169,27 @@ msgstr "<b>UI</b>" msgid "General" msgstr "ਆਮ" -#: setup/setup.glade:422 +#: setup/setup.glade:425 msgid "gtk-add" msgstr "" -#: setup/setup.glade:432 +#: setup/setup.glade:439 msgid "gtk-remove" msgstr "gtk-close" -#: setup/setup.glade:445 +#: setup/setup.glade:453 msgid "gtk-go-up" msgstr "" -#: setup/setup.glade:458 +#: setup/setup.glade:467 msgid "gtk-go-down" msgstr "" -#: setup/setup.glade:483 -#, fuzzy -msgid "Engines" -msgstr "ਇੰਜਣ" +#: setup/setup.glade:496 +msgid "Input Methods" +msgstr "" -#: setup/setup.glade:499 +#: setup/setup.glade:512 msgid "" "<big><b>IBus</b></big>\n" "<small>The intelligent input bus</small>\n" @@ -202,17 +205,23 @@ msgstr "" "
\n" "
\n" -#: setup/setup.glade:524 +#: setup/setup.glade:537 msgid "About" msgstr "ਇਸ ਬਾਰੇ" -#: setup/setup.glade:546 +#: setup/setup.glade:556 msgid "gtk-close" msgstr "gtk-close" +#~ msgid "IBus - Running" +#~ msgstr "IBus - ਚੱਲ ਰਿਹਾ ਹੈ" + #~ msgid "IBus - Setup" #~ msgstr "IBus - ਸੈੱਟਅੱਪ" +#~ msgid "Engine" +#~ msgstr "ਇੰਜਣ" + #~ msgid "Started" #~ msgstr "ਚਾਲੂ ਹੈ" diff --git a/po/zh_CN.po b/po/zh_CN.po index 561b6db..b4eb0fd 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1.1.20080813\n" "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n" -"POT-Creation-Date: 2009-02-23 14:34+0800\n" +"POT-Creation-Date: 2009-02-24 18:14+0800\n" "PO-Revision-Date: 2008-08-13 21:59+0800\n" "Last-Translator: Huang Peng <shawn.p.huang@gmail.com>\n" "Language-Team: Huang Peng <shawn.p.huang@gmail.com>\n" @@ -16,8 +16,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ibus/lang.py:40 ui/gtk/panel.py:312 ui/gtk/panel.py:313 ui/gtk/panel.py:314 -#: ui/gtk/panel.py:315 +#: ibus/lang.py:40 ui/gtk/panel.py:307 ui/gtk/panel.py:308 ui/gtk/panel.py:309 +#: ui/gtk/panel.py:310 msgid "Other" msgstr "其他" @@ -29,11 +29,15 @@ msgstr "IBus输入法框架" msgid "Restart" msgstr "重新启动" -#: ui/gtk/panel.py:381 +#: ui/gtk/panel.py:337 +msgid "No input method" +msgstr "关闭输入法" + +#: ui/gtk/panel.py:383 msgid "IBus is an intelligent input bus for Linux/Unix." msgstr "" -#: ui/gtk/panel.py:385 +#: ui/gtk/panel.py:387 msgid "translator-credits" msgstr "Huang Peng <shawn.p.huang@gmail.com>" @@ -105,33 +109,33 @@ msgstr "选择输入法" #: setup/setup.glade:7 msgid "IBus Preferences" -msgstr "" +msgstr "IBus设置" -#: setup/setup.glade:48 setup/setup.glade:67 setup/setup.glade:86 +#: setup/setup.glade:44 setup/setup.glade:63 setup/setup.glade:81 msgid "..." msgstr "" -#: setup/setup.glade:148 +#: setup/setup.glade:145 msgid "Previous engine:" msgstr "上一个引擎:" -#: setup/setup.glade:164 +#: setup/setup.glade:161 msgid "Next engine:" msgstr "下一个引擎:" -#: setup/setup.glade:180 +#: setup/setup.glade:177 msgid "Trigger:" msgstr "开关:" -#: setup/setup.glade:197 +#: setup/setup.glade:194 msgid "<b>Keyboard Shortcuts</b>" msgstr "<b>快捷键</b>" -#: setup/setup.glade:228 +#: setup/setup.glade:226 msgid "Lookup table orientation:" msgstr "候选词表方向:" -#: setup/setup.glade:239 +#: setup/setup.glade:238 msgid "" "Horizontal\n" "Vertical" @@ -147,47 +151,43 @@ msgstr "自动隐藏语言栏" msgid "Use custom font" msgstr "使用自定义字体" -#: setup/setup.glade:290 +#: setup/setup.glade:291 msgid "<b>Font and Style</b>" -msgstr "" +msgstr "<b>字体和风格</b>" -#: setup/setup.glade:316 -<<<<<<< .merge_file_i6NEv0 -#, fuzzy -======= ->>>>>>> .merge_file_M8QOh0 +#: setup/setup.glade:314 msgid "Start ibus on login" msgstr "启动桌面时自动启动IBus" #: setup/setup.glade:326 msgid "<b>Startup</b>" -msgstr "<b>用户界面</b>" +msgstr "<b>启动</b>" #: setup/setup.glade:351 msgid "General" msgstr "通用" -#: setup/setup.glade:422 +#: setup/setup.glade:425 msgid "gtk-add" msgstr "" -#: setup/setup.glade:432 +#: setup/setup.glade:439 msgid "gtk-remove" msgstr "" -#: setup/setup.glade:445 +#: setup/setup.glade:453 msgid "gtk-go-up" msgstr "" -#: setup/setup.glade:458 +#: setup/setup.glade:467 msgid "gtk-go-down" msgstr "" -#: setup/setup.glade:483 -msgid "Engines" -msgstr "输入法引擎" +#: setup/setup.glade:496 +msgid "Input Methods" +msgstr "输入法" -#: setup/setup.glade:499 +#: setup/setup.glade:512 msgid "" "<big><b>IBus</b></big>\n" "<small>The intelligent input bus</small>\n" @@ -197,13 +197,11 @@ msgid "" "\n" msgstr "" -#: setup/setup.glade:524 +#: setup/setup.glade:537 msgid "About" msgstr "关于" -#: setup/setup.glade:546 +#: setup/setup.glade:556 msgid "gtk-close" msgstr "" -#~ msgid "IBus - Setup" -#~ msgstr "IBus - 设置" diff --git a/setup/enginecombobox.py b/setup/enginecombobox.py index 6db543a..e018973 100644 --- a/setup/enginecombobox.py +++ b/setup/enginecombobox.py @@ -25,7 +25,7 @@ import ibus import gettext from icon import load_icon -_ = lambda a : gettext.dgettext("ibus", a) +_ = lambda a : gettext.dgettext("ibus", a) class EngineComboBox(gtk.ComboBox): def __init__(self, engines): @@ -42,7 +42,12 @@ class EngineComboBox(gtk.ComboBox): lang[l] = [] lang[l].append(e) - for l in lang.keys(): + keys = lang.keys() + keys.sort() + if ibus.get_language_name("Other") in keys: + keys.remove( ibus.get_language_name("Other")) + keys += [ibus.get_language_name("Other")] + for l in keys: iter1 = self.__model.append(None) self.__model.set(iter1, 0, l) for e in lang[l]: diff --git a/setup/setup.glade b/setup/setup.glade index e279f28..f58580d 100644 --- a/setup/setup.glade +++ b/setup/setup.glade @@ -303,7 +303,6 @@ Vertical</property> </child> <child> <widget class="GtkFrame" id="frame1"> - <property name="visible">True</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> diff --git a/src/ibusattribute.h b/src/ibusattribute.h index 22dec82..ec0baa8 100644 --- a/src/ibusattribute.h +++ b/src/ibusattribute.h @@ -17,21 +17,30 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ -/** - * SECTION: ibusattribute - * @short_description: Attributes of preedit and auxiliary text. - * - */ - #ifndef __IBUS_ATTRIBUTE_H_ #define __IBUS_ATTRIBUTE_H_ #include "ibusserializable.h" +/** + * IBusAttribute: + * @type: IBusAttributeType + * @value: Value for the type. + * @start_index: The starting index, inclusive. + * @end_index: The ending index, exclusive. + * + * Signify the type, value and range of the attribute. + * The range starts from @start_index till the @end_index-1. + */ /* * Type macros. */ /* define IBusAttribute macros */ +/** + * Return GType of IBusAttribute + * + * Return: GType of IBusAttribute. + */ #define IBUS_TYPE_ATTRIBUTE \ (ibus_attribute_get_type ()) #define IBUS_ATTRIBUTE(obj) \ @@ -59,12 +68,29 @@ #define IBUS_ATTR_LIST_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_ATTR_LIST, IBusAttrListClass)) +/** + * IBusAttrType: + * @IBUS_ATTR_TYPE_UNDERLINE: Decorate with underline. + * @IBUS_ATTR_TYPE_FOREGROUND: Foreground color. + * @IBUS_ATTR_TYPE_BACKGROUND: Background color. + * + * Type of IBusText attribute. + */ typedef enum { IBUS_ATTR_TYPE_UNDERLINE = 1, IBUS_ATTR_TYPE_FOREGROUND = 2, IBUS_ATTR_TYPE_BACKGROUND = 3, } IBusAttrType; +/** + * IBusAttrUnderline: + * @IBUS_ATTR_UNDERLINE_NONE: No underline. + * @IBUS_ATTR_UNDERLINE_SINGLE: Single underline. + * @IBUS_ATTR_UNDERLINE_DOUBLE: Double underline. + * @IBUS_ATTR_UNDERLINE_LOW: Low underline ? %FIXME + * + * Type of IBusText attribute. + */ typedef enum { IBUS_ATTR_UNDERLINE_NONE = 0, IBUS_ATTR_UNDERLINE_SINGLE = 1, @@ -79,6 +105,18 @@ typedef struct _IBusAttributeClass IBusAttributeClass; typedef struct _IBusAttrList IBusAttrList; typedef struct _IBusAttrListClass IBusAttrListClass; + +/** + * SECTION: ibusattribute + * @short_description: Attributes of IBusText. + * @stability: Stable + * @see_also: #IBusText + * + * An IBusAttribute represents an attribute that associate to IBusText. + * It decorates preedit buffer and auxiliary text with underline, foreground and background colors. + */ + + struct _IBusAttribute { IBusSerializable parent; @@ -93,6 +131,12 @@ struct _IBusAttributeClass { IBusSerializableClass parent; }; +/** + * IBusAttrList: + * @attribute: GArray that holds #IBusAttribute. + * + * Array of IBusAttribute. + */ struct _IBusAttrList { IBusSerializable parent; @@ -104,26 +148,98 @@ struct _IBusAttrListClass { IBusSerializableClass parent; }; +/** + * ibus_attribute_get_type: + * @returns: GType of IBusAttribute. + * + * Returns GType of IBusAttribute. + */ GType ibus_attribute_get_type (); + +/** + * ibus_attribute_new: + * @type: Type of the attribute. + * @value: Value of the attribute. + * @start_index: Where attribute starts. + * @end_index: Where attribute ends. + * @returns: A newly allocated IBusAttribute. + * + * New an IBusAttribute. + */ IBusAttribute *ibus_attribute_new (guint type, guint value, guint start_index, guint end_index); +/** + * ibus_attribute_underline_new: + * @underline_type: Type of underline. + * @start_index: Where attribute starts. + * @end_index: Where attribute ends. + * @returns: A newly allocated IBusAttribute. + * + * New an underline IBusAttribute. + */ IBusAttribute *ibus_attr_underline_new (guint underline_type, guint start_index, guint end_index); +/** + * ibus_attribute_foreground_new: + * @color: Color in RGB. + * @start_index: Where attribute starts. + * @end_index: Where attribute ends. + * @returns: A newly allocated IBusAttribute. + * + * New an foreground IBusAttribute. + */ IBusAttribute *ibus_attr_foreground_new (guint color, guint start_index, guint end_index); +/** + * ibus_attribute_background_new: + * @color: Color in RGB. + * @start_index: Where attribute starts. + * @end_index: Where attribute ends. + * @returns: A newly allocated IBusAttribute. + * + * New an background IBusAttribute. + */ IBusAttribute *ibus_attr_background_new (guint color, guint start_index, guint end_index); +/** + * ibus_attr_list_get_type: + * @returns: GType of IBusAttrList. + * + * Returns GType of IBusAttrList. + */ GType ibus_attr_list_get_type (); + +/** + * ibus_attr_list_new: + * @returns: A newly allocated IBusAttrList. + * + * New an IBusAttrList. + */ IBusAttrList *ibus_attr_list_new (); + +/** + * ibus_attr_list_append: + * @attr_list: An IBusAttrList instance. + * @attr: The IBusAttribute instance to be appended. + * + * Append an IBusAttribute to IBusAttrList. + */ void ibus_attr_list_append (IBusAttrList *attr_list, IBusAttribute *attr); +/** + * ibus_attr_list_get: + * @attr_list: An IBusAttrList instance. + * @index: Index of the @attr_list. + * + * Get the IBusAttribute from IBusAttrList at specified index. + */ IBusAttribute *ibus_attr_list_get (IBusAttrList *attr_list, guint index); diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c index 9ca487d..3d700d6 100644 --- a/src/ibuscomponent.c +++ b/src/ibuscomponent.c @@ -481,12 +481,10 @@ ibus_component_parse_engines (IBusComponent *component, g_free (output); if (engines_node) { - if (g_strcmp0 (engines_node->name, "engines") != 0) { - ibus_xml_free (engines_node); - engines_node = NULL; + if (g_strcmp0 (engines_node->name, "engines") == 0) { + node = engines_node; } } - node = engines_node; } } diff --git a/src/ibusenginedesc.c b/src/ibusenginedesc.c index 0410b67..39062b3 100644 --- a/src/ibusenginedesc.c +++ b/src/ibusenginedesc.c @@ -17,6 +17,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +#include <stdlib.h> #include "ibusenginedesc.h" #include "ibusxml.h" @@ -108,6 +109,7 @@ ibus_engine_desc_init (IBusEngineDesc *desc) desc->author = NULL; desc->icon = NULL; desc->layout = NULL; + desc->rank = 0; } static void @@ -239,8 +241,8 @@ ibus_engine_desc_copy (IBusEngineDesc *dest, void ibus_engine_desc_output (IBusEngineDesc *desc, - GString *output, - gint indent) + GString *output, + gint indent) { g_string_append_indent (output, indent); g_string_append (output, "<engine>\n"); @@ -261,6 +263,8 @@ ibus_engine_desc_output (IBusEngineDesc *desc, OUTPUT_ENTRY_1(author); OUTPUT_ENTRY_1(icon); OUTPUT_ENTRY_1(layout); + g_string_append_indent (output, indent + 1); + g_string_append_printf (output, "<rank>%u</rank>", desc->rank); #undef OUTPUT_ENTRY #undef OUTPUT_ENTRY_1 g_string_append_indent (output, indent); @@ -294,6 +298,10 @@ ibus_engine_desc_parse_xml_node (IBusEngineDesc *desc, PARSE_ENTRY_1(layout); #undef PARSE_ENTRY #undef PARSE_ENTRY1 + if (g_strcmp0 (sub_node->name , "rank") == 0) { + desc->rank = atoi (sub_node->text); + continue; + } g_warning ("<engines> element contains invalidate element <%s>", sub_node->name); } return TRUE; diff --git a/src/ibusenginedesc.h b/src/ibusenginedesc.h index ffc5a52..1ba9153 100644 --- a/src/ibusenginedesc.h +++ b/src/ibusenginedesc.h @@ -59,6 +59,7 @@ struct _IBusEngineDesc { gchar *author; gchar *icon; gchar *layout; + guint rank; }; struct _IBusEngineDescClass { diff --git a/src/ibusobject.h b/src/ibusobject.h index 627936f..38cdfac 100644 --- a/src/ibusobject.h +++ b/src/ibusobject.h @@ -22,7 +22,7 @@ * @short_description: Base Object of iBus. * @stability: Stable * - * iBus Object is the base object for all objects in iBus. + * Base object handling functions of iBus. */ #ifndef __IBUS_OBJECT_H_ #define __IBUS_OBJECT_H_ @@ -80,6 +80,12 @@ struct _IBusObject { typedef void ( *IBusObjectDestroyFunc) (IBusObject *); + +/** + * IBusObjectClass: + * @destroy: IBus object destroy method, usually implemented by subclass. + * + */ struct _IBusObjectClass { GObjectClass parent; @@ -91,8 +97,28 @@ struct _IBusObjectClass { gpointer pdummy[7]; }; -GType ibus_object_get_type (void); +/** + * ibus_object_get_type: + * @returns: GType for IBusObject + * + * Returns GType for IBusObject. + */ + GType ibus_object_get_type (void); + +/** + * ibus_object_new: + * @returns: A newly allocated IBusObject + * + * Returns a newly allocated IBusObject. + */ IBusObject *ibus_object_new (void); + +/** + * ibus_object_destory: + * @object: IBusObject to be destroy. + * + * Destroy an IBusObject. + */ void ibus_object_destroy (IBusObject *object); G_END_DECLS diff --git a/src/ibusserver.c b/src/ibusserver.c index cda80af..2299856 100644 --- a/src/ibusserver.c +++ b/src/ibusserver.c @@ -56,7 +56,7 @@ static void ibus_server_get_property(IBusServer *server, guint prop_id, GValue *value, GParamSpec *pspec); -static void ibus_server_listen_internal +static gboolean ibus_server_listen_internal (IBusServer *server, const gchar *address); static void ibus_server_new_connection @@ -102,14 +102,13 @@ ibus_server_new (void) } gboolean -ibus_server_listen (IBusServer *server, +ibus_server_listen (IBusServer *server, const gchar *address) { g_assert (IBUS_IS_SERVER (server)); g_assert (address != NULL); - ibus_server_listen_internal (server, address); - return TRUE; + return ibus_server_listen_internal (server, address); } static void @@ -236,9 +235,9 @@ _new_connection_cb (DBusServer *dbus_server, g_object_unref (connection); } -static void -ibus_server_listen_internal (IBusServer *server, - const gchar *address) +static gboolean +ibus_server_listen_internal (IBusServer *server, + const gchar *address) { g_assert (IBUS_IS_SERVER (server)); g_assert (address != NULL); @@ -254,9 +253,10 @@ ibus_server_listen_internal (IBusServer *server, priv->server = dbus_server_listen (address, &error); if (priv->server == NULL) { - g_error ("Can not listen on '%s':\n" - " %s:%s", - address, error.name, error.message); + g_warning ("Can not listen on '%s':\n" + " %s:%s", + address, error.name, error.message); + return FALSE; } dbus_server_set_new_connection_function (priv->server, @@ -266,9 +266,11 @@ ibus_server_listen_internal (IBusServer *server, dbus_server_set_auth_mechanisms (priv->server, NULL); dbus_server_setup (priv->server, NULL); + return TRUE; } -void ibus_server_disconnect (IBusServer *server) +void +ibus_server_disconnect (IBusServer *server) { g_assert (IBUS_IS_SERVER (server)); @@ -279,7 +281,8 @@ void ibus_server_disconnect (IBusServer *server) dbus_server_disconnect (priv->server); } -const gchar *ibus_server_get_address (IBusServer *server) +const gchar * +ibus_server_get_address (IBusServer *server) { g_assert (IBUS_IS_SERVER (server)); @@ -295,7 +298,8 @@ const gchar *ibus_server_get_address (IBusServer *server) return address; } -const gchar *ibus_server_get_id (IBusServer *server) +const gchar * +ibus_server_get_id (IBusServer *server) { g_assert (IBUS_IS_SERVER (server)); @@ -312,7 +316,7 @@ const gchar *ibus_server_get_id (IBusServer *server) } gboolean -ibus_server_is_connected (IBusServer *server) +ibus_server_is_connected (IBusServer *server) { g_assert (IBUS_IS_SERVER (server)); @@ -324,4 +328,3 @@ ibus_server_is_connected (IBusServer *server) return dbus_server_get_is_connected (priv->server); } - diff --git a/src/ibustext.c b/src/ibustext.c index 1725dda..c1caa6b 100644 --- a/src/ibustext.c +++ b/src/ibustext.c @@ -172,7 +172,7 @@ ibus_text_copy (IBusText *dest, IBusText * ibus_text_new_from_string (const gchar *str) { - g_return_val_if_fail (str != NULL, NULL); + g_assert (str); IBusText *text; @@ -187,14 +187,21 @@ ibus_text_new_from_string (const gchar *str) IBusText * ibus_text_new_from_ucs4 (const gunichar *str) { - g_return_val_if_fail (str != NULL, NULL); + g_assert (str); IBusText *text; + gchar *buf; + + buf = g_ucs4_to_utf8 (str, -1, NULL, NULL, NULL); + + if (buf == NULL) { + return NULL; + } text= g_object_new (IBUS_TYPE_TEXT, NULL); text->is_static = FALSE; - text->text = g_ucs4_to_utf8 (str, -1, NULL, NULL, NULL); + text->text = buf; return text; } @@ -202,7 +209,7 @@ ibus_text_new_from_ucs4 (const gunichar *str) IBusText * ibus_text_new_from_static_string (const gchar *str) { - g_return_val_if_fail (str != NULL, NULL); + g_assert (str); IBusText *text; @@ -218,7 +225,7 @@ IBusText * ibus_text_new_from_printf (const gchar *format, ...) { - g_return_val_if_fail (format != NULL, NULL); + g_assert (format); gchar *str; IBusText *text; @@ -244,6 +251,10 @@ ibus_text_new_from_unichar (gunichar c) IBusText *text; gint len; + if (!g_unichar_validate (c)) { + return NULL; + } + text= g_object_new (IBUS_TYPE_TEXT, NULL); text->text = (gchar *)g_malloc (12); @@ -251,7 +262,6 @@ ibus_text_new_from_unichar (gunichar c) text->text[len] = 0; return text; - } void |