OLD | NEW |
---|---|
1 /* vim:set et sts=4: */ | 1 /* vim:set et sts=4: */ |
2 /* ibus - The Input Bus | 2 /* ibus - The Input Bus |
3 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> | 3 * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> |
4 * Copyright (C) 2008-2010 Red Hat, Inc. | 4 * Copyright (C) 2008-2010 Red Hat, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Lesser General Public License for more details. | 14 * Lesser General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Lesser General Public | 16 * You should have received a copy of the GNU Lesser General Public |
17 * License along with this library; if not, write to the | 17 * License along with this library; if not, write to the |
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 * Boston, MA 02111-1307, USA. | 19 * Boston, MA 02111-1307, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include <unistd.h> | 22 #include <unistd.h> |
23 #include <sys/types.h> | 23 #include <sys/types.h> |
24 #include <sys/wait.h> | 24 #include <sys/wait.h> |
25 #include <signal.h> | 25 #include <signal.h> |
26 #include <stdlib.h> | 26 #include <stdlib.h> |
27 #include <locale.h> | 27 #include <locale.h> |
28 #include <strings.h> | 28 #include <string.h> |
29 #include "ibusimpl.h" | 29 #include "ibusimpl.h" |
30 #include "dbusimpl.h" | 30 #include "dbusimpl.h" |
31 #include "server.h" | 31 #include "server.h" |
32 #include "connection.h" | 32 #include "connection.h" |
33 #include "registry.h" | 33 #include "registry.h" |
34 #include "factoryproxy.h" | 34 #include "factoryproxy.h" |
35 #include "panelproxy.h" | 35 #include "panelproxy.h" |
36 #include "inputcontext.h" | 36 #include "inputcontext.h" |
37 #include "option.h" | 37 #include "option.h" |
38 | 38 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 GValue *value); | 73 GValue *value); |
74 static void bus_ibus_impl_set_enable_by_default | 74 static void bus_ibus_impl_set_enable_by_default |
75 (BusIBusImpl *ibus, | 75 (BusIBusImpl *ibus, |
76 GValue *value); | 76 GValue *value); |
77 | 77 |
78 static void bus_ibus_impl_set_use_global_engine | 78 static void bus_ibus_impl_set_use_global_engine |
79 (BusIBusImpl *ibus, | 79 (BusIBusImpl *ibus, |
80 GValue *value); | 80 GValue *value); |
81 static void bus_ibus_impl_set_global_engine (BusIBusImpl *ibus, | 81 static void bus_ibus_impl_set_global_engine (BusIBusImpl *ibus, |
82 BusEngineProxy *engine); | 82 BusEngineProxy *engine); |
83 static void bus_ibus_impl_set_global_engine_by_name | |
84 (BusIBusImpl *ibus, | |
85 const gchar *name); | |
86 static void bus_ibus_impl_engines_maybe_removed | |
87 (BusIBusImpl *ibus); | |
83 | 88 |
84 static void bus_ibus_impl_registry_changed (BusIBusImpl *ibus); | 89 static void bus_ibus_impl_registry_changed (BusIBusImpl *ibus); |
85 static void bus_ibus_impl_global_engine_changed | 90 static void bus_ibus_impl_global_engine_changed |
86 (BusIBusImpl *ibus); | 91 (BusIBusImpl *ibus); |
87 | 92 |
88 static void _factory_destroy_cb (BusFactoryProxy *factory, | 93 static void _factory_destroy_cb (BusFactoryProxy *factory, |
89 BusIBusImpl *ibus); | 94 BusIBusImpl *ibus); |
90 | 95 |
91 static void bus_ibus_impl_set_context_engine_from_desc | 96 static void bus_ibus_impl_set_context_engine_from_desc |
92 (BusIBusImpl *ibus, | 97 (BusIBusImpl *ibus, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 | 256 |
252 if (ibus->engine_list) { | 257 if (ibus->engine_list) { |
253 IBusComponent *component; | 258 IBusComponent *component; |
254 | 259 |
255 component = ibus_component_get_from_engine ((IBusEngineDesc *) ibus->eng ine_list->data); | 260 component = ibus_component_get_from_engine ((IBusEngineDesc *) ibus->eng ine_list->data); |
256 if (component && !ibus_component_is_running (component)) { | 261 if (component && !ibus_component_is_running (component)) { |
257 ibus_component_start (component, g_verbose); | 262 ibus_component_start (component, g_verbose); |
258 } | 263 } |
259 } | 264 } |
260 | 265 |
266 bus_ibus_impl_engines_maybe_removed (ibus); | |
261 bus_ibus_impl_update_engines_hotkey_profile (ibus); | 267 bus_ibus_impl_update_engines_hotkey_profile (ibus); |
262 } | 268 } |
263 | 269 |
264 static void | 270 static void |
265 bus_ibus_impl_set_use_sys_layout (BusIBusImpl *ibus, | 271 bus_ibus_impl_set_use_sys_layout (BusIBusImpl *ibus, |
266 GValue *value) | 272 GValue *value) |
267 { | 273 { |
268 if (value != NULL && G_VALUE_TYPE (value) == G_TYPE_BOOLEAN) { | 274 if (value != NULL && G_VALUE_TYPE (value) == G_TYPE_BOOLEAN) { |
269 ibus->use_sys_layout = g_value_get_boolean (value); | 275 ibus->use_sys_layout = g_value_get_boolean (value); |
270 } | 276 } |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 | 851 |
846 g_object_ref (factory); | 852 g_object_ref (factory); |
847 engine = bus_factory_proxy_create_engine (factory, engine_desc); | 853 engine = bus_factory_proxy_create_engine (factory, engine_desc); |
848 g_object_unref (factory); | 854 g_object_unref (factory); |
849 | 855 |
850 return engine; | 856 return engine; |
851 } | 857 } |
852 | 858 |
853 static IBusEngineDesc * | 859 static IBusEngineDesc * |
854 _find_engine_desc_by_name(BusIBusImpl *ibus, | 860 _find_engine_desc_by_name(BusIBusImpl *ibus, |
855 gchar *engine_name) | 861 const gchar *engine_name) |
856 { | 862 { |
857 IBusEngineDesc *engine_desc = NULL; | 863 IBusEngineDesc *engine_desc = NULL; |
858 GList *p; | 864 GList *p; |
859 | 865 |
860 /* find engine in registered engine list */ | 866 /* find engine in registered engine list */ |
861 for (p = ibus->register_engine_list; p != NULL; p = p->next) { | 867 for (p = ibus->register_engine_list; p != NULL; p = p->next) { |
862 engine_desc = (IBusEngineDesc *)p->data; | 868 engine_desc = (IBusEngineDesc *)p->data; |
863 if (g_strcmp0 (engine_desc->name, engine_name) == 0) | 869 if (g_strcmp0 (engine_desc->name, engine_name) == 0) |
864 return engine_desc; | 870 return engine_desc; |
865 } | 871 } |
866 | 872 |
867 /* find engine in preload engine list */ | 873 /* find engine in preload engine list */ |
868 for (p = ibus->engine_list; p != NULL; p = p->next) { | 874 for (p = ibus->engine_list; p != NULL; p = p->next) { |
869 engine_desc = (IBusEngineDesc *)p->data; | 875 engine_desc = (IBusEngineDesc *)p->data; |
870 if (g_strcmp0 (engine_desc->name, engine_name) == 0) | 876 if (g_strcmp0 (engine_desc->name, engine_name) == 0) |
871 return engine_desc; | 877 return engine_desc; |
872 } | 878 } |
873 | 879 |
874 return NULL; | 880 return NULL; |
875 } | 881 } |
876 | 882 |
877 static void | 883 static void |
878 _context_request_engine_cb (BusInputContext *context, | 884 _context_request_engine_cb (BusInputContext *context, |
879 gchar *engine_name, | 885 const gchar *engine_name, |
880 BusIBusImpl *ibus) | 886 BusIBusImpl *ibus) |
881 { | 887 { |
882 IBusEngineDesc *engine_desc = NULL; | 888 IBusEngineDesc *engine_desc = NULL; |
883 BusEngineProxy *engine; | 889 BusEngineProxy *engine; |
884 | 890 |
885 /* context should has focus before request an engine */ | 891 /* context should has focus before request an engine */ |
886 g_return_if_fail (bus_input_context_has_focus (context)); | 892 g_return_if_fail (bus_input_context_has_focus (context)); |
887 | 893 |
888 if (engine_name == NULL || engine_name[0] == '\0') { | 894 if (engine_name == NULL || engine_name[0] == '\0') { |
889 /* Use global engine if possible. */ | 895 /* Use global engine if possible. */ |
890 if (ibus->use_global_engine) { | 896 if (ibus->use_global_engine) { |
891 if (ibus->global_engine) { | 897 if (ibus->global_engine) { |
892 bus_ibus_impl_set_context_engine (ibus, context, ibus->global_en gine); | 898 bus_ibus_impl_set_context_engine (ibus, context, ibus->global_en gine); |
893 return; | 899 return; |
894 } | 900 } |
895 else { | 901 else { |
896 engine_name = bus_ibus_impl_load_global_engine_name_from_config (ibus); | 902 gchar *global_name = bus_ibus_impl_load_global_engine_name_from_ config (ibus); |
897 if (engine_name) { | 903 if (global_name) { |
898 engine_desc = _find_engine_desc_by_name (ibus, engine_name); | 904 engine_desc = _find_engine_desc_by_name (ibus, global_name); |
899 g_free (engine_name); | 905 g_free (global_name); |
900 } | 906 } |
901 } | 907 } |
902 } | 908 } |
903 /* request default engine */ | |
904 if (!engine_desc) { | |
905 if (ibus->register_engine_list) { | |
906 engine_desc = (IBusEngineDesc *)ibus->register_engine_list->data ; | |
907 } | |
908 else if (ibus->engine_list) { | |
909 engine_desc = (IBusEngineDesc *)ibus->engine_list->data; | |
910 } | |
911 } | |
912 } | 909 } |
913 else { | 910 else { |
914 /* request engine by name */ | 911 /* request engine by name */ |
915 engine_desc = _find_engine_desc_by_name (ibus, engine_name); | 912 engine_desc = _find_engine_desc_by_name (ibus, engine_name); |
916 } | 913 } |
917 | 914 |
915 /* request default engine */ | |
916 if (!engine_desc) { | |
917 if (ibus->register_engine_list) { | |
918 engine_desc = (IBusEngineDesc *)ibus->register_engine_list->data; | |
919 } | |
920 else if (ibus->engine_list) { | |
921 engine_desc = (IBusEngineDesc *)ibus->engine_list->data; | |
922 } | |
923 } | |
924 | |
918 bus_ibus_impl_set_context_engine_from_desc (ibus, context, engine_desc); | 925 bus_ibus_impl_set_context_engine_from_desc (ibus, context, engine_desc); |
919 } | 926 } |
920 | 927 |
921 static void | 928 static void |
922 bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus, | 929 bus_ibus_impl_context_request_next_engine_in_menu (BusIBusImpl *ibus, |
923 BusInputContext *context) | 930 BusInputContext *context) |
924 { | 931 { |
925 BusEngineProxy *engine; | 932 BusEngineProxy *engine; |
926 IBusEngineDesc *desc; | 933 IBusEngineDesc *desc; |
927 IBusEngineDesc *next_desc = NULL; | 934 IBusEngineDesc *next_desc = NULL; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1028 g_signal_connect (ibus->global_engine, "destroy", | 1035 g_signal_connect (ibus->global_engine, "destroy", |
1029 G_CALLBACK (_global_engine_destroy_cb), ibus); | 1036 G_CALLBACK (_global_engine_destroy_cb), ibus); |
1030 } | 1037 } |
1031 | 1038 |
1032 bus_ibus_impl_save_global_engine_name_to_config (ibus); | 1039 bus_ibus_impl_save_global_engine_name_to_config (ibus); |
1033 bus_ibus_impl_save_global_previous_engine_name_to_config (ibus); | 1040 bus_ibus_impl_save_global_previous_engine_name_to_config (ibus); |
1034 bus_ibus_impl_global_engine_changed (ibus); | 1041 bus_ibus_impl_global_engine_changed (ibus); |
1035 } | 1042 } |
1036 | 1043 |
1037 static void | 1044 static void |
1045 bus_ibus_impl_set_global_engine_by_name (BusIBusImpl *ibus, | |
1046 const gchar *name) | |
1047 { | |
1048 gchar *old_engine_name = NULL; | |
1049 | |
1050 if (!ibus->use_global_engine) | |
1051 return; | |
1052 | |
1053 if (ibus->global_engine) { | |
1054 old_engine_name = bus_engine_proxy_get_desc (ibus->global_engine)->name; | |
1055 } | |
1056 | |
1057 if (g_strcmp0 (name, old_engine_name) == 0) { | |
1058 /* If the user requested the same global engine, then we just enable the | |
1059 * original one. */ | |
1060 if (ibus->focused_context) { | |
1061 bus_input_context_enable (ibus->focused_context); | |
1062 } | |
1063 else if (ibus->global_engine) { | |
1064 bus_engine_proxy_enable (ibus->global_engine); | |
1065 } | |
1066 return; | |
1067 } | |
1068 | |
1069 /* If there is a focused input context, then we just change the engine of | |
1070 * the focused context, which will then change the global engine | |
1071 * automatically. Otherwise, we need to change the global engine directly. | |
1072 */ | |
1073 if (ibus->focused_context) { | |
1074 _context_request_engine_cb (ibus->focused_context, name, ibus); | |
1075 } | |
1076 else { | |
1077 IBusEngineDesc *engine_desc = _find_engine_desc_by_name (ibus, name); | |
1078 if (engine_desc != NULL) { | |
1079 BusEngineProxy *new_engine = bus_ibus_impl_create_engine (engine_des c); | |
1080 if (new_engine != NULL) { | |
1081 /* Enable the global engine by default, because the user | |
1082 * selected it explicitly. */ | |
1083 bus_engine_proxy_enable (new_engine); | |
1084 | |
1085 /* Assume the ownership of the new global engine. Normally it's | |
1086 * done by the input context. But as we need to change the globa l | |
1087 * engine directly, so we need to do it here. */ | |
1088 g_object_ref_sink (new_engine); | |
1089 bus_ibus_impl_set_global_engine (ibus, new_engine); | |
1090 | |
1091 /* The global engine should already be referenced. */ | |
1092 g_object_unref (new_engine); | |
1093 } | |
1094 } | |
1095 } | |
1096 } | |
1097 | |
1098 static void | |
1099 bus_ibus_impl_engines_maybe_removed (BusIBusImpl *ibus) | |
1100 { | |
1101 gchar *old_engine_name = NULL; | |
satorux1
2010/05/27 05:29:02
const gchar * if possible?
| |
1102 GList *engine_list = NULL; | |
1103 | |
1104 if (!ibus->use_global_engine || !ibus->global_engine) | |
1105 return; | |
1106 | |
1107 old_engine_name = bus_engine_proxy_get_desc (ibus->global_engine)->name; | |
1108 | |
1109 /* The current global engine is not removed, so do nothing. */ | |
1110 if (_find_engine_desc_by_name (ibus, old_engine_name)) | |
1111 return; | |
1112 | |
1113 /* If the previous engine is available, then just switch to it. */ | |
1114 if (ibus->global_previous_engine_name && | |
1115 _find_engine_desc_by_name (ibus, ibus->global_previous_engine_name)) { | |
1116 bus_ibus_impl_set_global_engine_by_name ( | |
1117 ibus, ibus->global_previous_engine_name); | |
1118 return; | |
1119 } | |
1120 | |
1121 /* Just choose one in the list. */ | |
1122 engine_list = ibus->register_engine_list; | |
1123 if (!engine_list) | |
1124 engine_list = ibus->engine_list; | |
1125 | |
1126 if (engine_list) { | |
1127 IBusEngineDesc *engine_desc = (IBusEngineDesc *)engine_list->data; | |
1128 bus_ibus_impl_set_global_engine_by_name (ibus, engine_desc->name); | |
1129 return; | |
1130 } | |
1131 | |
1132 /* No engine available? Just disable global engine. */ | |
1133 bus_ibus_impl_set_global_engine (ibus, NULL); | |
1134 } | |
1135 | |
1136 static void | |
1038 bus_ibus_impl_set_context_engine_from_desc (BusIBusImpl *ibus, | 1137 bus_ibus_impl_set_context_engine_from_desc (BusIBusImpl *ibus, |
1039 BusInputContext *context, | 1138 BusInputContext *context, |
1040 IBusEngineDesc *engine_desc) | 1139 IBusEngineDesc *engine_desc) |
1041 { | 1140 { |
1042 if (engine_desc != NULL) { | 1141 if (engine_desc != NULL) { |
1043 BusEngineProxy *engine = bus_ibus_impl_create_engine (engine_desc); | 1142 BusEngineProxy *engine = bus_ibus_impl_create_engine (engine_desc); |
1044 if (engine != NULL) { | 1143 if (engine != NULL) { |
1045 bus_ibus_impl_set_context_engine (ibus, context, engine); | 1144 bus_ibus_impl_set_context_engine (ibus, context, engine); |
1046 } | 1145 } |
1047 } | 1146 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1314 if (g_list_find (ibus->register_engine_list, p->data)) { | 1413 if (g_list_find (ibus->register_engine_list, p->data)) { |
1315 ibus->register_engine_list = g_list_remove (ibus->register_engin e_list, p->data); | 1414 ibus->register_engine_list = g_list_remove (ibus->register_engin e_list, p->data); |
1316 g_object_unref (p->data); | 1415 g_object_unref (p->data); |
1317 } | 1416 } |
1318 } | 1417 } |
1319 g_list_free (engines); | 1418 g_list_free (engines); |
1320 } | 1419 } |
1321 | 1420 |
1322 g_object_unref (factory); | 1421 g_object_unref (factory); |
1323 | 1422 |
1423 bus_ibus_impl_engines_maybe_removed (ibus); | |
1324 bus_ibus_impl_update_engines_hotkey_profile (ibus); | 1424 bus_ibus_impl_update_engines_hotkey_profile (ibus); |
1325 } | 1425 } |
1326 | 1426 |
1327 static void | 1427 static void |
1328 bus_ibus_impl_add_factory (BusIBusImpl *ibus, | 1428 bus_ibus_impl_add_factory (BusIBusImpl *ibus, |
1329 BusFactoryProxy *factory) | 1429 BusFactoryProxy *factory) |
1330 { | 1430 { |
1331 g_assert (BUS_IS_IBUS_IMPL (ibus)); | 1431 g_assert (BUS_IS_IBUS_IMPL (ibus)); |
1332 g_assert (BUS_IS_FACTORY_PROXY (factory)); | 1432 g_assert (BUS_IS_FACTORY_PROXY (factory)); |
1333 | 1433 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1574 "No global engine."); | 1674 "No global engine."); |
1575 return reply; | 1675 return reply; |
1576 } | 1676 } |
1577 | 1677 |
1578 static IBusMessage * | 1678 static IBusMessage * |
1579 _ibus_set_global_engine (BusIBusImpl *ibus, | 1679 _ibus_set_global_engine (BusIBusImpl *ibus, |
1580 IBusMessage *message, | 1680 IBusMessage *message, |
1581 BusConnection *connection) | 1681 BusConnection *connection) |
1582 { | 1682 { |
1583 gboolean retval; | 1683 gboolean retval; |
1584 IBusMessage *reply; | |
1585 IBusError *error; | 1684 IBusError *error; |
1586 gchar *new_engine_name; | 1685 gchar *new_engine_name = NULL; |
1587 gchar *old_engine_name; | |
1588 | 1686 |
1589 if (!ibus->use_global_engine) { | 1687 if (!ibus->use_global_engine) { |
1590 reply = ibus_message_new_error (message, DBUS_ERROR_FAILED, | 1688 return ibus_message_new_error (message, DBUS_ERROR_FAILED, |
1591 "Global engine feature is disable."); | 1689 "Global engine feature is disable."); |
1592 return reply; | |
1593 } | 1690 } |
1594 | 1691 |
1595 retval = ibus_message_get_args (message, | 1692 retval = ibus_message_get_args (message, |
1596 &error, | 1693 &error, |
1597 G_TYPE_STRING, &new_engine_name, | 1694 G_TYPE_STRING, &new_engine_name, |
1598 G_TYPE_INVALID); | 1695 G_TYPE_INVALID); |
1599 if (!retval) { | 1696 if (!retval) { |
1600 reply = ibus_message_new_error (message, | 1697 IBusMessage *reply = ibus_message_new_error (message, |
1601 error->name, | 1698 error->name, |
1602 error->message); | 1699 error->message); |
1603 ibus_error_free (error); | 1700 ibus_error_free (error); |
1604 return reply; | 1701 return reply; |
1605 } | 1702 } |
1606 | 1703 |
1607 reply = ibus_message_new_method_return (message); | 1704 if (!new_engine_name || !new_engine_name[0] || |
1608 old_engine_name = NULL; | 1705 !_find_engine_desc_by_name (ibus, new_engine_name)) { |
1609 | 1706 return ibus_message_new_error (message, DBUS_ERROR_FAILED, |
1610 if (ibus->global_engine) { | 1707 "Invalid engine name."); |
1611 old_engine_name = bus_engine_proxy_get_desc (ibus->global_engine)->name; | |
1612 } | 1708 } |
1613 | 1709 |
1614 if (g_strcmp0 (new_engine_name, old_engine_name) == 0) { | 1710 bus_ibus_impl_set_global_engine_by_name (ibus, new_engine_name); |
1615 /* If the user requested the same global engine, then we just enable the | |
1616 * original one. */ | |
1617 if (ibus->focused_context) { | |
1618 bus_input_context_enable (ibus->focused_context); | |
1619 } | |
1620 else if (ibus->global_engine) { | |
1621 bus_engine_proxy_enable (ibus->global_engine); | |
1622 } | |
1623 return reply; | |
1624 } | |
1625 | 1711 |
1626 /* If there is a focused input context, then we just change the engine of | 1712 return ibus_message_new_method_return (message); |
1627 * the focused context, which will then change the global engine | |
1628 * automatically. Otherwise, we need to change the global engine directly. | |
1629 */ | |
1630 if (ibus->focused_context) { | |
1631 _context_request_engine_cb (ibus->focused_context, new_engine_name, ibus ); | |
1632 } | |
1633 else { | |
1634 IBusEngineDesc *engine_desc = _find_engine_desc_by_name (ibus, new_engin e_name); | |
1635 if (engine_desc != NULL) { | |
1636 BusEngineProxy *new_engine = bus_ibus_impl_create_engine (engine_des c); | |
1637 if (new_engine != NULL) { | |
1638 /* Enable the global engine by default, because the user | |
1639 * selected it explicitly. */ | |
1640 bus_engine_proxy_enable (new_engine); | |
1641 | |
1642 /* Assume the ownership of the new global engine. Normally it's | |
1643 * done by the input context. But as we need to change the globa l | |
1644 * engine directly, so we need to do it here. */ | |
1645 g_object_ref_sink (new_engine); | |
1646 bus_ibus_impl_set_global_engine (ibus, new_engine); | |
1647 | |
1648 /* The global engine should already be referenced. */ | |
1649 g_object_unref (new_engine); | |
1650 } | |
1651 } | |
1652 } | |
1653 | |
1654 return reply; | |
1655 } | 1713 } |
1656 | 1714 |
1657 static IBusMessage * | 1715 static IBusMessage * |
1658 _ibus_is_global_engine_enabled (BusIBusImpl *ibus, | 1716 _ibus_is_global_engine_enabled (BusIBusImpl *ibus, |
1659 IBusMessage *message, | 1717 IBusMessage *message, |
1660 BusConnection *connection) | 1718 BusConnection *connection) |
1661 { | 1719 { |
1662 IBusMessage *reply; | 1720 IBusMessage *reply; |
1663 gboolean enabled = (ibus->use_global_engine && ibus->global_engine && | 1721 gboolean enabled = (ibus->use_global_engine && ibus->global_engine && |
1664 bus_engine_proxy_is_enabled (ibus->global_engine)); | 1722 bus_engine_proxy_is_enabled (ibus->global_engine)); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2048 g_hash_table_unref (ibus->hotkey_to_engines_map); | 2106 g_hash_table_unref (ibus->hotkey_to_engines_map); |
2049 } | 2107 } |
2050 | 2108 |
2051 ibus->engines_hotkey_profile = ibus_hotkey_profile_new(); | 2109 ibus->engines_hotkey_profile = ibus_hotkey_profile_new(); |
2052 ibus->hotkey_to_engines_map = | 2110 ibus->hotkey_to_engines_map = |
2053 g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_list_free); | 2111 g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_list_free); |
2054 | 2112 |
2055 g_list_foreach (ibus->register_engine_list, (GFunc) _add_engine_hotkey, ibus ); | 2113 g_list_foreach (ibus->register_engine_list, (GFunc) _add_engine_hotkey, ibus ); |
2056 g_list_foreach (ibus->engine_list, (GFunc) _add_engine_hotkey, ibus); | 2114 g_list_foreach (ibus->engine_list, (GFunc) _add_engine_hotkey, ibus); |
2057 } | 2115 } |
OLD | NEW |