## Helper

Helper — A list of helper functions

## Synopsis

    #include <ogmrip-source-chooser.h>

    #define             GTK_BOX_CHILD                       (b)
    gchar *             g_get_locale                        (gint category);
    gulong              g_signal_connect_data_while_alive   (gpointer instance,
                                                             const gchar *detailed_signal,
                                                             GCallback c_handler,
                                                             gpointer alive,
                                                             GClosureNotify destroy_data,
                                                             GConnectFlags connect_flags);
    #define             g_signal_connect_while_alive        (instance,
                                                             detailed_signal,
                                                             c_handler,
                                                             alive)
    #define             g_signal_connect_swapped_while_alive(instance,
                                                             detailed_signal,
                                                             c_handler,
                                                             alive)
    void                gtk_window_set_parent               (GtkWindow *window,
                                                             GtkWindow *parent);
    void                gtk_window_set_icon_from_stock      (GtkWindow *window,
                                                             const gchar *stock_id);
    void                gtk_dialog_response_accept          (GtkDialog *dialog);
    void                gtk_dialog_set_response_visible     (GtkDialog *dialog,
                                                             gint response_id,
                                                             gboolean setting);
    gint                gtk_radio_button_get_active         (GtkRadioButton *radio);
    void                gtk_radio_button_set_active         (GtkRadioButton *radio,
                                                             guint index);
    gboolean            gtk_tree_model_iter_prev            (GtkTreeModel *tree_model,
                                                             GtkTreeIter *iter);
    void                gtk_label_set_int                   (GtkLabel *label,
                                                             gint value);
    gint                gtk_label_get_int                   (GtkLabel *label);
    GtkWidget *         gtk_box_get_nth_child               (GtkBox *box,
                                                             gint n);
    const gchar *       ogmrip_get_system_profiles_dir      (void);
    const gchar *       ogmrip_get_user_profiles_dir        (void);
    void                ogmrip_combo_box_containers_construct
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_add_containers     (GtkComboBox *combo);
    GType               ogmrip_combo_box_get_active_container
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_set_active_container
                                                            (GtkComboBox *combo,
                                                             const gchar *container);
    void                ogmrip_combo_box_video_codecs_construct
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_add_video_codecs   (GtkComboBox *combo,
                                                             GType container);
    GType               ogmrip_combo_box_get_active_video_codec
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_set_active_video_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);
    void                ogmrip_combo_box_audio_codecs_construct
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_add_audio_codecs   (GtkComboBox *combo,
                                                             GType container);
    GType               ogmrip_combo_box_get_active_audio_codec
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_set_active_audio_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);
    void                ogmrip_combo_box_subp_codecs_construct
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_add_subp_codecs    (GtkComboBox *combo,
                                                             GType container);
    GType               ogmrip_combo_box_get_active_subp_codec
                                                            (GtkComboBox *combo);
    void                ogmrip_combo_box_set_active_subp_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);
    void                ogmrip_combo_box_languages_construct
                                                            (GtkComboBox *combo,
                                                             const gchar *default_text);
    GtkWidget *         ogmrip_message_dialog_new           (GtkWindow *parent,
                                                             GtkMessageType type,
                                                             const gchar *format,
                                                             ...);
    gint                ogmrip_message_dialog               (GtkWindow *parent,
                                                             GtkMessageType type,
                                                             const gchar *format,
                                                             ...);
    GtkWidget *         ogmrip_load_dvd_dialog_new          (GtkWindow *parent,
                                                             OGMDvdDisc *disc,
                                                             const gchar *name,
                                                             gboolean cancellable);

## Description

## Details

### GTK_BOX_CHILD()

    #define GTK_BOX_CHILD(b) ((GtkBoxChild *) (b))

### g_get_locale ()

    gchar *             g_get_locale                        (gint category);

Returns the active source and its type.

`category` : | A pointer to store the type of the chooser
Returns : | The active OGMRipSource

### g_signal_connect_data_while_alive ()

    gulong              g_signal_connect_data_while_alive   (gpointer instance,
                                                             const gchar *detailed_signal,
                                                             GCallback c_handler,
                                                             gpointer alive,
                                                             GClosureNotify destroy_data,
                                                             GConnectFlags connect_flags);

Connects a GCallback function to a signal for a particular object automatically disconnecting it when `alive` is destroyed.

`instance` : | the instance to connect to
`detailed_signal` : | a string of the form "signal-name::detail"
`c_handler` : | the GCallback to connect
`alive` : | the instance to check for
`destroy_data` : | a GClosureNotify for data
`connect_flags` : | a combination of GConnectFlags
Returns : | the handler id

### g_signal_connect_while_alive()

    #define             g_signal_connect_while_alive(instance, detailed_signal, c_handler, alive)

Connects a GCallback function to a signal for a particular object automatically disconnecting it when `alive` is destroyed.

`instance` : | the instance to connect to
`detailed_signal` : | a string of the form "signal-name::detail"
`c_handler` : | the GCallback to connect
`alive` : | the instance to check for
Returns : | the handler id

### g_signal_connect_swapped_while_alive()

    #define             g_signal_connect_swapped_while_alive(instance, detailed_signal, c_handler, alive)

Connects a GCallback function to a signal for a particular object automatically disconnecting it when `alive` is destroyed.

`instance` : | the instance to connect to
`detailed_signal` : | a string of the form "signal-name::detail"
`c_handler` : | the GCallback to connect
`alive` : | the instance to check for
Returns : | the handler id

### gtk_window_set_parent ()

    void                gtk_window_set_parent               (GtkWindow *window,
                                                             GtkWindow *parent);

Sets a parent window for a window. This is equivalent to calling `gtk_window_set_transient_for()`, `gtk_window_set_position()`, `gtk_window_set_gravity()`, and `gtk_window_set_destroy_with_parent()` on `window`.

`window` : | A GtkWindow
`parent` : | The parent window

### gtk_window_set_icon_from_stock ()

    void                gtk_window_set_icon_from_stock      (GtkWindow *window,
                                                             const gchar *stock_id);

Sets the icon of `window` from a stock item.

`window` : | A GtkWindow
`stock_id` : | the name of the stock item

### gtk_dialog_response_accept ()

    void                gtk_dialog_response_accept          (GtkDialog *dialog);

Emits the "response" signal with GTK_RESPONSE_ACCEPT.

`dialog` : | a GtkDialog

### gtk_dialog_set_response_visible ()

    void                gtk_dialog_set_response_visible     (GtkDialog *dialog,
                                                             gint response_id,
                                                             gboolean setting);

Sets the <literal>visible</literal> property of each widget in the dialog's action area with the given `response_id`. A convenient way to show/hide dialog buttons.

`dialog` : | a GtkDialog
`response_id` : | a response ID
`setting` : | `TRUE` for visible

### gtk_radio_button_get_active ()

    gint                gtk_radio_button_get_active         (GtkRadioButton *radio);

Returns the index of the active GtkRadioButton.

`radio` : | Any GtkRadioButton of the group
Returns : | An integer, or -1

### gtk_radio_button_set_active ()

    void                gtk_radio_button_set_active         (GtkRadioButton *radio,
                                                             guint index);

Sets the active item of the radio group.

`radio` : | Any GtkRadioButton of the group
`index` : | The index of the active item

### gtk_tree_model_iter_prev ()

    gboolean            gtk_tree_model_iter_prev            (GtkTreeModel *tree_model,
                                                             GtkTreeIter *iter);

Sets `iter` to point to the node preceding it at the current level. If there is no previous `iter`, `FALSE` is returned and `iter` is set to be invalid.

`tree_model` : | A GtkTreeModel
`iter` : | The GtkTreeIter
Returns : | `TRUE`, if `iter` has been changed to the previous node

### gtk_label_set_int ()

    void                gtk_label_set_int                   (GtkLabel *label,
                                                             gint value);

Sets the value of a GtkLabel widget.

`label` : | A GtkLabel
`value` : | An integer

### gtk_label_get_int ()

    gint                gtk_label_get_int                   (GtkLabel *label);

Gets the value of the `label` represented as an integer.

`label` : | A GtkLabel
Returns : | The value of the `label` widget

### gtk_box_get_nth_child ()

    GtkWidget *         gtk_box_get_nth_child               (GtkBox *box,
                                                             gint n);

Returns the `n`'th item in `box`.

`box` : | A GtkBox
`n` : | The index of the desired child
Returns : | The nth GtkWidget, or NULL

### ogmrip_get_system_profiles_dir ()

    const gchar *       ogmrip_get_system_profiles_dir      (void);

Return the system directory containing profiles.

Returns : | a directory, or NULL

### ogmrip_get_user_profiles_dir ()

    const gchar *       ogmrip_get_user_profiles_dir        (void);

Return the user directory containing profiles.

Returns : | a directory, or NULL

### ogmrip_combo_box_containers_construct ()

    void                ogmrip_combo_box_containers_construct
                                                            (GtkComboBox *combo);

Configures a `combo` to store containers.

`combo` : | A GtkComboBox

### ogmrip_combo_box_add_containers ()

    void                ogmrip_combo_box_add_containers     (GtkComboBox *combo);

Populates `combo` with all known containers.

`combo` : | A GtkComboBox

### ogmrip_combo_box_get_active_container ()

    GType               ogmrip_combo_box_get_active_container
                                                            (GtkComboBox *combo);

Returns the selected container.

`combo` : | A GtkComboBox
Returns : | a container type, or G_TYPE_NONE

### ogmrip_combo_box_set_active_container ()

    void                ogmrip_combo_box_set_active_container
                                                            (GtkComboBox *combo,
                                                             const gchar *container);

Selects the container with the given `name`.

`combo` : | A GtkComboBox
`container` : | The name of the container

### ogmrip_combo_box_video_codecs_construct ()

    void                ogmrip_combo_box_video_codecs_construct
                                                            (GtkComboBox *combo);

Configures a `combo` to store video codecs.

`combo` : | A GtkComboBox

### ogmrip_combo_box_add_video_codecs ()

    void                ogmrip_combo_box_add_video_codecs   (GtkComboBox *combo,
                                                             GType container);

Populates `combo` with all video codecs compatible with `container`.

`combo` : | A GtkComboBox
`container` : | A container

### ogmrip_combo_box_get_active_video_codec ()

    GType               ogmrip_combo_box_get_active_video_codec
                                                            (GtkComboBox *combo);

Returns the selected video codec.

`combo` : | A GtkComboBox
Returns : | a video type, or G_TYPE_NONE

### ogmrip_combo_box_set_active_video_codec ()

    void                ogmrip_combo_box_set_active_video_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);

Selects the video codec with the given `name`.

`combo` : | A GtkComboBox
`codec` : | The name of the video codec

### ogmrip_combo_box_audio_codecs_construct ()

    void                ogmrip_combo_box_audio_codecs_construct
                                                            (GtkComboBox *combo);

Configures a `combo` to store audio codecs.

`combo` : | A GtkComboBox

### ogmrip_combo_box_add_audio_codecs ()

    void                ogmrip_combo_box_add_audio_codecs   (GtkComboBox *combo,
                                                             GType container);

Populates `combo` with all audio codecs compatible with `container`.

`combo` : | A GtkComboBox
`container` : | A container

### ogmrip_combo_box_get_active_audio_codec ()

    GType               ogmrip_combo_box_get_active_audio_codec
                                                            (GtkComboBox *combo);

Returns the selected audio codec.

`combo` : | A GtkComboBox
Returns : | an audio type, or G_TYPE_NONE

### ogmrip_combo_box_set_active_audio_codec ()

    void                ogmrip_combo_box_set_active_audio_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);

Selects the audio codec with the given `name`.

`combo` : | A GtkComboBox
`codec` : | The name of the audio codec

### ogmrip_combo_box_subp_codecs_construct ()

    void                ogmrip_combo_box_subp_codecs_construct
                                                            (GtkComboBox *combo);

Configures a `combo` to store subp codecs.

`combo` : | A GtkComboBox

### ogmrip_combo_box_add_subp_codecs ()

    void                ogmrip_combo_box_add_subp_codecs    (GtkComboBox *combo,
                                                             GType container);

Populates `combo` with all subp codecs compatible with `container`.

`combo` : | A GtkComboBox
`container` : | A container

### ogmrip_combo_box_get_active_subp_codec ()

    GType               ogmrip_combo_box_get_active_subp_codec
                                                            (GtkComboBox *combo);

Returns the selected subp codec.

`combo` : | A GtkComboBox
Returns : | a subp type, or G_TYPE_NONE

### ogmrip_combo_box_set_active_subp_codec ()

    void                ogmrip_combo_box_set_active_subp_codec
                                                            (GtkComboBox *combo,
                                                             const gchar *codec);

Selects the subp codec with the given `name`.

`combo` : | A GtkComboBox
`codec` : | The name of the subp codec

### ogmrip_combo_box_languages_construct ()

    void                ogmrip_combo_box_languages_construct
                                                            (GtkComboBox *combo,
                                                             const gchar *default_text);

Configures a `combo` to store languages.

`combo` : | a GtkComboBox
`default_text` : | the default text

### ogmrip_message_dialog_new ()

    GtkWidget *         ogmrip_message_dialog_new           (GtkWindow *parent,
                                                             GtkMessageType type,
                                                             const gchar *format,
                                                             ...);

Creates a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc.) and some text the user may want to see.

`parent` : | A GtkWindow
`type` : | A GtkMessageType
`format` : | printf()-style format string, or NULL
`...` : | Arguments for `format`
Returns : | A new GtkMessageDialog

### ogmrip_message_dialog ()

    gint                ogmrip_message_dialog               (GtkWindow *parent,
                                                             GtkMessageType type,
                                                             const gchar *format,
                                                             ...);

Creates and displays a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc.) and some text the user may want to see.

`parent` : | A GtkWindow
`type` : | A GtkMessageType
`format` : | printf()-style format string, or NULL
`...` : | Arguments for `format`
Returns : | The response ID

### ogmrip_load_dvd_dialog_new ()

    GtkWidget *         ogmrip_load_dvd_dialog_new          (GtkWindow *parent,
                                                             OGMDvdDisc *disc,
                                                             const gchar *name,
                                                             gboolean cancellable);

Creates a dialog waiting for the given DVD to be inserted.

`parent` : | Transient parent of the dialog, or NULL
`disc` : | An OGMDvdDisc
`name` : | The name of the DVD
`cancellable` : | Whether the dialog is cancellable
Returns : | a newly created dialog