## GdictSourceChooser GdictSourceChooser — Display the list of available sources |

## Synopsis

    struct              GdictSourceChooser;
    struct              GdictSourceChooserClass;
    GtkWidget *         gdict_source_chooser_new            (void);
    GtkWidget *         gdict_source_chooser_new_with_loader
                                                            (GdictSourceLoader *loader);
    GdictSourceLoader * gdict_source_chooser_get_loader     (GdictSourceChooser *chooser);
    void                gdict_source_chooser_set_loader     (GdictSourceChooser *chooser,
                                                             GdictSourceLoader *loader);
    gchar **            gdict_source_chooser_get_sources    (GdictSourceChooser *chooser,
                                                             gsize *length);
    gint                gdict_source_chooser_count_sources  (GdictSourceChooser *chooser);
    gboolean            gdict_source_chooser_has_source     (GdictSourceChooser *chooser,
                                                             const gchar *source_name);
    void                gdict_source_chooser_refresh        (GdictSourceChooser *chooser);
    gboolean            gdict_source_chooser_select_source  (GdictSourceChooser *chooser,
                                                             const gchar *source_name);
    gboolean            gdict_source_chooser_unselect_source
                                                            (GdictSourceChooser *chooser,
                                                             const gchar *source_name);
    gchar *             gdict_source_chooser_get_current_source
                                                            (GdictSourceChooser *chooser);
    gboolean            gdict_source_chooser_set_current_source
                                                            (GdictSourceChooser *chooser,
                                                             const gchar *source_name);
    GtkWidget *         gdict_source_chooser_add_button     (GdictSourceChooser *chooser,
                                                             const gchar *button_text);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBox
                               +----GtkVBox
                                     +----GdictSourceChooser

## Implemented Interfaces

GdictSourceChooser implements AtkImplementorIface, GtkBuildable and GtkOrientable.

## Properties

      "count"                    gint                  : Read
      "loader"                   GdictSourceLoader*    : Read / Write / Construct

## Signals

      "selection-changed"                              : Run Last
      "source-activated"                               : Run Last

## Description

GdictSourceChooser is a widget that shows the list of available dictionary sources using a GdictSourceLoader instance as a model. It can be used to allow choosing the current dictionary source.

GdictSourceChooser is available since Gdict 0.12.

## Details

### struct GdictSourceChooser

    struct GdictSourceChooser;

### struct GdictSourceChooserClass

    struct GdictSourceChooserClass {
      void (*source_activated)  (GdictSourceChooser *chooser,
                                 const gchar        *source_name,
                                 GdictSource        *source);
      void (*selection_changed) (GdictSourceChooser *chooser);
    };

### gdict_source_chooser_new ()

    GtkWidget *         gdict_source_chooser_new            (void);

Creates a new GdictSourceChooser widget. This widget can be used to display the list of available dictionary sources.

Returns : | the newly created GdictSourceChooser widget.

Since 0.12

### gdict_source_chooser_new_with_loader ()

    GtkWidget *         gdict_source_chooser_new_with_loader
                                                            (GdictSourceLoader *loader);

Creates a new GdictSourceChooser widget and sets `loader` as the GdictSourceLoader object to be used to retrieve the list of available dictionary sources.

`loader` : | a GdictSourceLoader
Returns : | the newly created GdictSourceChooser widget.

Since 0.12

### gdict_source_chooser_get_loader ()

    GdictSourceLoader * gdict_source_chooser_get_loader     (GdictSourceChooser *chooser);

Retrieves the GdictSourceLoader used by `chooser`.

`chooser` : | a GdictSourceChooser
Returns : | a GdictSourceLoader or `NULL` is none is set

Since 0.12

### gdict_source_chooser_set_loader ()

    void                gdict_source_chooser_set_loader     (GdictSourceChooser *chooser,
                                                             GdictSourceLoader *loader);

Sets the GdictSourceLoader to be used by the source chooser widget.

`chooser` : | a GdictSourceChooser
`loader` : | a GdictSourceLoader or `NULL` to unset it

Since 0.12

### gdict_source_chooser_get_sources ()

    gchar **            gdict_source_chooser_get_sources    (GdictSourceChooser *chooser,
                                                             gsize *length);

Retrieves the names of the available dictionary sources.

`chooser` : | a GdictSouceChooser
`length` : | return location for the length of the returned vector
Returns : | a newly allocated, `NULL` terminated string vector containing the names of the available sources. Use `g_strfreev()` when done using it.

Since 0.12

### gdict_source_chooser_count_sources ()

    gint                gdict_source_chooser_count_sources  (GdictSourceChooser *chooser);

Retrieve the number of available dictionary sources.

`chooser` : | a GdictSourceChooser
Returns : | the number of available sources, or -1 if no GdictSourceLoader has been set

Since 0.12

### gdict_source_chooser_has_source ()

    gboolean            gdict_source_chooser_has_source     (GdictSourceChooser *chooser,
                                                             const gchar *source_name);

Checks whether `chooser` has a dictionary source named `source_name`.

`chooser` : | a GdictSourceChooser
`source_name` : | the name of a dictionary source
Returns : | `TRUE` if the dictionary source was found

Since 0.12

### gdict_source_chooser_refresh ()

    void                gdict_source_chooser_refresh        (GdictSourceChooser *chooser);

Forces a refresh on the contents of the source chooser widget

`chooser` : | a GdictSourceChooser

Since 0.12

### gdict_source_chooser_select_source ()

    gboolean            gdict_source_chooser_select_source  (GdictSourceChooser *chooser,
                                                             const gchar *source_name);

Selects the dictionary source named `source_name` inside `chooser`. The selection is moved but the row containing the dictionary source is not activated.

`chooser` : | a GdictSourceChooser
`source_name` : | the name of a dictionary source
Returns : | `TRUE` if the source was found and selected

Since 0.12

### gdict_source_chooser_unselect_source ()

    gboolean            gdict_source_chooser_unselect_source
                                                            (GdictSourceChooser *chooser,
                                                             const gchar *source_name);

Unselects `source_name` inside `chooser`.

`chooser` : | a GdictSourceChooser
`source_name` : | the name of a dictionary source
Returns : | `TRUE` if the source was found and unselected

Since 0.12

### gdict_source_chooser_get_current_source ()

    gchar *             gdict_source_chooser_get_current_source
                                                            (GdictSourceChooser *chooser);

Retrieves the currently selected source.

`chooser` : | a GdictSourceChooser
Returns : | a newly allocated string containing the name of the currently selected source. Use `g_free()` when done using it

Since 0.12

### gdict_source_chooser_set_current_source ()

    gboolean            gdict_source_chooser_set_current_source
                                                            (GdictSourceChooser *chooser,
                                                             const gchar *source_name);

Sets the current dictionary source named `source_name`. The row of the source, if found, will be selected and activated.

`chooser` : | a GdictSourceChooser
`source_name` : | the name of a dictionary source
Returns : | `TRUE` if the source was found

Since 0.12

### gdict_source_chooser_add_button ()

    GtkWidget *         gdict_source_chooser_add_button     (GdictSourceChooser *chooser,
                                                             const gchar *button_text);

Adds a GtkButton with `button_text` to the button area on the bottom of `chooser`. The `button_text` can also be a stock ID.

`chooser` : | a GdictSourceChooser
`button_text` : | text of the button
Returns : | the newly packed button.

Since 0.12

## Property Details

### The `"count"` property

      "count"                    gint                  : Read

The number of available dictionary sources, or -1 if no GdictSourceLoader is set.

Allowed values: >= -1

Default value: -1

Since 0.12

### The `"loader"` property

      "loader"                   GdictSourceLoader*    : Read / Write / Construct

The GdictSourceLoader used to retrieve the list of available dictionary sources.

Since 0.12

## Signal Details

### The `"selection-changed"` signal

    void                user_function                      (GdictSourceChooser *chooser,
                                                            gpointer            user_data)      : Run Last

The ::selection-changed signal is emitted each time the selection inside the source chooser widget has been changed.

`chooser` : | the GdictSourceChooser that received the signal
`user_data` : | user data set when the signal handler was connected.

Since 0.12

### The `"source-activated"` signal

    void                user_function                      (GdictSourceChooser *chooser,
                                                            gchar              *source_name,
                                                            GdictSource        *source,
                                                            gpointer            user_data)        : Run Last

The ::source-activated signal is emitted each time the user activates a row in the source chooser widget, either by double clicking on it or by a keyboard event.

`chooser` : | the GdictSourceChooser that received the signal
`source_name` : | the name of the activated source
`source` : | the activated GdictSource
`user_data` : | user data set when the signal handler was connected.

Since 0.12