|
Packit Service |
1d8f1c |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit Service |
1d8f1c |
/* vim:set et sts=4: */
|
|
Packit Service |
1d8f1c |
/* ibus - The Input Bus
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2010 Red Hat, Inc.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
1d8f1c |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
1d8f1c |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d8f1c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d8f1c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d8f1c |
* Lesser General Public License for more details.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
1d8f1c |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit Service |
1d8f1c |
* USA
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
#include "ibusshare.h"
|
|
Packit Service |
1d8f1c |
#include "ibusconfigservice.h"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
enum {
|
|
Packit Service |
1d8f1c |
LAST_SIGNAL,
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
enum {
|
|
Packit Service |
1d8f1c |
PROP_0,
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* functions prototype */
|
|
Packit Service |
1d8f1c |
static void ibus_config_service_class_init (IBusConfigServiceClass *class);
|
|
Packit Service |
1d8f1c |
static void ibus_config_service_init (IBusConfigService *config);
|
|
Packit Service |
1d8f1c |
static void ibus_config_service_destroy (IBusConfigService *config);
|
|
Packit Service |
1d8f1c |
static void ibus_config_service_service_method_call
|
|
Packit Service |
1d8f1c |
(IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *method_name,
|
|
Packit Service |
1d8f1c |
GVariant *parameters,
|
|
Packit Service |
1d8f1c |
GDBusMethodInvocation *invocation);
|
|
Packit Service |
1d8f1c |
static GVariant *ibus_config_service_service_get_property
|
|
Packit Service |
1d8f1c |
(IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *property_name,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
static gboolean ibus_config_service_service_set_property
|
|
Packit Service |
1d8f1c |
(IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *property_name,
|
|
Packit Service |
1d8f1c |
GVariant *value,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
static gboolean ibus_config_service_set_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GVariant *value,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
static GVariant *ibus_config_service_get_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
static GVariant *ibus_config_service_get_values (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
static gboolean ibus_config_service_unset_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GError **error);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_DEFINE_TYPE (IBusConfigService, ibus_config_service, IBUS_TYPE_SERVICE)
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static const gchar introspection_xml[] =
|
|
Packit Service |
1d8f1c |
"<node>"
|
|
Packit Service |
1d8f1c |
" <interface name='org.freedesktop.IBus.Config'>"
|
|
Packit Service |
1d8f1c |
" <method name='SetValue'>"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='section' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='name' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='v' name='value' />"
|
|
Packit Service |
1d8f1c |
" </method>"
|
|
Packit Service |
1d8f1c |
" <method name='GetValue'>"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='section' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='name' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='out' type='v' name='value' />"
|
|
Packit Service |
1d8f1c |
" </method>"
|
|
Packit Service |
1d8f1c |
" <method name='GetValues'>"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='section' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='out' type='a{sv}' name='values' />"
|
|
Packit Service |
1d8f1c |
" </method>"
|
|
Packit Service |
1d8f1c |
" <method name='UnsetValue'>"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='section' />"
|
|
Packit Service |
1d8f1c |
" <arg direction='in' type='s' name='name' />"
|
|
Packit Service |
1d8f1c |
" </method>"
|
|
Packit Service |
1d8f1c |
" <signal name='ValueChanged'>"
|
|
Packit Service |
1d8f1c |
" <arg type='s' name='section' />"
|
|
Packit Service |
1d8f1c |
" <arg type='s' name='name' />"
|
|
Packit Service |
1d8f1c |
" <arg type='v' name='value' />"
|
|
Packit Service |
1d8f1c |
" </signal>"
|
|
Packit Service |
1d8f1c |
" </interface>"
|
|
Packit Service |
1d8f1c |
"</node>";
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
ibus_config_service_class_init (IBusConfigServiceClass *class)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBUS_OBJECT_CLASS (gobject_class)->destroy = (IBusObjectDestroyFunc) ibus_config_service_destroy;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBUS_SERVICE_CLASS (class)->service_method_call = ibus_config_service_service_method_call;
|
|
Packit Service |
1d8f1c |
IBUS_SERVICE_CLASS (class)->service_get_property = ibus_config_service_service_get_property;
|
|
Packit Service |
1d8f1c |
IBUS_SERVICE_CLASS (class)->service_set_property = ibus_config_service_service_set_property;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
ibus_service_class_add_interfaces (IBUS_SERVICE_CLASS (class), introspection_xml);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
class->set_value = ibus_config_service_set_value;
|
|
Packit Service |
1d8f1c |
class->get_value = ibus_config_service_get_value;
|
|
Packit Service |
1d8f1c |
class->get_values = ibus_config_service_get_values;
|
|
Packit Service |
1d8f1c |
class->unset_value = ibus_config_service_unset_value;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
ibus_config_service_init (IBusConfigService *config)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
ibus_config_service_destroy (IBusConfigService *config)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
IBUS_OBJECT_CLASS(ibus_config_service_parent_class)->destroy ((IBusObject *) config);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static void
|
|
Packit Service |
1d8f1c |
ibus_config_service_service_method_call (IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *method_name,
|
|
Packit Service |
1d8f1c |
GVariant *parameters,
|
|
Packit Service |
1d8f1c |
GDBusMethodInvocation *invocation)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
IBusConfigService *config = IBUS_CONFIG_SERVICE (service);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (interface_name, IBUS_INTERFACE_CONFIG) != 0) {
|
|
Packit Service |
1d8f1c |
IBUS_SERVICE_CLASS (ibus_config_service_parent_class)->
|
|
Packit Service |
1d8f1c |
service_method_call (service,
|
|
Packit Service |
1d8f1c |
connection,
|
|
Packit Service |
1d8f1c |
sender,
|
|
Packit Service |
1d8f1c |
object_path,
|
|
Packit Service |
1d8f1c |
interface_name,
|
|
Packit Service |
1d8f1c |
method_name,
|
|
Packit Service |
1d8f1c |
parameters,
|
|
Packit Service |
1d8f1c |
invocation);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (method_name, "SetValue") == 0) {
|
|
Packit Service |
1d8f1c |
gchar *section;
|
|
Packit Service |
1d8f1c |
gchar *name;
|
|
Packit Service |
1d8f1c |
GVariant *value;
|
|
Packit Service |
1d8f1c |
gboolean retval;
|
|
Packit Service |
1d8f1c |
GError *error = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s&sv)", §ion, &name, &value);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
retval = IBUS_CONFIG_SERVICE_GET_CLASS (config)->set_value (config, section, name, value, &error);
|
|
Packit Service |
1d8f1c |
if (retval) {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
else {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit Service |
1d8f1c |
g_error_free (error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
g_variant_unref (value);
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (method_name, "GetValue") == 0) {
|
|
Packit Service |
1d8f1c |
gchar *section;
|
|
Packit Service |
1d8f1c |
gchar *name;
|
|
Packit Service |
1d8f1c |
GVariant *value;
|
|
Packit Service |
1d8f1c |
GError *error = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s&s)", §ion, &name);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
value = IBUS_CONFIG_SERVICE_GET_CLASS (config)->get_value (config, section, name, &error);
|
|
Packit Service |
1d8f1c |
if (value != NULL) {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(v)", value));
|
|
Packit Service |
1d8f1c |
g_variant_unref (value);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
else {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit Service |
1d8f1c |
g_error_free (error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (method_name, "GetValues") == 0) {
|
|
Packit Service |
1d8f1c |
gchar *section;
|
|
Packit Service |
1d8f1c |
GVariant *value;
|
|
Packit Service |
1d8f1c |
GError *error = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s)", §ion);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
value = IBUS_CONFIG_SERVICE_GET_CLASS (config)->get_values (config,
|
|
Packit Service |
1d8f1c |
section,
|
|
Packit Service |
1d8f1c |
&error);
|
|
Packit Service |
1d8f1c |
if (value) {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_value (invocation,
|
|
Packit Service |
1d8f1c |
g_variant_new ("(@a{sv})", value));
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
else {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit Service |
1d8f1c |
g_error_free (error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
if (g_strcmp0 (method_name, "UnsetValue") == 0) {
|
|
Packit Service |
1d8f1c |
gchar *section;
|
|
Packit Service |
1d8f1c |
gchar *name;
|
|
Packit Service |
1d8f1c |
gboolean retval;
|
|
Packit Service |
1d8f1c |
GError *error = NULL;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
g_variant_get (parameters, "(&s&s)", §ion, &name);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
retval = IBUS_CONFIG_SERVICE_GET_CLASS (config)->unset_value (config, section, name, &error);
|
|
Packit Service |
1d8f1c |
if (retval) {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
else {
|
|
Packit Service |
1d8f1c |
g_dbus_method_invocation_return_gerror (invocation, error);
|
|
Packit Service |
1d8f1c |
g_error_free (error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* should not be reached */
|
|
Packit Service |
1d8f1c |
g_return_if_reached ();
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static GVariant *
|
|
Packit Service |
1d8f1c |
ibus_config_service_service_get_property (IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *property_name,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
return IBUS_SERVICE_CLASS (ibus_config_service_parent_class)->
|
|
Packit Service |
1d8f1c |
service_get_property (service,
|
|
Packit Service |
1d8f1c |
connection,
|
|
Packit Service |
1d8f1c |
sender,
|
|
Packit Service |
1d8f1c |
object_path,
|
|
Packit Service |
1d8f1c |
interface_name,
|
|
Packit Service |
1d8f1c |
property_name,
|
|
Packit Service |
1d8f1c |
error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static gboolean
|
|
Packit Service |
1d8f1c |
ibus_config_service_service_set_property (IBusService *service,
|
|
Packit Service |
1d8f1c |
GDBusConnection *connection,
|
|
Packit Service |
1d8f1c |
const gchar *sender,
|
|
Packit Service |
1d8f1c |
const gchar *object_path,
|
|
Packit Service |
1d8f1c |
const gchar *interface_name,
|
|
Packit Service |
1d8f1c |
const gchar *property_name,
|
|
Packit Service |
1d8f1c |
GVariant *value,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
return IBUS_SERVICE_CLASS (ibus_config_service_parent_class)->
|
|
Packit Service |
1d8f1c |
service_set_property (service,
|
|
Packit Service |
1d8f1c |
connection,
|
|
Packit Service |
1d8f1c |
sender,
|
|
Packit Service |
1d8f1c |
object_path,
|
|
Packit Service |
1d8f1c |
interface_name,
|
|
Packit Service |
1d8f1c |
property_name,
|
|
Packit Service |
1d8f1c |
value,
|
|
Packit Service |
1d8f1c |
error);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static gboolean
|
|
Packit Service |
1d8f1c |
ibus_config_service_set_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GVariant *value,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
if (error) {
|
|
Packit Service |
1d8f1c |
gchar *str = g_variant_print (value, TRUE);
|
|
Packit Service |
1d8f1c |
*error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit Service |
1d8f1c |
"Cannot set value %s::%s to %s", section, name, str);
|
|
Packit Service |
1d8f1c |
g_free (str);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return FALSE;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static GVariant *
|
|
Packit Service |
1d8f1c |
ibus_config_service_get_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
if (error) {
|
|
Packit Service |
1d8f1c |
*error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit Service |
1d8f1c |
"Cannot get value %s::%s", section, name);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return NULL;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static GVariant *
|
|
Packit Service |
1d8f1c |
ibus_config_service_get_values (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
if (error) {
|
|
Packit Service |
1d8f1c |
*error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit Service |
1d8f1c |
"Cannot get values %s", section);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return NULL;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
static gboolean
|
|
Packit Service |
1d8f1c |
ibus_config_service_unset_value (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GError **error)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
if (error) {
|
|
Packit Service |
1d8f1c |
*error = g_error_new (G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
|
Packit Service |
1d8f1c |
"Cannot unset value %s::%s", section, name);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
return FALSE;
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
IBusConfigService *
|
|
Packit Service |
1d8f1c |
ibus_config_service_new (GDBusConnection *connection)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GObject *object = g_object_new (IBUS_TYPE_CONFIG_SERVICE,
|
|
Packit Service |
1d8f1c |
"object-path", IBUS_PATH_CONFIG,
|
|
Packit Service |
1d8f1c |
"connection", connection,
|
|
Packit Service |
1d8f1c |
NULL);
|
|
Packit Service |
1d8f1c |
return IBUS_CONFIG_SERVICE (object);
|
|
Packit Service |
1d8f1c |
}
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
void
|
|
Packit Service |
1d8f1c |
ibus_config_service_value_changed (IBusConfigService *config,
|
|
Packit Service |
1d8f1c |
const gchar *section,
|
|
Packit Service |
1d8f1c |
const gchar *name,
|
|
Packit Service |
1d8f1c |
GVariant *value)
|
|
Packit Service |
1d8f1c |
{
|
|
Packit Service |
1d8f1c |
g_return_if_fail (IBUS_IS_CONFIG_SERVICE (config));
|
|
Packit Service |
1d8f1c |
g_return_if_fail (section != NULL);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (name != NULL);
|
|
Packit Service |
1d8f1c |
g_return_if_fail (value != NULL);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
ibus_service_emit_signal ((IBusService *) config,
|
|
Packit Service |
1d8f1c |
NULL,
|
|
Packit Service |
1d8f1c |
IBUS_INTERFACE_CONFIG,
|
|
Packit Service |
1d8f1c |
"ValueChanged",
|
|
Packit Service |
1d8f1c |
g_variant_new ("(ssv)", section, name, value),
|
|
Packit Service |
1d8f1c |
NULL);
|
|
Packit Service |
1d8f1c |
}
|