Add Ctrl+space customization.
[platform/upstream/ibus.git] / src / ibusfactory.c
index cdcf1a6..54a94fe 100644 (file)
@@ -100,8 +100,8 @@ static const gchar introspection_xml[] =
     "</node>";
 
 static IBusEngine *
-_ibus_factory_create_engine (IBusFactory    *factory,
-                             const gchar    *engine_name)
+ibus_factory_real_create_engine (IBusFactory    *factory,
+                                 const gchar    *engine_name)
 {
     GType engine_type;
     gchar *object_path = NULL;
@@ -154,7 +154,7 @@ ibus_factory_class_init (IBusFactoryClass *class)
     IBUS_SERVICE_CLASS (class)->service_method_call  = ibus_factory_service_method_call;
     IBUS_SERVICE_CLASS (class)->service_get_property = ibus_factory_service_get_property;
     IBUS_SERVICE_CLASS (class)->service_set_property = ibus_factory_service_set_property;
-    class->create_engine = _ibus_factory_create_engine;
+    class->create_engine = ibus_factory_real_create_engine;
 
     ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
 
@@ -164,13 +164,14 @@ ibus_factory_class_init (IBusFactoryClass *class)
      * IBusFactory::create-engine:
      * @factory: the factory which received the signal
      * @engine_name: the engine_name which received the signal
-     * @returns: (transfer none): An IBusEngine
+     * @returns: (transfer full): An IBusEngine
      *
      * The ::create-engine signal is a signal to create IBusEngine
      * with @engine_name, which gets emitted when IBusFactory
      * received CreateEngine dbus method. The callback functions
      * will be called until a callback returns a non-null object
-     * of IBusEngine. */
+     * of IBusEngine.
+     */
     factory_signals[CREATE_ENGINE] =
         g_signal_new (I_("create-engine"),
             G_TYPE_FROM_CLASS (gobject_class),
@@ -201,9 +202,8 @@ ibus_factory_destroy (IBusFactory *factory)
     GList *list;
 
     list = g_list_copy (factory->priv->engine_list);
-    g_list_foreach (list, (GFunc) ibus_object_destroy, NULL);
-    g_list_free (factory->priv->engine_list);
-    g_list_free (list);
+    g_list_free_full (list, (GDestroyNotify)ibus_object_destroy);
+    g_list_free(factory->priv->engine_list);
     factory->priv->engine_list = NULL;
 
     if (factory->priv->engine_table) {
@@ -353,10 +353,10 @@ ibus_factory_new (GDBusConnection *connection)
 {
     g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
 
-    IBusEngine *object = g_object_new (IBUS_TYPE_FACTORY,
-                                       "object-path", IBUS_PATH_FACTORY,
-                                       "connection", connection,
-                                       NULL);
+    IBusFactory *object = g_object_new (IBUS_TYPE_FACTORY,
+                                        "object-path", IBUS_PATH_FACTORY,
+                                        "connection", connection,
+                                        NULL);
 
     return IBUS_FACTORY (object);
 }
@@ -372,3 +372,17 @@ ibus_factory_add_engine (IBusFactory *factory,
 
     g_hash_table_insert (factory->priv->engine_table, g_strdup (engine_name), (gpointer) engine_type);
 }
+
+IBusEngine *
+ibus_factory_create_engine (IBusFactory    *factory,
+                            const gchar    *engine_name)
+{
+    IBusEngine *engine = NULL;
+
+    g_assert (engine_name != NULL);
+
+    g_signal_emit (factory, factory_signals[CREATE_ENGINE],
+                   0, engine_name, &engine);
+
+    return engine;
+}