From: Peng Huang Date: Mon, 25 Jan 2010 08:19:33 +0000 (+0800) Subject: Only enable engines with rank > 0 at frist time startup X-Git-Tag: 1.2.99.20100202~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=331e34332e9099121cfac689f40f71e3ca98f72b;p=platform%2Fupstream%2Fibus.git Only enable engines with rank > 0 at frist time startup --- diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 9b6d294b..7b53d786 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -267,7 +267,7 @@ bus_ibus_impl_set_default_preload_engines (BusIBusImpl *ibus) static gboolean done = FALSE; GValue value = { 0 }; - GList *engines, *l; + GList *engines, *list; gchar *lang, *p; GValueArray *array; @@ -296,16 +296,21 @@ bus_ibus_impl_set_default_preload_engines (BusIBusImpl *ibus) engines = bus_registry_get_engines_by_language (ibus->registry, lang); } } + g_free (lang); + /* sort engines by rank */ 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) { + for (list = engines; list != NULL; list = list->next) { IBusEngineDesc *desc; GValue name = { 0 }; - desc = (IBusEngineDesc *)l->data; + desc = (IBusEngineDesc *)list->data; + + /* ignore engines with rank <== 0 */ + if (desc->rank <= 0) + break; g_value_init (&name, G_TYPE_STRING); g_value_set_string (&name, desc->name); g_value_array_append (array, &name);