From 60587bf804feb7ed4dcb8c1731f115420ca28b49 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Thu, 16 Feb 2012 13:04:05 +0900 Subject: [PATCH] Fix gir annotations. - It seems python does not allow to use 'exec' as a variable. Renamed 'exec' property so that the constructor in IBus.Component is used. - It seems the python virtual method is available when the function is described in header files in case that annotations are needed so the signal function ibus_factory_create_engine is added newly. TEST=Linux desktop Review URL: https://codereview.appspot.com/5649082 --- src/ibusattribute.h | 8 ++++---- src/ibuscomponent.c | 20 ++++++++++---------- src/ibuscomponent.h | 8 ++++---- src/ibusfactory.c | 20 +++++++++++++++++--- src/ibusfactory.h | 11 +++++++++++ 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/src/ibusattribute.h b/src/ibusattribute.h index 9096ff3..7a7fcb6 100644 --- a/src/ibusattribute.h +++ b/src/ibusattribute.h @@ -130,7 +130,7 @@ GType ibus_attribute_get_type (); * @value: Value of the attribute. * @start_index: Where attribute starts. * @end_index: Where attribute ends. - * @returns: A newly allocated IBusAttribute. + * @returns: (transfer none): A newly allocated IBusAttribute. * * New an IBusAttribute. */ @@ -182,7 +182,7 @@ guint ibus_attribute_get_end_index * @underline_type: Type of underline. * @start_index: Where attribute starts. * @end_index: Where attribute ends. - * @returns: A newly allocated #IBusAttribute. + * @returns: (transfer none): A newly allocated #IBusAttribute. * * New an underline #IBusAttribute. */ @@ -194,7 +194,7 @@ IBusAttribute *ibus_attr_underline_new (guint underline_type, * @color: Color in RGB. * @start_index: Where attribute starts. * @end_index: Where attribute ends. - * @returns: A newly allocated #IBusAttribute. + * @returns: (transfer none): A newly allocated #IBusAttribute. * * New an foreground #IBusAttribute. */ @@ -206,7 +206,7 @@ IBusAttribute *ibus_attr_foreground_new (guint color, * @color: Color in RGB. * @start_index: Where attribute starts. * @end_index: Where attribute ends. - * @returns: A newly allocated #IBusAttribute. + * @returns: (transfer none): A newly allocated #IBusAttribute. * * New an background #IBusAttribute. */ diff --git a/src/ibuscomponent.c b/src/ibuscomponent.c index 1c52a23..af8ca4f 100644 --- a/src/ibuscomponent.c +++ b/src/ibuscomponent.c @@ -34,7 +34,7 @@ enum { PROP_LICENSE, PROP_AUTHOR, PROP_HOMEPAGE, - PROP_EXEC, + PROP_COMMAND_LINE, PROP_TEXTDOMAIN, }; @@ -188,15 +188,15 @@ ibus_component_class_init (IBusComponentClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** - * IBusComponent:exec: + * IBusComponent:command-line: * * The exec path of component */ g_object_class_install_property (gobject_class, - PROP_EXEC, - g_param_spec_string ("exec", - "component exec", - "The exec path of component", + PROP_COMMAND_LINE, + g_param_spec_string ("command-line", + "component command-line", + "The command line of component", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); @@ -305,7 +305,7 @@ ibus_component_set_property (IBusComponent *component, g_assert (component->priv->homepage == NULL); component->priv->homepage = g_value_dup_string (value); break; - case PROP_EXEC: + case PROP_COMMAND_LINE: g_assert (component->priv->exec == NULL); component->priv->exec = g_value_dup_string (value); break; @@ -343,7 +343,7 @@ ibus_component_get_property (IBusComponent *component, case PROP_HOMEPAGE: g_value_set_string (value, ibus_component_get_homepage (component)); break; - case PROP_EXEC: + case PROP_COMMAND_LINE: g_value_set_string (value, ibus_component_get_exec (component)); break; case PROP_TEXTDOMAIN: @@ -698,7 +698,7 @@ ibus_component_new (const gchar *name, const gchar *license, const gchar *author, const gchar *homepage, - const gchar *exec, + const gchar *command_line, const gchar *textdomain) { return ibus_component_new_varargs ("name", name, @@ -707,7 +707,7 @@ ibus_component_new (const gchar *name, "license", license, "author", author, "homepage", homepage, - "exec", exec, + "command-line", command_line, "textdomain", textdomain, NULL); } diff --git a/src/ibuscomponent.h b/src/ibuscomponent.h index 97a48ec..8f35b94 100644 --- a/src/ibuscomponent.h +++ b/src/ibuscomponent.h @@ -84,7 +84,7 @@ typedef struct _IBusComponentPrivate IBusComponentPrivate; * license: Distribution license of this component. * author: Author(s) of the component. * homepage: Homepage of the component. - * exec: path to component executable. + * command_line: path to component executable. * textdomain: Domain name for dgettext() */ struct _IBusComponent { @@ -115,7 +115,7 @@ GType ibus_component_get_type (void); * @license: Distribution license of this component. * @author: Author(s) of the component. * @homepage: Homepage of the component. - * @exec: path to component executable. + * @command_line: path to component executable. * @textdomain: Domain name for dgettext() * @returns: A newly allocated IBusComponent. * @@ -127,7 +127,7 @@ IBusComponent *ibus_component_new (const gchar *name, const gchar *license, const gchar *author, const gchar *homepage, - const gchar *exec, + const gchar *command_line, const gchar *textdomain); /** @@ -139,7 +139,7 @@ IBusComponent *ibus_component_new (const gchar *name, * ibus_component_new_varargs() supports the va_list format. * name property is required. e.g. * IBusComponent *component = ibus_component_new_varargs ("name", "ibus-foo", - * "exec", "/usr/libexec/ibus-engine-foo --ibus", + * "command_line", "/usr/libexec/ibus-engine-foo --ibus", * NULL) */ IBusComponent *ibus_component_new_varargs (const gchar *first_property_name, diff --git a/src/ibusfactory.c b/src/ibusfactory.c index cdcf1a6..ceb7fb9 100644 --- a/src/ibusfactory.c +++ b/src/ibusfactory.c @@ -100,8 +100,8 @@ static const gchar introspection_xml[] = ""; 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); @@ -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; +} diff --git a/src/ibusfactory.h b/src/ibusfactory.h index e5e6fba..dd683d0 100644 --- a/src/ibusfactory.h +++ b/src/ibusfactory.h @@ -168,6 +168,17 @@ void ibus_factory_add_engine (IBusFactory *factory, const gchar *engine_name, GType engine_type); +/** + * ibus_factory_create_engine: + * @factory: An #IBusFactory. + * @engine_name: Name of an engine. + * @returns: (transfer full): #IBusEngine with @engine_name. + * + * Create an #IBusEngine with @engine_name. + */ +IBusEngine *ibus_factory_create_engine (IBusFactory *factory, + const gchar *engine_name); + G_END_DECLS #endif -- 2.7.4