ibusshare

## ibusshare ibusshare — Shared utility functions and definition. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #define             IBUS_SERVICE_IBUS
    #define             IBUS_SERVICE_PANEL
    #define             IBUS_SERVICE_CONFIG
    #define             IBUS_SERVICE_NOTIFICATIONS
    #define             IBUS_PATH_IBUS
    #define             IBUS_PATH_FACTORY
    #define             IBUS_PATH_PANEL
    #define             IBUS_PATH_CONFIG
    #define             IBUS_PATH_NOTIFICATIONS
    #define             IBUS_PATH_INPUT_CONTEXT
    #define             IBUS_INTERFACE_IBUS
    #define             IBUS_INTERFACE_INPUT_CONTEXT
    #define             IBUS_INTERFACE_FACTORY
    #define             IBUS_INTERFACE_ENGINE
    #define             IBUS_INTERFACE_PANEL
    #define             IBUS_INTERFACE_CONFIG
    #define             IBUS_INTERFACE_NOTIFICATIONS
    const gchar *       ibus_get_local_machine_id           (void);
    void                ibus_set_display                    (const gchar *display);
    const gchar *       ibus_get_address                    (void);
    void                ibus_write_address                  (const gchar *address);
    const gchar *       ibus_get_user_name                  (void);
    glong               ibus_get_daemon_uid                 (void);
    const gchar *       ibus_get_socket_path                (void);
    const gchar *       ibus_keyval_name                    (guint keyval);
    guint               ibus_keyval_from_name               (const gchar *keyval_name);
    void                ibus_free_strv                      (gchar **strv);
    const gchar *       ibus_key_event_to_string            (guint keyval,
                                                             guint modifiers);
    gboolean            ibus_key_event_from_string          (const gchar *string,
                                                             guint *keyval,
                                                             guint *modifiers);
    void                ibus_init                           (void);
    void                ibus_main                           (void);
    void                ibus_quit                           (void);

## Description

This file defines some utility functions and definition which are shared among ibus component and services.

## Details

### IBUS_SERVICE_IBUS

    #define IBUS_SERVICE_IBUS       "org.freedesktop.IBus"

Address of IBus service.

### IBUS_SERVICE_PANEL

    #define IBUS_SERVICE_PANEL      "org.freedesktop.IBus.Panel"

Address of IBus panel service.

### IBUS_SERVICE_CONFIG

    #define IBUS_SERVICE_CONFIG     "org.freedesktop.IBus.Config"

Address of IBus config service.

### IBUS_SERVICE_NOTIFICATIONS

    #define IBUS_SERVICE_NOTIFICATIONS    "org.freedesktop.IBus.Notifications"

Address of IBus notification service.

### IBUS_PATH_IBUS

    #define IBUS_PATH_IBUS          "/org/freedesktop/IBus"

D-Bus path for IBus

### IBUS_PATH_FACTORY

    #define IBUS_PATH_FACTORY       "/org/freedesktop/IBus/Factory"

D-Bus path for IBus factory.

### IBUS_PATH_PANEL

    #define IBUS_PATH_PANEL         "/org/freedesktop/IBus/Panel"

D-Bus path for IBus panel.

### IBUS_PATH_CONFIG

    #define IBUS_PATH_CONFIG        "/org/freedesktop/IBus/Config"

D-Bus path for IBus config.

### IBUS_PATH_NOTIFICATIONS

    #define IBUS_PATH_NOTIFICATIONS "/org/freedesktop/IBus/Notifications"

D-Bus path for IBus notifications.

### IBUS_PATH_INPUT_CONTEXT

    #define IBUS_PATH_INPUT_CONTEXT "/org/freedesktop/IBus/InputContext_%d"

Template of D-Bus path for IBus input context.

### IBUS_INTERFACE_IBUS

    #define IBUS_INTERFACE_IBUS     "org.freedesktop.IBus"

D-Bus interface for IBus.

### IBUS_INTERFACE_INPUT_CONTEXT

    #define             IBUS_INTERFACE_INPUT_CONTEXT

D-Bus interface for IBus input context.

### IBUS_INTERFACE_FACTORY

    #define IBUS_INTERFACE_FACTORY  "org.freedesktop.IBus.Factory"

D-Bus interface for IBus factory.

### IBUS_INTERFACE_ENGINE

    #define IBUS_INTERFACE_ENGINE   "org.freedesktop.IBus.Engine"

D-Bus interface for IBus engine.

### IBUS_INTERFACE_PANEL

    #define IBUS_INTERFACE_PANEL    "org.freedesktop.IBus.Panel"

D-Bus interface for IBus panel.

### IBUS_INTERFACE_CONFIG

    #define IBUS_INTERFACE_CONFIG   "org.freedesktop.IBus.Config"

D-Bus interface for IBus config.

### IBUS_INTERFACE_NOTIFICATIONS

    #define IBUS_INTERFACE_NOTIFICATIONS    "org.freedesktop.IBus.Notifications"

D-Bus interface for IBus notifications.

### ibus_get_local_machine_id ()

    const gchar *       ibus_get_local_machine_id           (void);

Obtains the machine UUID of the machine this process is running on.

Returns : | A newly allocated string that shows the UUID of the machine.

### ibus_set_display ()

    void                ibus_set_display                    (const gchar *display);

Set the display address.

`display` : | Display address, as in DISPLAY environment for X.

### ibus_get_address ()

    const gchar *       ibus_get_address                    (void);

Return the D-Bus address of IBus. It will find the address from following source:

1. Environment variable IBUS_ADDRESS

2. Socket file under ~/.config/ibus/bus/

`see_also`: `ibus_write_address()`.

Returns : | D-Bus address of IBus. `NULL` for not found.

### ibus_write_address ()

    void                ibus_write_address                  (const gchar *address);

Write D-Bus address to socket file.

`see_also`: `ibus_get_address()`.

`address` : | D-Bus address of IBus.

### ibus_get_user_name ()

    const gchar *       ibus_get_user_name                  (void);

Get the current user name. It is determined by:

1. `getlogin()`

2. Environment variable SUDO_USER

3. Environment variable USERHELPER_UID

4. Environment variable USERNAME

5. Environment variable LOGNAME

6. Environment variable USER

7. Environment variable LNAME

Returns : | A newly allocated string that stores current user name.

### ibus_get_daemon_uid ()

    glong               ibus_get_daemon_uid                 (void);

### Warning

`ibus_get_daemon_uid` is deprecated and should not be used in newly-written code. This function has been deprecated and should not be used in newly written code.

Get UID of ibus-daemon.

Returns : | UID of ibus-daemon; or 0 if UID is not available.

### ibus_get_socket_path ()

    const gchar *       ibus_get_socket_path                (void);

Get the path of socket file.

Returns : | A newly allocated string that stores the path of socket file.

### ibus_keyval_name ()

    const gchar *       ibus_keyval_name                    (guint keyval);

Return the name of a key symbol.

Note that the returned string is used internally, so don't free it.

`keyval` : | Key symbol.
Returns : | Corresponding key name. `NULL` if no such key symbol.

### ibus_keyval_from_name ()

    guint               ibus_keyval_from_name               (const gchar *keyval_name);

Return the key symbol that associate with the key name.

`keyval_name` : | Key name in gdk_keys_by_name.
Returns : | Corresponding key symbol.

### ibus_free_strv ()

    void                ibus_free_strv                      (gchar **strv);

### Warning

`ibus_free_strv` is deprecated and should not be used in newly-written code. This function has been deprecated and should not be used in newly written code.

Free a list of strings.

`strv` : | List of strings.

### ibus_key_event_to_string ()

    const gchar *       ibus_key_event_to_string            (guint keyval,
                                                             guint modifiers);

Return the name of a key symbol and modifiers.

For example, if press ctrl, shift, and enter, then this function returns: Shift+Control+enter.

`keyval` : | Key symbol.
`modifiers` : | Modifiers such as Ctrl or Shift.
Returns : | The name of a key symbol and modifier.

### ibus_key_event_from_string ()

    gboolean            ibus_key_event_from_string          (const gchar *string,
                                                             guint *keyval,
                                                             guint *modifiers);

Parse key event string and return key symbol and modifiers.

`string` : | Key event string.
`keyval` : | Variable that hold key symbol result.
`modifiers` : | Variable that hold modifiers result.
Returns : | TRUE for succeed; FALSE if failed.

### ibus_init ()

    void                ibus_init                           (void);

Init the ibus types.

It is actually a wrapper of `g_type_init()`.

### ibus_main ()

    void                ibus_main                           (void);

Runs an IBus main loop until `ibus_quit()` is called in the loop.

`see_also`: `ibus_quit()`.

### ibus_quit ()

    void                ibus_quit                           (void);

Stops an IBus from running.

Any calls to `ibus_quit()` for the loop will return. `see_also`: `ibus_main()`.