IBusHotkeyProfile

## IBusHotkeyProfile IBusHotkeyProfile — Hotkeys and associated events. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IBusHotkeyProfile;
                        IBusHotkeyProfileClass;
    gboolean            ibus_hotkey_profile_add_hotkey      (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers,
                                                             GQuark event);
    gboolean            ibus_hotkey_profile_add_hotkey_from_string
                                                            (IBusHotkeyProfile *profile,
                                                             const gchar *str,
                                                             GQuark event);
    gboolean            ibus_hotkey_profile_remove_hotkey   (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers);
    gboolean            ibus_hotkey_profile_remove_hotkey_by_event
                                                            (IBusHotkeyProfile *profile,
                                                             GQuark event);
    GQuark              ibus_hotkey_profile_filter_key_event
                                                            (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers,
                                                             guint prev_keyval,
                                                             guint prev_modifiers,
                                                             gpointer user_data);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusSerializable
                         +----IBusHotkeyProfile

## Signals

      "trigger"                                        : Run Last / Has Details

## Description

An IBusHotkeyProfile associates a hotkey and an event.

## Details

### IBusHotkeyProfile

    typedef struct _IBusHotkeyProfile IBusHotkeyProfile;

An opaque data type representing an IBusHotkeyProfile.

### IBusHotkeyProfileClass

    typedef struct {
        IBusSerializableClass parent;

        void (* trigger) (IBusHotkeyProfile *profile,
                          GQuark             event,
                          gpointer           user_data);
    } IBusHotkeyProfileClass;

### ibus_hotkey_profile_add_hotkey ()

    gboolean            ibus_hotkey_profile_add_hotkey      (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers,
                                                             GQuark event);

Add a hotkey and its associated event to an IBusHotkeyProfile.

`profile` : | An IBusHotkeyProfile.
`keyval` : | Keycode of the hotkey.
`modifiers` : | Modifiers of the hotkey.
`event` : | The event to be associated.
Returns : | Always TRUE.

### ibus_hotkey_profile_add_hotkey_from_string ()

    gboolean            ibus_hotkey_profile_add_hotkey_from_string
                                                            (IBusHotkeyProfile *profile,
                                                             const gchar *str,
                                                             GQuark event);

Add a hotkey and its associated event to an IBusHotkeyProfile. The hotkey is in string format, such like `Control+Shift+A`.

`profile` : | An IBusHotkeyProfile.
`str` : | Key in string representation. '+' is the separator.
`event` : | The event to be associated.
Returns : | FALSE if `str` contains invalid symbol; TRUE otherwise.

### ibus_hotkey_profile_remove_hotkey ()

    gboolean            ibus_hotkey_profile_remove_hotkey   (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers);

Remove the hotkey for an IBusHotkeyProfile.

`profile` : | An IBusHotkeyProfile.
`keyval` : | Keycode of the hotkey.
`modifiers` : | Modifiers of the hotkey.
Returns : | FALSE if the key is not in `profile`, TRUE otherwise.

### ibus_hotkey_profile_remove_hotkey_by_event ()

    gboolean            ibus_hotkey_profile_remove_hotkey_by_event
                                                            (IBusHotkeyProfile *profile,
                                                             GQuark event);

Remove the hotkey for an IBusHotkeyProfile by event.

`profile` : | An IBusHotkeyProfile.
`event` : | The associated event.
Returns : | FALSE if no such event in `profile`, TRUE otherwise.

### ibus_hotkey_profile_filter_key_event ()

    GQuark              ibus_hotkey_profile_filter_key_event
                                                            (IBusHotkeyProfile *profile,
                                                             guint keyval,
                                                             guint modifiers,
                                                             guint prev_keyval,
                                                             guint prev_modifiers,
                                                             gpointer user_data);

Emit a `::trigger` signal when a hotkey is in a profile.

`see_also`: ::trigger

`profile` : | An IBusHotkeyProfile.
`keyval` : | Keycode of the hotkey.
`modifiers` : | Modifiers of the hotkey.
`prev_keyval` : | Keycode of the hotkey.
`prev_modifiers` : | Modifiers of the hotkey.
`user_data` : | user data for signal "trigger".
Returns : | 0 if releasing a hotkey and the hotkey is not in the profile ; an associated event otherwise.

## Signal Details

### The `"trigger"` signal

    void                user_function                      (IBusHotkeyProfile *profile,
                                                            guint              event,
                                                            gpointer           user_data,
                                                            gpointer           user_data)      : Run Last / Has Details

Emitted when a hotkey is pressed and the hotkey is in profile. Implement the member function `trigger()` in extended class to receive this signal.

### Note

The last parameter, user_data is not actually a valid parameter. It is displayed because of GtkDoc bug.

`profile` : | An IBusHotkeyProfile.
`event` : | An event in GQuark.
`user_data` : | User data for callback.
`user_data` : | user data set when the signal handler was connected.