Miscellaneous

Miscellaneous — Convenient functions

Synopsis




void        (*GSEFunc)                      (gint value,
                                             gpointer data);
gint        gs_strcmp                       (const gchar *v1,
                                             const gchar *v2);
gdouble     gnome_scan_mm_from_pixel        (gint pixel,
                                             gdouble resolution);
gint        gnome_scan_pixel_from_mm        (gdouble mm,
                                             gdouble resolution);
GValue*     gs_value_new_boolean            (gboolean boolean);
GValue*     gs_value_new_int                (gint integer);
GValue*     gs_value_new_string             (const gchar *string);
GValue*     gs_value_new_double             (gdouble real);
GValue*     gs_value_new_enum               (GType type,
                                             gint v_enum);
gchar*      gs_enum_get_nick                (GType type,
                                             gint value);
gchar*      gs_enum_get_name                (GType type,
                                             gint value);
void        gs_enum_foreach                 (GType type,
                                             GSEFunc func,
                                             gpointer data);

Description

This part of Gnome Scan implement function that fill a lake in glib or implement special function for scanning such as unit conversion.

Details

GSEFunc ()

void        (*GSEFunc)                      (gint value,
                                             gpointer data);

Function prototype for gs_enum_foreach() loop.

value : A GEnum value.
data : A user data.

gs_strcmp ()

gint        gs_strcmp                       (const gchar *v1,
                                             const gchar *v2);

This function is a safe wrapper to strcmp that allow to compare NULL string.

v1 : a string
v2 : another string
Returns : strcmp results.

gnome_scan_mm_from_pixel ()

gdouble     gnome_scan_mm_from_pixel        (gint pixel,
                                             gdouble resolution);

Convert a length from pixel to millimeter using a dpi resolution.

pixel : a length in pixel
resolution : the resolution in dpi
Returns : The length in mm

gnome_scan_pixel_from_mm ()

gint        gnome_scan_pixel_from_mm        (gdouble mm,
                                             gdouble resolution);

The opposite for gnome_scan_mm_from_pixel(). Convert a length from millimeter to pixel using a dpi resolution.

mm : a length in mm
resolution : the resolution in dpi
Returns : The length in pixel

gs_value_new_boolean ()

GValue*     gs_value_new_boolean            (gboolean boolean);

Convenient function that create a GValue from a boolean.

boolean : a gboolean
Returns : a new GValue

gs_value_new_int ()

GValue*     gs_value_new_int                (gint integer);

Convenient function that create a GValue from an integer.

integer : an integer
Returns : a new GValue

gs_value_new_string ()

GValue*     gs_value_new_string             (const gchar *string);

Convenient function that create a GValue from a string.

string : a string
Returns : a new GValue

gs_value_new_double ()

GValue*     gs_value_new_double             (gdouble real);

Convenient function that create a GValue from a double.

real : a gdouble value
Returns : a new GValue

gs_value_new_enum ()

GValue*     gs_value_new_enum               (GType type,
                                             gint v_enum);

Convenient function that create a GValue from an enum value.

type : the enum type
v_enum : the enum value
Returns : a new GValue

gs_enum_get_nick ()

gchar*      gs_enum_get_nick                (GType type,
                                             gint value);

Convenient function that return the nick of an enum value.

type : an enum type
value : a value
Returns : the value nick

gs_enum_get_name ()

gchar*      gs_enum_get_name                (GType type,
                                             gint value);

Convenient function that return the name of an enum value.

type : an enum type
value : a value
Returns : the value name

gs_enum_foreach ()

void        gs_enum_foreach                 (GType type,
                                             GSEFunc func,
                                             gpointer data);

Loop the value of an enumeration and apply the user function func with param data.

type : An enum type
func : a GFunc callback
data : func parameter