IMSettingsClient

IMSettingsClient — convenient class for client to access imsettings-daemon.

Functions

Types and Values

Description

IMSettingsClient provides interface methods to imsettings-daemon to obtain a sort of informations for Input Method, operating something through imsettings-daemon to Input Method. This class is supposed to be the main entrance for all the client applications.

Either of functionalities in imsettings-daemon can be accessed through DBus instead of this class though, results of them needs to be sorted out to the appropriate types of values as needed.

Please see documentation of each methods for more details of DBus call.

Functions

imsettings_client_new ()

IMSettingsClient *
imsettings_client_new (const gchar *locale);

Creates an instance of IMSettingsClient.

Parameters

locale

a locale to obtain information for or to give it for Input Method. or NULL if you want to pass current locale.

 

Returns

a IMSettingsClient.


imsettings_client_set_locale ()

gboolean
imsettings_client_set_locale (IMSettingsClient *client,
                              const gchar *locale);

Update the locale information in client with locale .

Parameters

client

a IMSettingsClient.

 

locale

a locale to obtain information for or to give it for Input Method. or NULL if you want to pass current locale.

 

Returns

TRUE if successfully updated, otherwise FALSE.


imsettings_client_get_locale ()

const gchar *
imsettings_client_get_locale (IMSettingsClient *client);

Obtains current locale information in client .

Parameters

client

a IMSettingsClient.

 

Returns

a reference to the locale string in client . it shouldn't be freed in applications.


imsettings_client_ping ()

gboolean
imsettings_client_ping (IMSettingsClient *client);

Check whether the process is running.

Parameters

client

a IMSettingsClient.

 

Returns

TRUE if imsettings-daemon is running. otherwise FALSE.


imsettings_client_get_version ()

guint
imsettings_client_get_version (IMSettingsClient *client,
                               GCancellable *cancellable,
                               GError **error);

Obtains the version information of imsettings-daemon running. This is expected to invoke at first if the return value is same to IMSETTINGS_SETTINGS_API_VERSION. otherwise it may not works as expected due to the changes of the implementation between imsettings-daemon and client APIs.

You could access through DBus API instead:

1
2
3
4
5
<interface name='com.redhat.imsettings'>
  <method name='GetVersion'>
    <arg type='u' name='version' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a version number.


imsettings_client_get_info_variants ()

GVariant *
imsettings_client_get_info_variants (IMSettingsClient *client,
                                     GCancellable *cancellable,
                                     GError **error);

Obtains all of the Input Method information available on the system.

You could access through DBus API instead:

1
2
3
4
5
6
<interface name='com.redhat.imsettings'>
  <method name='GetInfoVariants'>
    <arg type='s' name='lang' direction='in' />
    <arg type='a{sv}' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a GVariant contains some pairs of an Input Method name and a GVariant that can converts to IMSettingsInfo through imsettings_info_new(). otherwise NULL.


imsettings_client_get_info_variant ()

GVariant *
imsettings_client_get_info_variant (IMSettingsClient *client,
                                    const gchar *module,
                                    GCancellable *cancellable,
                                    GError **error);

Obtains the information for the specific Input Method in module .

You could access through DBus API instead:

1
2
3
4
5
6
7
<interface name='com.redhat.imsettings'>
  <method name='GetInfoVariant'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='name' direction='in' />
    <arg type='a{sv}' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to obtain the information.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a GVariant that can converts to IMSettingsInfo through imsettings_info_new(). otherwise NULL.


imsettings_client_get_info_object ()

IMSettingsInfo *
imsettings_client_get_info_object (IMSettingsClient *client,
                                   const gchar *module,
                                   GCancellable *cancellable,
                                   GError **error);

A convenient function to get IMSettingsInfo from the result of imsettings_client_get_info_variant().

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to obtain the information.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a IMSettingsInfo or NULL.

[transfer full]


imsettings_client_get_user_im ()

gchar *
imsettings_client_get_user_im (IMSettingsClient *client,
                               GCancellable *cancellable,
                               GError **error);

Obtains an Input Method name that currently is active for the user. If one doesn't have the user xinputrc on their home, this simply returns the same value to what imsettings_client_get_system_im() returns.

You could access through DBus API instead:

1
2
3
4
5
6
7
8
<interface name='com.redhat.imsettings'>
  <method name='GetUserIM'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='ret' direction='out'>
      <annotation name='org.freedesktop.DBus.GLib.Const' value='' />
    </arg>
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

an Input Method name or NULL.


imsettings_client_get_system_im ()

gchar *
imsettings_client_get_system_im (IMSettingsClient *client,
                                 GCancellable *cancellable,
                                 GError **error);

Obtains an Input Method name that currently is active for the system-wide.

You could access through DBus API instead:

1
2
3
4
5
6
7
8
<interface name='com.redhat.imsettings'>
  <method name='GetSystemIM'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='ret' direction='out'>
      <annotation name='org.freedesktop.DBus.GLib.Const' value='' />
    </arg>
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

an Input Method name or NULL.


imsettings_client_get_active_im_info ()

IMSettingsInfo *
imsettings_client_get_active_im_info (IMSettingsClient *client,
                                      GCancellable *cancellable,
                                      GError **error);

Obtains the Input Method information that is currently running on.

You could access through DBus API instead:

1
2
3
4
5
<interface name='com.redhat.imsettings'>
  <method name='GetActiveVariant'>
    <arg type='a{sv}' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a IMSettingsInfo for active Input Method. if not, NULL then.

[transfer full]


imsettings_client_im_is_system_default ()

gboolean
imsettings_client_im_is_system_default
                               (IMSettingsClient *client,
                                const gchar *module,
                                GCancellable *cancellable,
                                GError **error);

Checks whether module is the system default or not.

You could access through DBus API instead:

1
2
3
4
5
6
7
<interface name='com.redhat.imsettings'>
  <method name='IsSystemDefault'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='imname' direction='in' />
    <arg type='b' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to ask.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

TRUE if it is, otherwise FALSE.


imsettings_client_im_is_user_default ()

gboolean
imsettings_client_im_is_user_default (IMSettingsClient *client,
                                      const gchar *module,
                                      GCancellable *cancellable,
                                      GError **error);

Checks whether module is the user default or not.

You could access through DBus API instead:

1
2
3
4
5
6
7
<interface name='com.redhat.imsettings'>
  <method name='IsUserDefault'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='imname' direction='in' />
    <arg type='b' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to ask.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

TRUE if it is, otherwise FALSE.


imsettings_client_im_is_xim ()

gboolean
imsettings_client_im_is_xim (IMSettingsClient *client,
                             const gchar *module,
                             GCancellable *cancellable,
                             GError **error);

Checks whether module is the Input Method for XIM only or not.

You could access through DBus API instead:

1
2
3
4
5
6
7
<interface name='com.redhat.imsettings'>
  <method name='IsXIM'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='imname' direction='in' />
    <arg type='b' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to ask.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

TRUE if it is, otherwise FALSE.


imsettings_client_switch_im ()

gboolean
imsettings_client_switch_im (IMSettingsClient *client,
                             const gchar *module,
                             gboolean update_xinputrc,
                             GCancellable *cancellable,
                             GError **error);

Changes the Input Method to module .

You could access through DBus API instead:

1
2
3
4
5
6
7
8
<interface name='com.redhat.imsettings'>
  <method name='SwitchIM'>
    <arg type='s' name='lang' direction='in' />
    <arg type='s' name='module' direction='in' />
    <arg type='b' name='update_xinputrc' direction='in' />
    <arg type='b' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

module

an Input Method name changing to, or NULL to disable the Input Method.

 

update_xinputrc

TRUE to update the user xinputrc, otherwise FALSE.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

if the operation is successfully done, returns TRUE otherwise FALSE.


imsettings_client_reload ()

gboolean
imsettings_client_reload (IMSettingsClient *client,
                          gboolean send_signal,
                          GCancellable *cancellable,
                          GError **error);

Reloads imsettings-daemon.

Note that send_signal option is for the backward compatibility. imsettings-daemon doesn't do anything since IMSETTINGS_SETTINGS_API_VERSION is 4. so you will get the expected behavior with:

1
2
3
4
5
int api_version;

if ((api_version = imsettings_client_get_version(client)) != IMSETTINGS_SETTINGS_API_VERSION) {
    imsettings_client_reload(client, api_version < 4, NULL, &error);
}

You could access through DBus API instead:

1
2
3
4
5
6
7
8
<interface name='com.redhat.imsettings'>
  <signal name='Reload'>
    <arg type='b' name='ret' direction='out' />
  </signal>
  <method name='StopService'>
    <arg type='b' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

send_signal

TRUE to send a signal instead of invoking a method.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

TRUE if the operation is successfully done, otherwise FALSE.


imsettings_client_get_module_settings ()

GVariant *
imsettings_client_get_module_settings (IMSettingsClient *client,
                                       GCancellable *cancellable,
                                       GError **error);

Obtains current Input Method settings in the backend modules.

You could access through DBus API instead:

1
2
3
4
5
<interface name='com.redhat.imsettings'>
  <method name='DumpModuleSettings'>
    <arg type='a{ss}' name='ret' direction='out' />
  </method>
</interface>

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

error

a GError to store an error, or NULL.

[allow-none]

Returns

a GVariant that contains some pairs of the module name and the Input Method name.


imsettings_client_get_info_variants_start ()

void
imsettings_client_get_info_variants_start
                               (IMSettingsClient *client,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Request obtaining asynchronously all of the Input Method information available on the system.

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback.

[scope async]

user_data

a pointer of the user data to give it to callback .

[closure]

imsettings_client_get_info_variants_finish ()

gpointer
imsettings_client_get_info_variants_finish
                               (IMSettingsClient *client,
                                GAsyncResult *result,
                                GError **error);

Obtains the result of the request from imsettings_client_get_info_variants_start().

Parameters

client

a IMSettingsClient.

 

result

a GAsyncResult pushed through GAsyncReadyCallback.

 

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a GVariant contains some pairs of an Input Method name and a GVariant that can converts to IMSettingsInfo through imsettings_info_new(). otherwise NULL.

[out][transfer full][allow-none]


imsettings_client_get_info_variant_start ()

void
imsettings_client_get_info_variant_start
                               (IMSettingsClient *client,
                                const gchar *module,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Request obtaining asynchronously the Input Method information for module .

Parameters

client

a IMSettingsClient.

 

module

an Input Method name to obtain the information.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback.

[scope async]

user_data

a pointer of the user data to give it to callback .

[closure]

imsettings_client_get_info_variant_finish ()

GVariant *
imsettings_client_get_info_variant_finish
                               (IMSettingsClient *client,
                                GAsyncResult *result,
                                GError **error);

Obtains the result of the request from imsettings_client_get_info_variant_start().

Parameters

client

a IMSettingsClient.

 

result

a GAsyncResult pushed through GAsyncReadyCallback.

 

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

a GVariant that can converts to IMSettingsInfo through imsettings_info_new(). otherwise NULL.


imsettings_client_get_user_im_start ()

void
imsettings_client_get_user_im_start (IMSettingsClient *client,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);

Request obtaining asynchronously an input method name that currently is active for the user.

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback.

[scope async]

user_data

a pointer of the user data to give it to callback .

[closure]

imsettings_client_get_user_im_finish ()

gchar *
imsettings_client_get_user_im_finish (IMSettingsClient *client,
                                      GAsyncResult *result,
                                      GError **error);

Obtains the result of the request from imsettings_client_get_user_im_start().

Parameters

client

a IMSettingsClient.

 

result

a GAsyncResult pushed through GAsyncReadyCallback.

 

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

an Input Method name or NULL.


imsettings_client_get_system_im_start ()

void
imsettings_client_get_system_im_start (IMSettingsClient *client,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Request obtaining asynchronously an input method name that currently is active for the system-wide.

Parameters

client

a IMSettingsClient.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback.

[scope async]

user_data

a pointer of the user data to give it to callback .

[closure]

imsettings_client_get_system_im_finish ()

gchar *
imsettings_client_get_system_im_finish
                               (IMSettingsClient *client,
                                GAsyncResult *result,
                                GError **error);

Obtains the result of the request from imsettings_client_get_system_im_start().

Parameters

client

a IMSettingsClient.

 

result

a GAsyncResult pushed through GAsyncReadyCallback.

 

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

an Input Method name or NULL.


imsettings_client_switch_im_start ()

void
imsettings_client_switch_im_start (IMSettingsClient *client,
                                   const gchar *module,
                                   gboolean update_xinputrc,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);

Request changing asynchronously the Input Method to module .

Parameters

client

a IMSettingsClient.

 

module

an Input Method name changing to, or NULL to disable the Input Method.

 

update_xinputrc

TRUE to update the user xinputrc, otherwise FALSE.

 

cancellable

a GCancellable or NULL.

[allow-none]

callback

a GAsyncReadyCallback.

[scope async]

user_data

a pointer of the user data to give it to callback .

[closure]

imsettings_client_switch_im_finish ()

gboolean
imsettings_client_switch_im_finish (IMSettingsClient *client,
                                    GAsyncResult *result,
                                    GError **error);

Obtains the result of the request from imsettings_client_switch_im_start().

Parameters

client

a IMSettingsClient.

 

result

a GAsyncResult pushed through GAsyncReadyCallback.

 

error

a GError to store an error if any, or NULL.

[allow-none]

Returns

if the operation is successfully done, returns TRUE otherwise FALSE.

Types and Values

struct IMSettingsClientClass

struct IMSettingsClientClass {
	GObjectClass parent_class;

	void (*reserved1) (void);
	void (*reserved2) (void);
	void (*reserved3) (void);
	void (*reserved4) (void);
};

Members

reserved1 ()

   

reserved2 ()

   

reserved3 ()

   

reserved4 ()