![]() |
![]() |
![]() |
Gnome Scan Reference Manual | ![]() |
---|---|---|---|---|
#define GS_DEFINE_QUARK (quark_name, String) #define GS_DEFINE_PARAM (prefix, Prefix, param_name, ParamName, VALUE_TYPE) GQuark gs_param_spec_get_group (GParamSpec *spec);
Instead of using a all-in-one option object (like in Gnome Scan
0.4), Gnome Scan now use regular GParamSpecs. Gnome Scan
GParamSpecs (referred as GSParamSpecs) have been designed in order
to build generic widget for plugins parameters (like Gegl and other
projects does). A common attribute added to each GSParamSpec is
the group
quark. The group
quark is computed from the translated
group title.
Also, GSParamSpecs are much more high-level than it's parent GParamSpec in order to build complex param widgets (range, area, paper-size, …).
#define GS_DEFINE_QUARK(quark_name, String)
Generate a function that generate a static quark from String
.
For example:
GS_DEFINE_QUARK (foo_bar, FooBar);
expands to:
GQuark gs_foo_bar_quark () { static GQuark quark = 0; if (!quark) { quark = g_quark_from_static_string ("FooBar"); } return quark; }
quark_name : |
function prefix |
String : |
The string passed to g_quark_from_string()
|
#define GS_DEFINE_PARAM(prefix, Prefix, param_name, ParamName, VALUE_TYPE)
Convenient function that avoid duplicated bug writing GLib boiler plate for GType registration for a custom GParamSpec.
For example:
GS_DEFINE_PARAM (foo, Foo,bar, Bar, G_TYPE_INT);
expands to:
GType foo_param_bar_get_type () { static GType type = 0; if (!type) { const GParamSpecTypeInfo info = { sizeof (FooParamBarSpec), 0, NULL, G_TYPE_INT, NULL, NULL, NULL, NULL }; type = g_param_type_register_static ("FooParamBarSpec", &info); } return type; }
You'll then have to declare a FooParamSpecBar structure as
well as declaring foo_param_bar_get_type()
and writing some macros.
prefix : |
|
Prefix : |
|
param_name : |
param prefix |
ParamName : |
Capitalized param name |
VALUE_TYPE : |
The macro returning the value GType |