Implement async version of ibus_config_set_value.
BUG=crosbug.com/11903 Review URL: http://codereview.appspot.com/4185041
This commit is contained in:
Родитель
07877cf6f1
Коммит
d9f8ed3e18
|
@ -201,6 +201,7 @@ void
|
|||
ibus_config_get_value_async (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
gint timeout_ms,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
|
@ -213,7 +214,7 @@ ibus_config_get_value_async (IBusConfig *config,
|
|||
"GetValue",
|
||||
g_variant_new ("(ss)", section, name),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
timeout_ms,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
|
@ -272,6 +273,52 @@ ibus_config_set_value (IBusConfig *config,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ibus_config_set_value_async (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
GVariant *value,
|
||||
gint timeout_ms,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (IBUS_IS_CONFIG (config));
|
||||
g_return_if_fail (section != NULL);
|
||||
g_return_if_fail (name != NULL);
|
||||
g_return_if_fail (value != NULL);
|
||||
|
||||
g_dbus_proxy_call ((GDBusProxy *) config,
|
||||
"SetValue", /* method_name */
|
||||
g_variant_new ("(ssv)",
|
||||
section, name, value), /* parameters */
|
||||
G_DBUS_CALL_FLAGS_NONE, /* flags */
|
||||
timeout_ms,
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
ibus_config_set_value_async_finish (IBusConfig *config,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (IBUS_IS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
GVariant *retval = g_dbus_proxy_call_finish ((GDBusProxy *)config,
|
||||
result,
|
||||
error);
|
||||
if (retval != NULL) {
|
||||
g_variant_unref (retval);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ibus_config_unset (IBusConfig *config,
|
||||
const gchar *section,
|
||||
|
|
|
@ -97,7 +97,7 @@ IBusConfig *ibus_config_new (GDBusConnection *connection,
|
|||
* @name: Name of the configure option.
|
||||
* @returns: A #GVariant or %NULL. Free with g_variant_unref().
|
||||
*
|
||||
* Get the value of a configuration option.
|
||||
* Get the value of a configuration option synchronously.
|
||||
*
|
||||
* GConf stores configure options in a tree-like structure,
|
||||
* and the IBus related setting is at /desktop/ibus,
|
||||
|
@ -117,19 +117,22 @@ GVariant *ibus_config_get_value (IBusConfig *config,
|
|||
* @config: An IBusConfig
|
||||
* @section: Section name of the configuration option.
|
||||
* @name: Name of the configure option.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: Callback function to invoke when the return value is ready.
|
||||
* @user_data: The data to pass to callback.
|
||||
*
|
||||
* Get the value of a configuration option.
|
||||
* Get the value of a configuration option asynchronously.
|
||||
*
|
||||
* @see_also: ibus_config_get_value.
|
||||
*/
|
||||
void ibus_config_get_value_async(IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
void ibus_config_get_value_async (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
gint timeout_ms,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* ibus_config_get_value_async_finish:
|
||||
|
@ -152,10 +155,11 @@ GVariant *ibus_config_get_value_async_finish
|
|||
* @config: An IBusConfig
|
||||
* @section: Section name of the configuration option.
|
||||
* @name: Name of the configure option its self.
|
||||
* @value: A #GVariant that holds the value.
|
||||
* @value: A #GVariant that holds the value. If the value is floating, the
|
||||
* function takes ownership of it.
|
||||
* @returns: TRUE if succeed; FALSE otherwise.
|
||||
*
|
||||
* Set the value of a configuration option.
|
||||
* Set the value of a configuration option synchronously.
|
||||
* @see_also: ibus_config_get_value.
|
||||
*/
|
||||
gboolean ibus_config_set_value (IBusConfig *config,
|
||||
|
@ -168,21 +172,25 @@ gboolean ibus_config_set_value (IBusConfig *config,
|
|||
* @config: An #IBusConfig
|
||||
* @section: Section name of the configuration option.
|
||||
* @name: Name of the configure option.
|
||||
* @value: A #GVariant that holds the value.
|
||||
* @value: A #GVariant that holds the value. If the value is floating, the
|
||||
* function takes ownership of it.
|
||||
* @timeout_msec: The timeout in milliseconds or -1 to use the default timeout.
|
||||
* @cancellable: A #GCancellable or %NULL.
|
||||
* @callback: Callback function to invoke when the return value is ready.
|
||||
* @user_data: The data to pass to callback.
|
||||
*
|
||||
* Set the value of a configuration option.
|
||||
* Set the value of a configuration option asynchronously.
|
||||
*
|
||||
* @see_also: ibus_config_set_value.
|
||||
*/
|
||||
void ibus_config_set_value_async(IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
GVariant *value,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
void ibus_config_set_value_async (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name,
|
||||
GVariant *value,
|
||||
gint timeout_ms,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
/**
|
||||
* ibus_config_set_value_async_finish:
|
||||
|
@ -213,6 +221,9 @@ gboolean ibus_config_set_value_async_finish
|
|||
gboolean ibus_config_unset (IBusConfig *config,
|
||||
const gchar *section,
|
||||
const gchar *name);
|
||||
|
||||
/* FIXME add an asynchronous version of unset */
|
||||
|
||||
G_END_DECLS
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче