GnomeScanSettings

## GnomeScanSettings GnomeScanSettings — Store settings for plugins |

## Synopsis

                        GnomeScanSettings;
    GnomeScanSettings*  gnome_scan_settings_new             (void);
    void                gnome_scan_settings_init_value      (GnomeScanSettings *settings,
                                                             GParamSpec *pspec);
    void                gnome_scan_settings_set             (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             const GValue *value);
    void                gnome_scan_settings_set_transform   (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             const GValue *value);
    void                gnome_scan_settings_set_double      (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gdouble value);
    void                gnome_scan_settings_set_int         (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gint value);
    void                gnome_scan_settings_set_boolean     (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gboolean value);
    void                gnome_scan_settings_set_enum        (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type,
                                                             gint value);
    void                gnome_scan_settings_set_boxed       (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type,
                                                             gpointer value);
    void                gnome_scan_settings_set_object      (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GObject *value);
    void                gnome_scan_settings_set_pointer     (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gpointer value);
    GValue*             gnome_scan_settings_get             (GnomeScanSettings *settings,
                                                             const gchar *name);
    GValue*             gnome_scan_settings_get_transformed (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);
    gchar*              gnome_scan_settings_get_string      (GnomeScanSettings *settings,
                                                             const gchar *name);
    gdouble             gnome_scan_settings_get_double      (GnomeScanSettings *settings,
                                                             const gchar *name);
    gint                gnome_scan_settings_get_int         (GnomeScanSettings *settings,
                                                             const gchar *name);
    gboolean            gnome_scan_settings_get_boolean     (GnomeScanSettings *settings,
                                                             const gchar *name);
    gint                gnome_scan_settings_get_enum        (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);
    gpointer            gnome_scan_settings_get_boxed       (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);
    GObject*            gnome_scan_settings_get_object      (GnomeScanSettings *settings,
                                                             const gchar *name);
    gpointer            gnome_scan_settings_get_pointer     (GnomeScanSettings *settings,
                                                             const gchar *name);
    GHashTable*         gnome_scan_settings_get_all         (GnomeScanSettings *settings);

## Object Hierarchy

      GObject
       +----GnomeScanSettings

## Signals

      "changed"                                        : Run Last

## Description

When user switch from a scanner to another, he expects the settings to keep almost the same. e.g. resolution should not be resetted on device selection. The settings are remember in a GnomeScanSettings which maintains a table of GValue using `GParamSpec`:name as key. This allow to apply the same GnomeScanSettings on various GnomeScanPlugin through `gnome_scan_plugin_configure()`.

Since 0.5.92, GnomeScanSettings load and store automatically settings in GConf in /apps/gnome-scan/`prgname`%/`key`%. Ensure you have a call to `g_set_prgname()` before `gnome_scan_init()`. Loading is done upon construction. However, storing is done at dispose stage. Ensure to correctly ref/unref your GnomeScanSettings instance in order to actually use this feature.

## Details

### GnomeScanSettings

    typedef struct _GnomeScanSettings GnomeScanSettings;

A GnomeScanSettings manage a table of GValue indexed by the name of the param spec they where associated to.

### gnome_scan_settings_new ()

    GnomeScanSettings*  gnome_scan_settings_new             (void);

Create a new empty GnomeScanSettings.

Returns : | a new GnomeScanSettings

### gnome_scan_settings_init_value ()

    void                gnome_scan_settings_init_value      (GnomeScanSettings *settings,
                                                             GParamSpec *pspec);

Store a new value in `settings` using default value and key from `pspec`.

`settings` : | a GnomeScanSettings
`pspec` : | a GSParamSpec

### gnome_scan_settings_set ()

    void                gnome_scan_settings_set             (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             const GValue *value);

Store `value` for `name` key. See: `gnome_scan_settings_get()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | GParamSpec user value

### gnome_scan_settings_set_transform ()

    void                gnome_scan_settings_set_transform   (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             const GValue *value);

Store `value` for `name` key, keeping existing value type by transforming `value`. `value` type is used if the `name` setting has never been set.

See: `gnome_scan_settings_get_transformed()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | GParamSpec user value

### gnome_scan_settings_set_double ()

    void                gnome_scan_settings_set_double      (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gdouble value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | gdouble value

### gnome_scan_settings_set_int ()

    void                gnome_scan_settings_set_int         (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gint value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | gint value

### gnome_scan_settings_set_boolean ()

    void                gnome_scan_settings_set_boolean     (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gboolean value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | gboolean value

### gnome_scan_settings_set_enum ()

    void                gnome_scan_settings_set_enum        (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type,
                                                             gint value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`type` : | enum GType
`value` : | enum value

### gnome_scan_settings_set_boxed ()

    void                gnome_scan_settings_set_boxed       (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type,
                                                             gpointer value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`type` : |
`value` : | a GBoxed

### gnome_scan_settings_set_object ()

    void                gnome_scan_settings_set_object      (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GObject *value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | a GObject

### gnome_scan_settings_set_pointer ()

    void                gnome_scan_settings_set_pointer     (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             gpointer value);

See: `gnome_scan_settings_set_transform()`

`settings` : | a GnomeScanSettings
`name` : | GParamSpec name
`value` : | a gpointer

### gnome_scan_settings_get ()

    GValue*             gnome_scan_settings_get             (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the value corresponding to `key` or NULL. See: `gnome_scan_settings_set()`

### gnome_scan_settings_get_transformed ()

    GValue*             gnome_scan_settings_get_transformed (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
`type` : | Transformation destination type.
Returns : | the value corresponding to `key` or NULL. See: `gnome_scan_settings_set()`

### gnome_scan_settings_get_string ()

    gchar*              gnome_scan_settings_get_string      (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the string corresponding to `key`. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_double ()

    gdouble             gnome_scan_settings_get_double      (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the string corresponding to `key` or NULL. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_int ()

    gint                gnome_scan_settings_get_int         (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the string corresponding to `key` or NULL. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_boolean ()

    gboolean            gnome_scan_settings_get_boolean     (GnomeScanSettings *settings,
                                                             const gchar *name);

`settings` : | a GnomeScanSettings
`name` : | value name
Returns : | a gboolean

### gnome_scan_settings_get_enum ()

    gint                gnome_scan_settings_get_enum        (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
`type` : | GEnum subtype
Returns : | the enum value corresponding to `key` or 0. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_boxed ()

    gpointer            gnome_scan_settings_get_boxed       (GnomeScanSettings *settings,
                                                             const gchar *name,
                                                             GType type);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
`type` : | GBoxed derived GType
Returns : | the boxed-type value corresponding to `key` or NULL. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_object ()

    GObject*            gnome_scan_settings_get_object      (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the object corresponding to `key` or NULL. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_pointer ()

    gpointer            gnome_scan_settings_get_pointer     (GnomeScanSettings *settings,
                                                             const gchar *name);

Look for a value stored in the table for `name` key.

`settings` : | a GnomeScanSettings
`name` : | a key
Returns : | the pointer corresponding to `key` or NULL. See: `gnome_scan_settings_get()`

### gnome_scan_settings_get_all ()

    GHashTable*         gnome_scan_settings_get_all         (GnomeScanSettings *settings);

Retrun all stored values in a GHashTable. Use `g_hash_table_ref()` if you want to keep the GHashTable in memory after `settings` destruction.

`settings` : | a GnomeScanSettings
Returns : | a GHashTable containings GValues

## Signal Details

### The "changed" signal

    void                user_function                      (GnomeScanSettings *widget,
                                                            gchar             *key,
                                                            gpointer           user_data)      : Run Last

This signal is emitted when the value is changed by the user.

`widget` : | The emitting widget
`key` : | The changed key
`value` : | The new value
`user_data` : | user data set when the signal handler was connected.