libgimp, libgimpmodule, libgimpwidgets: Port more widgets to derivable type

This commit is contained in:
Alx Sa 2024-08-03 02:48:07 +00:00
parent 8d598ec3a3
commit 438bc4f229
19 changed files with 250 additions and 395 deletions

View File

@ -54,7 +54,7 @@ enum
};
struct _GimpProcedureConfigPrivate
typedef struct _GimpProcedureConfigPrivate
{
GimpProcedure *procedure;
@ -65,7 +65,9 @@ struct _GimpProcedureConfigPrivate
gchar *mime_type;
GimpMetadataSaveFlags metadata_flags;
gboolean metadata_saved;
};
} GimpProcedureConfigPrivate;
#define GET_PRIVATE(obj) ((GimpProcedureConfigPrivate *) gimp_procedure_config_get_instance_private ((GimpProcedureConfig *) (obj)))
static void gimp_procedure_config_constructed (GObject *object);
@ -148,9 +150,7 @@ gimp_procedure_config_class_init (GimpProcedureConfigClass *klass)
static void
gimp_procedure_config_init (GimpProcedureConfig *config)
{
config->priv = gimp_procedure_config_get_instance_private (config);
config->priv->run_mode = -1;
GET_PRIVATE (config)->run_mode = -1;
}
static void
@ -160,17 +160,18 @@ gimp_procedure_config_constructed (GObject *object)
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_PROCEDURE (config->priv->procedure));
g_assert (GIMP_IS_PROCEDURE (GET_PRIVATE (config)->procedure));
}
static void
gimp_procedure_config_dispose (GObject *object)
{
GimpProcedureConfig *config = GIMP_PROCEDURE_CONFIG (object);
GimpProcedureConfig *config = GIMP_PROCEDURE_CONFIG (object);
GimpProcedureConfigPrivate *priv = GET_PRIVATE (config);
g_clear_object (&config->priv->procedure);
g_clear_object (&config->priv->metadata);
g_clear_pointer (&config->priv->mime_type, g_free);
g_clear_object (&priv->procedure);
g_clear_object (&priv->metadata);
g_clear_pointer (&priv->mime_type, g_free);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@ -186,7 +187,7 @@ gimp_procedure_config_set_property (GObject *object,
switch (property_id)
{
case PROP_PROCEDURE:
config->priv->procedure = g_value_dup_object (value);
GET_PRIVATE (config)->procedure = g_value_dup_object (value);
break;
default:
@ -206,7 +207,7 @@ gimp_procedure_config_get_property (GObject *object,
switch (property_id)
{
case PROP_PROCEDURE:
g_value_set_object (value, config->priv->procedure);
g_value_set_object (value, GET_PRIVATE (config)->procedure);
break;
default:
@ -234,7 +235,7 @@ gimp_procedure_config_get_procedure (GimpProcedureConfig *config)
{
g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), NULL);
return config->priv->procedure;
return GET_PRIVATE (config)->procedure;
}
static void
@ -245,11 +246,12 @@ gimp_procedure_config_get_parasite (GimpProcedureConfig *config,
gchar *value = NULL;
/* for now we only support strings */
if (! config->priv->image ||
if (! GET_PRIVATE (config)->image ||
! G_IS_PARAM_SPEC_STRING (pspec))
return;
parasite = gimp_image_get_parasite (config->priv->image, pspec->name);
parasite = gimp_image_get_parasite (GET_PRIVATE (config)->image,
pspec->name);
if (parasite)
{
@ -284,19 +286,19 @@ static void
gimp_procedure_config_set_parasite (GimpProcedureConfig *config,
GParamSpec *pspec)
{
GimpProcedureConfigPrivate *priv = GET_PRIVATE (config);
GimpParasite *parasite;
gchar *value;
/* for now we only support strings */
if (! config->priv->image ||
! G_IS_PARAM_SPEC_STRING (pspec))
if (! priv->image || ! G_IS_PARAM_SPEC_STRING (pspec))
return;
g_object_get (config,
pspec->name, &value,
NULL);
parasite = gimp_image_get_parasite (config->priv->image, pspec->name);
parasite = gimp_image_get_parasite (priv->image, pspec->name);
if (parasite)
{
@ -318,14 +320,12 @@ gimp_procedure_config_set_parasite (GimpProcedureConfig *config,
GIMP_PARASITE_PERSISTENT,
strlen (value) + 1,
value);
gimp_image_attach_parasite (config->priv->image,
parasite);
gimp_image_attach_parasite (priv->image, parasite);
gimp_parasite_free (parasite);
}
else
{
gimp_image_detach_parasite (config->priv->image,
pspec->name);
gimp_image_detach_parasite (priv->image, pspec->name);
}
}
@ -351,8 +351,7 @@ gimp_procedure_config_set_parasite (GimpProcedureConfig *config,
GIMP_PARASITE_PERSISTENT,
strlen (value) + 1,
value);
gimp_image_attach_parasite (config->priv->image,
parasite);
gimp_image_attach_parasite (priv->image, parasite);
gimp_parasite_free (parasite);
}
@ -390,11 +389,13 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
GimpImage *exported_image,
GFile *file)
{
GimpProcedureConfigPrivate *priv = GET_PRIVATE (config);
g_return_if_fail (GIMP_IS_PROCEDURE_CONFIG (config));
g_return_if_fail (GIMP_IS_IMAGE (exported_image));
g_return_if_fail (G_IS_FILE (file));
if (config->priv->metadata && ! config->priv->metadata_saved)
if (priv->metadata && ! priv->metadata_saved)
{
GObjectClass *object_class = G_OBJECT_GET_CLASS (config);
GError *error = NULL;
@ -415,20 +416,20 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
NULL);
if (value)
config->priv->metadata_flags |= prop_flag;
priv->metadata_flags |= prop_flag;
else
config->priv->metadata_flags &= ~prop_flag;
priv->metadata_flags &= ~prop_flag;
}
else
{
config->priv->metadata_flags &= ~prop_flag;
priv->metadata_flags &= ~prop_flag;
}
}
if (! gimp_image_metadata_save_finish (exported_image,
config->priv->mime_type,
config->priv->metadata,
config->priv->metadata_flags,
priv->mime_type,
priv->metadata,
priv->metadata_flags,
file, &error))
{
if (error)
@ -442,7 +443,7 @@ gimp_procedure_config_save_metadata (GimpProcedureConfig *config,
}
}
config->priv->metadata_saved = TRUE;
priv->metadata_saved = TRUE;
}
}
@ -529,7 +530,7 @@ _gimp_procedure_config_get_values (GimpProcedureConfig *config,
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
&n_pspecs);
gimp_procedure_get_aux_arguments (config->priv->procedure, &n_aux_args);
gimp_procedure_get_aux_arguments (GET_PRIVATE (config)->procedure, &n_aux_args);
n_values = gimp_value_array_length (values);
/* The config will have 1 additional property: "procedure". */
@ -597,19 +598,22 @@ _gimp_procedure_config_begin_run (GimpProcedureConfig *config,
GimpRunMode run_mode,
const GimpValueArray *args)
{
GParamSpec *run_mode_pspec;
GParamSpec **pspecs;
guint n_pspecs;
gint i;
gboolean loaded = FALSE;
GError *error = NULL;
GimpProcedureConfigPrivate *priv;
GParamSpec *run_mode_pspec;
GParamSpec **pspecs;
guint n_pspecs;
gint i;
gboolean loaded = FALSE;
GError *error = NULL;
g_return_if_fail (GIMP_IS_PROCEDURE_CONFIG (config));
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
g_return_if_fail (args != NULL);
config->priv->image = image;
config->priv->run_mode = run_mode;
priv = GET_PRIVATE (config);
priv->image = image;
priv->run_mode = run_mode;
gimp_procedure_config_set_values (config, args);
@ -653,8 +657,7 @@ _gimp_procedure_config_begin_run (GimpProcedureConfig *config,
if (pspec->owner_type == GIMP_TYPE_PROCEDURE_CONFIG)
continue;
switch (gimp_procedure_get_argument_sync (config->priv->procedure,
pspec->name))
switch (gimp_procedure_get_argument_sync (priv->procedure, pspec->name))
{
case GIMP_ARGUMENT_SYNC_PARASITE:
/* we sync the property from the image parasite if it is an
@ -663,7 +666,7 @@ _gimp_procedure_config_begin_run (GimpProcedureConfig *config,
* whatever parasite another image had when last using this
* procedure
*/
if (gimp_procedure_find_aux_argument (config->priv->procedure,
if (gimp_procedure_find_aux_argument (priv->procedure,
pspec->name) ||
(run_mode != GIMP_RUN_NONINTERACTIVE))
{
@ -718,21 +721,25 @@ void
_gimp_procedure_config_end_run (GimpProcedureConfig *config,
GimpPDBStatusType status)
{
GimpProcedureConfigPrivate *priv;
g_return_if_fail (GIMP_IS_PROCEDURE_CONFIG (config));
if (config->priv->run_mode != GIMP_RUN_NONINTERACTIVE)
priv = GET_PRIVATE (config);
if (priv->run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_displays_flush ();
if (status == GIMP_PDB_SUCCESS &&
config->priv->run_mode == GIMP_RUN_INTERACTIVE)
priv->run_mode == GIMP_RUN_INTERACTIVE)
{
GParamSpec **pspecs;
guint n_pspecs;
gint i;
GError *error = NULL;
if (config->priv->image)
gimp_procedure_config_save_parasite (config, config->priv->image,
if (priv->image)
gimp_procedure_config_save_parasite (config, priv->image,
NULL);
if (! gimp_procedure_config_save_last (config, &error))
@ -753,7 +760,7 @@ _gimp_procedure_config_end_run (GimpProcedureConfig *config,
if (pspec->owner_type == GIMP_TYPE_PROCEDURE_CONFIG)
continue;
switch (gimp_procedure_get_argument_sync (config->priv->procedure,
switch (gimp_procedure_get_argument_sync (priv->procedure,
pspec->name))
{
case GIMP_ARGUMENT_SYNC_PARASITE:
@ -768,8 +775,8 @@ _gimp_procedure_config_end_run (GimpProcedureConfig *config,
g_free (pspecs);
}
config->priv->image = NULL;
config->priv->run_mode = -1;
priv->image = NULL;
priv->run_mode = -1;
}
/**
@ -815,7 +822,7 @@ _gimp_procedure_config_end_run (GimpProcedureConfig *config,
* but must take care of their default values itself. The easiest way
* to do this is by simply using [func@export_comment], [func@export_exif] etc.
* as default values for these arguments when adding them using
* gimp_procedure_add_boolean_argument() or
* gimp_procedure_add_boolean_argument() or
* gimp_procedure_add_boolean_aux_argument().
*
* Returns: (transfer none) (nullable): The metadata to be used
@ -831,12 +838,15 @@ _gimp_procedure_config_begin_export (GimpProcedureConfig *config,
const GimpValueArray *args,
const gchar *mime_type)
{
GObjectClass *object_class;
GimpProcedureConfigPrivate *priv;
GObjectClass *object_class;
g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), NULL);
g_return_val_if_fail (GIMP_IS_IMAGE (original_image), NULL);
g_return_val_if_fail (args != NULL, NULL);
priv = GET_PRIVATE (config);
object_class = G_OBJECT_GET_CLASS (config);
if (mime_type)
@ -844,15 +854,15 @@ _gimp_procedure_config_begin_export (GimpProcedureConfig *config,
GimpMetadataSaveFlags metadata_flags;
gint i;
config->priv->metadata =
priv->metadata =
gimp_image_metadata_save_prepare (original_image,
mime_type,
&metadata_flags);
if (config->priv->metadata)
if (priv->metadata)
{
config->priv->mime_type = g_strdup (mime_type);
config->priv->metadata_flags = metadata_flags;
priv->mime_type = g_strdup (mime_type);
priv->metadata_flags = metadata_flags;
}
for (i = 0; i < G_N_ELEMENTS (metadata_properties); i++)
@ -877,7 +887,7 @@ _gimp_procedure_config_begin_export (GimpProcedureConfig *config,
_gimp_procedure_config_begin_run (config, original_image, run_mode, args);
return config->priv->metadata;
return priv->metadata;
}
/**
@ -910,19 +920,23 @@ _gimp_procedure_config_end_export (GimpProcedureConfig *config,
GFile *file,
GimpPDBStatusType status)
{
GimpProcedureConfigPrivate *priv;
g_return_if_fail (GIMP_IS_PROCEDURE_CONFIG (config));
g_return_if_fail (GIMP_IS_IMAGE (exported_image));
g_return_if_fail (G_IS_FILE (file));
priv = GET_PRIVATE (config);
if (status == GIMP_PDB_SUCCESS)
{
gimp_procedure_config_save_metadata (config, exported_image, file);
}
g_clear_object (&config->priv->metadata);
g_clear_pointer (&config->priv->mime_type, g_free);
config->priv->metadata_flags = 0;
config->priv->metadata_saved = FALSE;
g_clear_object (&priv->metadata);
g_clear_pointer (&priv->mime_type, g_free);
priv->metadata_flags = 0;
priv->metadata_saved = FALSE;
_gimp_procedure_config_end_run (config, status);
}
@ -1026,7 +1040,8 @@ gimp_procedure_config_set_values (GimpProcedureConfig *config,
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
&n_pspecs);
gimp_procedure_get_aux_arguments (config->priv->procedure, &n_aux_args);
gimp_procedure_get_aux_arguments (GET_PRIVATE (config)->procedure,
&n_aux_args);
n_values = gimp_value_array_length (values);
/* The first property is the procedure, all others are arguments. */

View File

@ -31,23 +31,8 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_PROCEDURE_CONFIG (gimp_procedure_config_get_type ())
#define GIMP_PROCEDURE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PROCEDURE_CONFIG, GimpProcedureConfig))
#define GIMP_PROCEDURE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PROCEDURE_CONFIG, GimpProcedureConfigClass))
#define GIMP_IS_PROCEDURE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PROCEDURE_CONFIG))
#define GIMP_IS_PROCEDURE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PROCEDURE_CONFIG))
#define GIMP_PROCEDURE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PROCEDURE_CONFIG, GimpProcedureConfigClass))
typedef struct _GimpProcedureConfigClass GimpProcedureConfigClass;
typedef struct _GimpProcedureConfigPrivate GimpProcedureConfigPrivate;
struct _GimpProcedureConfig
{
GObject parent_instance;
GimpProcedureConfigPrivate *priv;
};
#define GIMP_TYPE_PROCEDURE_CONFIG (gimp_procedure_config_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpProcedureConfig, gimp_procedure_config, GIMP, PROCEDURE_CONFIG, GObject)
struct _GimpProcedureConfigClass
{
@ -65,8 +50,6 @@ struct _GimpProcedureConfigClass
};
GType gimp_procedure_config_get_type (void) G_GNUC_CONST;
GimpProcedure *
gimp_procedure_config_get_procedure (GimpProcedureConfig *config);

View File

@ -56,7 +56,7 @@ enum
};
static GParamSpec *obj_props[N_PROPS] = { NULL, };
struct _GimpModulePrivate
typedef struct _GimpModulePrivate
{
GFile *file; /* path to the module */
gboolean auto_load; /* auto-load the module on creation */
@ -72,7 +72,9 @@ struct _GimpModulePrivate
GimpModuleQueryFunc query_module;
GimpModuleRegisterFunc register_module;
};
} GimpModulePrivate;
#define GET_PRIVATE(obj) ((GimpModulePrivate *) gimp_module_get_instance_private ((GimpModule *) (obj)))
static void gimp_module_get_property (GObject *object,
@ -131,9 +133,7 @@ gimp_module_class_init (GimpModuleClass *klass)
static void
gimp_module_init (GimpModule *module)
{
module->priv = gimp_module_get_instance_private (module);
module->priv->state = GIMP_MODULE_STATE_ERROR;
GET_PRIVATE (module)->state = GIMP_MODULE_STATE_ERROR;
}
static void
@ -183,11 +183,12 @@ gimp_module_get_property (GObject *object,
static void
gimp_module_finalize (GObject *object)
{
GimpModule *module = GIMP_MODULE (object);
GimpModule *module = GIMP_MODULE (object);
GimpModulePrivate *priv = GET_PRIVATE (module);
g_clear_object (&module->priv->file);
g_clear_pointer (&module->priv->info, gimp_module_info_free);
g_clear_pointer (&module->priv->last_error, g_free);
g_clear_object (&priv->file);
g_clear_pointer (&priv->info, gimp_module_info_free);
g_clear_pointer (&priv->last_error, g_free);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -195,15 +196,16 @@ gimp_module_finalize (GObject *object)
static gboolean
gimp_module_load (GTypeModule *module)
{
GimpModule *gimp_module = GIMP_MODULE (module);
GimpModule *gimp_module = GIMP_MODULE (module);
GimpModulePrivate *priv = GET_PRIVATE (gimp_module);
gpointer func;
g_return_val_if_fail (gimp_module->priv->file != NULL, FALSE);
g_return_val_if_fail (gimp_module->priv->module == NULL, FALSE);
g_return_val_if_fail (priv->file != NULL, FALSE);
g_return_val_if_fail (priv->module == NULL, FALSE);
if (gimp_module->priv->verbose)
if (priv->verbose)
g_print ("Loading module '%s'\n",
gimp_file_get_utf8_name (gimp_module->priv->file));
gimp_file_get_utf8_name (priv->file));
if (! gimp_module_open (gimp_module))
return FALSE;
@ -212,42 +214,42 @@ gimp_module_load (GTypeModule *module)
return FALSE;
/* find the gimp_module_register symbol */
if (! g_module_symbol (gimp_module->priv->module, "gimp_module_register",
if (! g_module_symbol (priv->module, "gimp_module_register",
&func))
{
gimp_module_set_last_error (gimp_module,
"Missing gimp_module_register() symbol");
g_message (_("Module '%s' load error: %s"),
gimp_file_get_utf8_name (gimp_module->priv->file),
gimp_module->priv->last_error);
gimp_file_get_utf8_name (priv->file),
priv->last_error);
gimp_module_close (gimp_module);
gimp_module->priv->state = GIMP_MODULE_STATE_ERROR;
priv->state = GIMP_MODULE_STATE_ERROR;
return FALSE;
}
gimp_module->priv->register_module = func;
priv->register_module = func;
if (! gimp_module->priv->register_module (module))
if (! priv->register_module (module))
{
gimp_module_set_last_error (gimp_module,
"gimp_module_register() returned FALSE");
g_message (_("Module '%s' load error: %s"),
gimp_file_get_utf8_name (gimp_module->priv->file),
gimp_module->priv->last_error);
gimp_file_get_utf8_name (priv->file),
priv->last_error);
gimp_module_close (gimp_module);
gimp_module->priv->state = GIMP_MODULE_STATE_LOAD_FAILED;
priv->state = GIMP_MODULE_STATE_LOAD_FAILED;
return FALSE;
}
gimp_module->priv->state = GIMP_MODULE_STATE_LOADED;
priv->state = GIMP_MODULE_STATE_LOADED;
return TRUE;
}
@ -255,13 +257,14 @@ gimp_module_load (GTypeModule *module)
static void
gimp_module_unload (GTypeModule *module)
{
GimpModule *gimp_module = GIMP_MODULE (module);
GimpModule *gimp_module = GIMP_MODULE (module);
GimpModulePrivate *priv = GET_PRIVATE (gimp_module);
g_return_if_fail (gimp_module->priv->module != NULL);
g_return_if_fail (priv->module != NULL);
if (gimp_module->priv->verbose)
if (priv->verbose)
g_print ("Unloading module '%s'\n",
gimp_file_get_utf8_name (gimp_module->priv->file));
gimp_file_get_utf8_name (priv->file));
gimp_module_close (gimp_module);
}
@ -284,18 +287,20 @@ gimp_module_new (GFile *file,
gboolean auto_load,
gboolean verbose)
{
GimpModule *module;
GimpModule *module;
GimpModulePrivate *priv;
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (g_file_is_native (file), NULL);
module = g_object_new (GIMP_TYPE_MODULE, NULL);
priv = GET_PRIVATE (module);
module->priv->file = g_object_ref (file);
module->priv->auto_load = auto_load ? TRUE : FALSE;
module->priv->verbose = verbose ? TRUE : FALSE;
priv->file = g_object_ref (file);
priv->auto_load = auto_load ? TRUE : FALSE;
priv->verbose = verbose ? TRUE : FALSE;
if (module->priv->auto_load)
if (priv->auto_load)
{
if (gimp_module_load (G_TYPE_MODULE (module)))
gimp_module_unload (G_TYPE_MODULE (module));
@ -306,7 +311,7 @@ gimp_module_new (GFile *file,
g_print ("Skipping module '%s'\n",
gimp_file_get_utf8_name (file));
module->priv->state = GIMP_MODULE_STATE_NOT_LOADED;
priv->state = GIMP_MODULE_STATE_NOT_LOADED;
}
return module;
@ -327,7 +332,7 @@ gimp_module_get_file (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), NULL);
return module->priv->file;
return GET_PRIVATE (module)->file;
}
/**
@ -343,11 +348,15 @@ void
gimp_module_set_auto_load (GimpModule *module,
gboolean auto_load)
{
GimpModulePrivate *priv;
g_return_if_fail (GIMP_IS_MODULE (module));
if (auto_load != module->priv->auto_load)
priv = GET_PRIVATE (module);
if (auto_load != priv->auto_load)
{
module->priv->auto_load = auto_load;
priv->auto_load = auto_load;
g_object_notify_by_pspec (G_OBJECT (module), obj_props[PROP_AUTO_LOAD]);
}
@ -368,7 +377,7 @@ gimp_module_get_auto_load (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
return module->priv->auto_load;
return GET_PRIVATE (module)->auto_load;
}
/**
@ -382,21 +391,24 @@ gimp_module_get_auto_load (GimpModule *module)
gboolean
gimp_module_is_on_disk (GimpModule *module)
{
gboolean old_on_disk;
GimpModulePrivate *priv;
gboolean old_on_disk;
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
old_on_disk = module->priv->on_disk;
priv = GET_PRIVATE (module);
module->priv->on_disk =
(g_file_query_file_type (module->priv->file,
old_on_disk = priv->on_disk;
priv->on_disk =
(g_file_query_file_type (priv->file,
G_FILE_QUERY_INFO_NONE, NULL) ==
G_FILE_TYPE_REGULAR);
if (module->priv->on_disk != old_on_disk)
if (priv->on_disk != old_on_disk)
g_object_notify_by_pspec (G_OBJECT (module), obj_props[PROP_ON_DISK]);
return module->priv->on_disk;
return priv->on_disk;
}
/**
@ -412,7 +424,7 @@ gimp_module_is_loaded (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
return module->priv->module != NULL;
return GET_PRIVATE (module)->module != NULL;
}
/**
@ -429,7 +441,7 @@ gimp_module_get_info (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), NULL);
return module->priv->info;
return GET_PRIVATE (module)->info;
}
/**
@ -445,7 +457,7 @@ gimp_module_get_state (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), GIMP_MODULE_STATE_ERROR);
return module->priv->state;
return GET_PRIVATE (module)->state;
}
/**
@ -461,7 +473,7 @@ gimp_module_get_last_error (GimpModule *module)
{
g_return_val_if_fail (GIMP_IS_MODULE (module), NULL);
return module->priv->last_error;
return GET_PRIVATE (module)->last_error;
}
/**
@ -478,12 +490,15 @@ gboolean
gimp_module_query_module (GimpModule *module)
{
const GimpModuleInfo *info;
GimpModulePrivate *priv;
gboolean close_module = FALSE;
gpointer func;
g_return_val_if_fail (GIMP_IS_MODULE (module), FALSE);
if (! module->priv->module)
priv = GET_PRIVATE (module);
if (! priv->module)
{
if (! gimp_module_open (module))
return FALSE;
@ -492,26 +507,26 @@ gimp_module_query_module (GimpModule *module)
}
/* find the gimp_module_query symbol */
if (! g_module_symbol (module->priv->module, "gimp_module_query", &func))
if (! g_module_symbol (priv->module, "gimp_module_query", &func))
{
gimp_module_set_last_error (module,
"Missing gimp_module_query() symbol");
g_message (_("Module '%s' load error: %s"),
gimp_file_get_utf8_name (module->priv->file),
module->priv->last_error);
gimp_file_get_utf8_name (priv->file),
priv->last_error);
gimp_module_close (module);
module->priv->state = GIMP_MODULE_STATE_ERROR;
priv->state = GIMP_MODULE_STATE_ERROR;
return FALSE;
}
module->priv->query_module = func;
priv->query_module = func;
g_clear_pointer (&module->priv->info, gimp_module_info_free);
g_clear_pointer (&priv->info, gimp_module_info_free);
info = module->priv->query_module (G_TYPE_MODULE (module));
info = priv->query_module (G_TYPE_MODULE (module));
if (! info || info->abi_version != GIMP_MODULE_ABI_VERSION)
{
@ -521,16 +536,16 @@ gimp_module_query_module (GimpModule *module)
"gimp_module_query() returned NULL");
g_message (_("Module '%s' load error: %s"),
gimp_file_get_utf8_name (module->priv->file),
module->priv->last_error);
gimp_file_get_utf8_name (priv->file),
priv->last_error);
gimp_module_close (module);
module->priv->state = GIMP_MODULE_STATE_ERROR;
priv->state = GIMP_MODULE_STATE_ERROR;
return FALSE;
}
module->priv->info = gimp_module_info_copy (info);
priv->info = gimp_module_info_copy (info);
if (close_module)
return gimp_module_close (module);
@ -559,20 +574,21 @@ gimp_module_error_quark (void)
static gboolean
gimp_module_open (GimpModule *module)
{
gchar *path = g_file_get_path (module->priv->file);
GimpModulePrivate *priv = GET_PRIVATE (module);
gchar *path = g_file_get_path (priv->file);
module->priv->module = g_module_open (path, 0);
priv->module = g_module_open (path, 0);
g_free (path);
if (! module->priv->module)
if (! priv->module)
{
module->priv->state = GIMP_MODULE_STATE_ERROR;
priv->state = GIMP_MODULE_STATE_ERROR;
gimp_module_set_last_error (module, g_module_error ());
g_message (_("Module '%s' load error: %s"),
gimp_file_get_utf8_name (module->priv->file),
module->priv->last_error);
gimp_file_get_utf8_name (priv->file),
priv->last_error);
return FALSE;
}
@ -583,12 +599,14 @@ gimp_module_open (GimpModule *module)
static gboolean
gimp_module_close (GimpModule *module)
{
g_module_close (module->priv->module); /* FIXME: error handling */
module->priv->module = NULL;
module->priv->query_module = NULL;
module->priv->register_module = NULL;
GimpModulePrivate *priv = GET_PRIVATE (module);
module->priv->state = GIMP_MODULE_STATE_NOT_LOADED;
g_module_close (priv->module); /* FIXME: error handling */
priv->module = NULL;
priv->query_module = NULL;
priv->register_module = NULL;
priv->state = GIMP_MODULE_STATE_NOT_LOADED;
return TRUE;
}
@ -597,10 +615,12 @@ static void
gimp_module_set_last_error (GimpModule *module,
const gchar *error_str)
{
if (module->priv->last_error)
g_free (module->priv->last_error);
GimpModulePrivate *priv = GET_PRIVATE (module);
module->priv->last_error = g_strdup (error_str);
if (priv->last_error)
g_free (priv->last_error);
priv->last_error = g_strdup (error_str);
}

View File

@ -151,23 +151,8 @@ G_MODULE_EXPORT const GimpModuleInfo * gimp_module_query (GTypeModule *module
G_MODULE_EXPORT gboolean gimp_module_register (GTypeModule *module);
#define GIMP_TYPE_MODULE (gimp_module_get_type ())
#define GIMP_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MODULE, GimpModule))
#define GIMP_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MODULE, GimpModuleClass))
#define GIMP_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MODULE))
#define GIMP_IS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MODULE))
#define GIMP_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MODULE, GimpModuleClass))
typedef struct _GimpModulePrivate GimpModulePrivate;
typedef struct _GimpModuleClass GimpModuleClass;
struct _GimpModule
{
GTypeModule parent_instance;
GimpModulePrivate *priv;
};
#define GIMP_TYPE_MODULE (gimp_module_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpModule, gimp_module, GIMP, MODULE, GTypeModule)
struct _GimpModuleClass
{
@ -187,8 +172,6 @@ struct _GimpModuleClass
};
GType gimp_module_get_type (void) G_GNUC_CONST;
GimpModule * gimp_module_new (GFile *file,
gboolean auto_load,
gboolean verbose);

View File

@ -94,7 +94,7 @@ enum
};
struct _GimpColorButtonPrivate
typedef struct _GimpColorButtonPrivate
{
gchar *title;
gboolean continuous_update;
@ -107,9 +107,9 @@ struct _GimpColorButtonPrivate
GMenu *menu;
GimpColorConfig *config;
};
} GimpColorButtonPrivate;
#define GET_PRIVATE(obj) (((GimpColorButton *) (obj))->priv)
#define GET_PRIVATE(obj) ((GimpColorButtonPrivate *) gimp_color_button_get_instance_private ((GimpColorButton *) (obj)))
static void gimp_color_button_constructed (GObject *object);
@ -319,9 +319,7 @@ gimp_color_button_class_init (GimpColorButtonClass *klass)
static void
gimp_color_button_init (GimpColorButton *button)
{
GimpColorButtonPrivate *priv = gimp_color_button_get_instance_private (button);
button->priv = priv;
GimpColorButtonPrivate *priv = GET_PRIVATE (button);
priv->color_area = g_object_new (GIMP_TYPE_COLOR_AREA,
"drag-mask", GDK_BUTTON1_MASK,

View File

@ -37,23 +37,8 @@
G_BEGIN_DECLS
#define GIMP_TYPE_COLOR_BUTTON (gimp_color_button_get_type ())
#define GIMP_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButton))
#define GIMP_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass))
#define GIMP_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_BUTTON))
#define GIMP_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_BUTTON))
#define GIMP_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_BUTTON, GimpColorButtonClass))
typedef struct _GimpColorButtonPrivate GimpColorButtonPrivate;
typedef struct _GimpColorButtonClass GimpColorButtonClass;
struct _GimpColorButton
{
GimpButton parent_instance;
GimpColorButtonPrivate *priv;
};
#define GIMP_TYPE_COLOR_BUTTON (gimp_color_button_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpColorButton, gimp_color_button, GIMP, COLOR_BUTTON, GimpButton)
struct _GimpColorButtonClass
{
@ -77,8 +62,6 @@ struct _GimpColorButtonClass
};
GType gimp_color_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_button_new (const gchar *title,
gint width,
gint height,

View File

@ -62,23 +62,23 @@ enum
};
struct _GimpColorDisplayPrivate
typedef struct _GimpColorDisplayPrivate
{
gboolean enabled;
GimpColorConfig *config;
GimpColorManaged *managed;
};
} GimpColorDisplayPrivate;
#define GET_PRIVATE(obj) (((GimpColorDisplay *) (obj))->priv)
#define GET_PRIVATE(obj) ((GimpColorDisplayPrivate *) gimp_color_display_get_instance_private ((GimpColorDisplay *) (obj)))
static void gimp_color_display_constructed (GObject *object);
static void gimp_color_display_constructed (GObject *object);
static void gimp_color_display_dispose (GObject *object);
static void gimp_color_display_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
GParamSpec *pspec);
static void gimp_color_display_get_property (GObject *object,
guint property_id,
GValue *value,
@ -154,7 +154,6 @@ gimp_color_display_class_init (GimpColorDisplayClass *klass)
static void
gimp_color_display_init (GimpColorDisplay *display)
{
display->priv = gimp_color_display_get_instance_private (display);
}
static void

View File

@ -31,24 +31,10 @@ G_BEGIN_DECLS
/* For information look at the html documentation */
#define GIMP_TYPE_COLOR_DISPLAY (gimp_color_display_get_type ())
#define GIMP_COLOR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplay))
#define GIMP_COLOR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplayClass))
#define GIMP_IS_COLOR_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_DISPLAY))
#define GIMP_IS_COLOR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_DISPLAY))
#define GIMP_COLOR_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_DISPLAY, GimpColorDisplayClass))
#define GIMP_TYPE_COLOR_DISPLAY (gimp_color_display_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpColorDisplay, gimp_color_display, GIMP, COLOR_DISPLAY, GObject)
typedef struct _GimpColorDisplayPrivate GimpColorDisplayPrivate;
typedef struct _GimpColorDisplayClass GimpColorDisplayClass;
struct _GimpColorDisplay
{
GObject parent_instance;
GimpColorDisplayPrivate *priv;
};
struct _GimpColorDisplayClass
{
GObjectClass parent_class;
@ -78,8 +64,6 @@ struct _GimpColorDisplayClass
};
GType gimp_color_display_get_type (void) G_GNUC_CONST;
GimpColorDisplay * gimp_color_display_clone (GimpColorDisplay *display);
void gimp_color_display_convert_buffer (GimpColorDisplay *display,

View File

@ -52,15 +52,15 @@
#define DEFAULT_TAB_ICON_SIZE GTK_ICON_SIZE_BUTTON
struct _GimpColorNotebookPrivate
typedef struct _GimpColorNotebookPrivate
{
GtkWidget *notebook;
GList *selectors;
GimpColorSelector *cur_page;
};
} GimpColorNotebookPrivate;
#define GET_PRIVATE(obj) (((GimpColorNotebook *) obj)->priv)
#define GET_PRIVATE(obj) ((GimpColorNotebookPrivate *) gimp_color_notebook_get_instance_private ((GimpColorNotebook *) (obj)))
static void gimp_color_notebook_style_updated (GtkWidget *widget);
@ -150,10 +150,6 @@ gimp_color_notebook_init (GimpColorNotebook *notebook)
guint n_selector_types;
guint i;
notebook->priv = gimp_color_notebook_get_instance_private (notebook);
private = notebook->priv;
private->notebook = gtk_notebook_new ();
gtk_notebook_popup_enable (GTK_NOTEBOOK (private->notebook));
gtk_box_pack_start (GTK_BOX (notebook), private->notebook, TRUE, TRUE, 0);
@ -487,11 +483,12 @@ gimp_color_notebook_remove_selector (GtkContainer *container,
GtkWidget *widget,
GimpColorNotebook *notebook)
{
notebook->priv->selectors = g_list_remove (notebook->priv->selectors,
widget);
GimpColorNotebookPrivate *priv = GET_PRIVATE (notebook);
if (! notebook->priv->selectors)
notebook->priv->cur_page = NULL;
priv->selectors = g_list_remove (priv->selectors, widget);
if (! priv->selectors)
priv->cur_page = NULL;
}
@ -512,7 +509,8 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
GType page_type,
gboolean has_page)
{
GList *list;
GimpColorNotebookPrivate *priv;
GList *list;
g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
g_return_val_if_fail (g_type_is_a (page_type, GIMP_TYPE_COLOR_SELECTOR),
@ -520,7 +518,9 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
g_return_val_if_fail (! g_type_is_a (page_type, GIMP_TYPE_COLOR_NOTEBOOK),
NULL);
for (list = notebook->priv->selectors; list; list = g_list_next (list))
priv = GET_PRIVATE (notebook);
for (list = priv->selectors; list; list = g_list_next (list))
{
GimpColorSelector *page = list->data;
@ -529,7 +529,7 @@ gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
if (has_page)
return GTK_WIDGET (page);
gtk_container_remove (GTK_CONTAINER (notebook->priv->notebook),
gtk_container_remove (GTK_CONTAINER (priv->notebook),
GTK_WIDGET (page));
return NULL;
@ -555,7 +555,7 @@ gimp_color_notebook_get_notebook (GimpColorNotebook *notebook)
{
g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
return notebook->priv->notebook;
return GET_PRIVATE (notebook)->notebook;
}
/**
@ -572,7 +572,7 @@ gimp_color_notebook_get_selectors (GimpColorNotebook *notebook)
{
g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
return notebook->priv->selectors;
return GET_PRIVATE (notebook)->selectors;
}
/**
@ -588,7 +588,7 @@ gimp_color_notebook_get_current_selector (GimpColorNotebook *notebook)
{
g_return_val_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook), NULL);
return notebook->priv->cur_page;
return GET_PRIVATE (notebook)->cur_page;
}
/**
@ -604,11 +604,14 @@ void
gimp_color_notebook_set_format (GimpColorNotebook *notebook,
const Babl *format)
{
GList *list;
GimpColorNotebookPrivate *priv;
GList *list;
g_return_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook));
for (list = notebook->priv->selectors; list; list = g_list_next (list))
priv = GET_PRIVATE (notebook);
for (list = priv->selectors; list; list = g_list_next (list))
{
GimpColorSelector *selector = list->data;
@ -634,12 +637,15 @@ gimp_color_notebook_set_simulation (GimpColorNotebook *notebook,
GimpColorRenderingIntent intent,
gboolean bpc)
{
GList *list;
GimpColorNotebookPrivate *priv;
GList *list;
g_return_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook));
g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
for (list = notebook->priv->selectors; list; list = g_list_next (list))
priv = GET_PRIVATE (notebook);
for (list = priv->selectors; list; list = g_list_next (list))
{
GimpColorSelector *selector = list->data;
@ -652,11 +658,14 @@ void
gimp_color_notebook_enable_simulation (GimpColorNotebook *notebook,
gboolean enabled)
{
GList *list;
GimpColorNotebookPrivate *priv;
GList *list;
g_return_if_fail (GIMP_IS_COLOR_NOTEBOOK (notebook));
for (list = notebook->priv->selectors; list; list = g_list_next (list))
priv = GET_PRIVATE (notebook);
for (list = priv->selectors; list; list = g_list_next (list))
{
GimpColorSelector *selector = list->data;

View File

@ -34,23 +34,8 @@
G_BEGIN_DECLS
#define GIMP_TYPE_COLOR_NOTEBOOK (gimp_color_notebook_get_type ())
#define GIMP_COLOR_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_NOTEBOOK, GimpColorNotebook))
#define GIMP_COLOR_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_NOTEBOOK, GimpColorNotebookClass))
#define GIMP_IS_COLOR_NOTEBOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_NOTEBOOK))
#define GIMP_IS_COLOR_NOTEBOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_NOTEBOOK))
#define GIMP_COLOR_NOTEBOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_NOTEBOOK, GimpColorNotebookClass))
typedef struct _GimpColorNotebookPrivate GimpColorNotebookPrivate;
typedef struct _GimpColorNotebookClass GimpColorNotebookClass;
struct _GimpColorNotebook
{
GimpColorSelector parent_instance;
GimpColorNotebookPrivate *priv;
};
#define GIMP_TYPE_COLOR_NOTEBOOK (gimp_color_notebook_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpColorNotebook, gimp_color_notebook, GIMP, COLOR_NOTEBOOK, GimpColorSelector)
struct _GimpColorNotebookClass
{
@ -68,8 +53,6 @@ struct _GimpColorNotebookClass
};
GType gimp_color_notebook_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_color_notebook_set_has_page (GimpColorNotebook *notebook,
GType page_type,
gboolean has_page);

View File

@ -30,23 +30,8 @@
G_BEGIN_DECLS
#define GIMP_TYPE_ENUM_COMBO_BOX (gimp_enum_combo_box_get_type ())
#define GIMP_ENUM_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBox))
#define GIMP_ENUM_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBoxClass))
#define GIMP_IS_ENUM_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ENUM_COMBO_BOX))
#define GIMP_IS_ENUM_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ENUM_COMBO_BOX))
#define GIMP_ENUM_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ENUM_COMBO_BOX, GimpEnumComboBoxClass))
typedef struct _GimpEnumComboBoxPrivate GimpEnumComboBoxPrivate;
typedef struct _GimpEnumComboBoxClass GimpEnumComboBoxClass;
struct _GimpEnumComboBox
{
GimpIntComboBox parent_instance;
GimpEnumComboBoxPrivate *priv;
};
#define GIMP_TYPE_ENUM_COMBO_BOX (gimp_enum_combo_box_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpEnumComboBox, gimp_enum_combo_box, GIMP, ENUM_COMBO_BOX, GimpIntComboBox)
struct _GimpEnumComboBoxClass
{
@ -64,8 +49,6 @@ struct _GimpEnumComboBoxClass
};
GType gimp_enum_combo_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_enum_combo_box_new (GType enum_type);
GtkWidget * gimp_enum_combo_box_new_with_model (GimpEnumStore *enum_store);

View File

@ -46,12 +46,14 @@ enum
};
struct _GimpEnumStorePrivate
typedef struct _GimpEnumStorePrivate
{
GEnumClass *enum_class;
};
GimpIntStore parent_instance;
#define GET_PRIVATE(obj) (((GimpEnumStore *) (obj))->priv)
GEnumClass *enum_class;
} GimpEnumStorePrivate;
#define GET_PRIVATE(obj) ((GimpEnumStorePrivate *) gimp_enum_store_get_instance_private ((GimpEnumStore *) (obj)))
static void gimp_enum_store_finalize (GObject *object);
@ -102,7 +104,6 @@ gimp_enum_store_class_init (GimpEnumStoreClass *klass)
static void
gimp_enum_store_init (GimpEnumStore *store)
{
store->priv = gimp_enum_store_get_instance_private (store);
}
static void

View File

@ -31,23 +31,8 @@
G_BEGIN_DECLS
#define GIMP_TYPE_ENUM_STORE (gimp_enum_store_get_type ())
#define GIMP_ENUM_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ENUM_STORE, GimpEnumStore))
#define GIMP_ENUM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ENUM_STORE, GimpEnumStoreClass))
#define GIMP_IS_ENUM_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ENUM_STORE))
#define GIMP_IS_ENUM_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ENUM_STORE))
#define GIMP_ENUM_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ENUM_STORE, GimpEnumStoreClass))
typedef struct _GimpEnumStorePrivate GimpEnumStorePrivate;
typedef struct _GimpEnumStoreClass GimpEnumStoreClass;
struct _GimpEnumStore
{
GimpIntStore parent_instance;
GimpEnumStorePrivate *priv;
};
#define GIMP_TYPE_ENUM_STORE (gimp_enum_store_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpEnumStore, gimp_enum_store, GIMP, ENUM_STORE, GimpIntStore)
struct _GimpEnumStoreClass
{
@ -64,8 +49,6 @@ struct _GimpEnumStoreClass
};
GType gimp_enum_store_get_type (void) G_GNUC_CONST;
GtkListStore * gimp_enum_store_new (GType enum_type);
GtkListStore * gimp_enum_store_new_with_range (GType enum_type,
gint minimum,

View File

@ -31,23 +31,8 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_FRAME (gimp_frame_get_type ())
#define GIMP_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FRAME, GimpFrame))
#define GIMP_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FRAME, GimpFrameClass))
#define GIMP_IS_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FRAME))
#define GIMP_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FRAME))
#define GIMP_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FRAME, GimpFrameClass))
typedef struct _GimpFramePrivate GimpFramePrivate;
typedef struct _GimpFrameClass GimpFrameClass;
struct _GimpFrame
{
GtkFrame parent_instance;
GimpFramePrivate *priv;
};
#define GIMP_TYPE_FRAME (gimp_frame_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpFrame, gimp_frame, GIMP, FRAME, GtkFrame)
struct _GimpFrameClass
{
@ -65,7 +50,6 @@ struct _GimpFrameClass
};
GType gimp_frame_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_frame_new (const gchar *label);

View File

@ -51,13 +51,15 @@ enum
};
struct _GimpIntStorePrivate
typedef struct _GimpIntStorePrivate
{
GtkListStore parent_instance;
GtkTreeIter *empty_iter;
GType user_data_type;
};
} GimpIntStorePrivate;
#define GET_PRIVATE(obj) (((GimpIntStore *) (obj))->priv)
#define GET_PRIVATE(obj) ((GimpIntStorePrivate *) gimp_int_store_get_instance_private ((GimpIntStore *) (obj)))
static void gimp_int_store_tree_model_init (GtkTreeModelIface *iface);
@ -134,7 +136,6 @@ gimp_int_store_tree_model_init (GtkTreeModelIface *iface)
static void
gimp_int_store_init (GimpIntStore *store)
{
store->priv = gimp_int_store_get_instance_private (store);
}
static void

View File

@ -53,23 +53,8 @@ typedef enum
} GimpIntStoreColumns;
#define GIMP_TYPE_INT_STORE (gimp_int_store_get_type ())
#define GIMP_INT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INT_STORE, GimpIntStore))
#define GIMP_INT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INT_STORE, GimpIntStoreClass))
#define GIMP_IS_INT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INT_STORE))
#define GIMP_IS_INT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INT_STORE))
#define GIMP_INT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INT_STORE, GimpIntStoreClass))
typedef struct _GimpIntStorePrivate GimpIntStorePrivate;
typedef struct _GimpIntStoreClass GimpIntStoreClass;
struct _GimpIntStore
{
GtkListStore parent_instance;
GimpIntStorePrivate *priv;
};
#define GIMP_TYPE_INT_STORE (gimp_int_store_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpIntStore, gimp_int_store, GIMP, INT_STORE, GtkListStore)
struct _GimpIntStoreClass
{
@ -87,8 +72,6 @@ struct _GimpIntStoreClass
};
GType gimp_int_store_get_type (void) G_GNUC_CONST;
GtkListStore * gimp_int_store_new (const gchar *first_label,
gint first_value,
...) G_GNUC_NULL_TERMINATED;

View File

@ -29,24 +29,8 @@
G_BEGIN_DECLS
#define GIMP_TYPE_UNIT_COMBO_BOX (gimp_unit_combo_box_get_type ())
#define GIMP_UNIT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_UNIT_COMBO_BOX, GimpUnitComboBox))
#define GIMP_UNIT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_UNIT_COMBO_BOX, GimpUnitComboBoxClass))
#define GIMP_IS_UNIT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_UNIT_COMBO_BOX))
#define GIMP_IS_UNIT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_UNIT_COMBO_BOX))
#define GIMP_UNIT_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_UNIT_COMBO_BOX, GimpUnitComboBoxClass))
typedef struct _GimpUnitComboBoxPrivate GimpUnitComboBoxPrivate;
typedef struct _GimpUnitComboBoxClass GimpUnitComboBoxClass;
struct _GimpUnitComboBox
{
GtkComboBox parent_instance;
GimpUnitComboBoxPrivate *priv;
};
#define GIMP_TYPE_UNIT_COMBO_BOX (gimp_unit_combo_box_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpUnitComboBox, gimp_unit_combo_box, GIMP, UNIT_COMBO_BOX, GtkComboBox)
struct _GimpUnitComboBoxClass
{
GtkComboBoxClass parent_class;
@ -63,8 +47,6 @@ struct _GimpUnitComboBoxClass
};
GType gimp_unit_combo_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_unit_combo_box_new (void);
GtkWidget * gimp_unit_combo_box_new_with_model (GimpUnitStore *model);

View File

@ -49,7 +49,7 @@ enum
PROP_LONG_FORMAT
};
struct _GimpUnitStorePrivate
typedef struct _GimpUnitStorePrivate
{
gint num_values;
gboolean has_pixels;
@ -62,9 +62,9 @@ struct _GimpUnitStorePrivate
gdouble *resolutions;
GimpUnitID synced_ID;
};
} GimpUnitStorePrivate;
#define GET_PRIVATE(obj) (((GimpUnitStore *) (obj))->priv)
#define GET_PRIVATE(obj) ((GimpUnitStorePrivate *) gimp_unit_store_get_instance_private ((GimpUnitStore *) (obj)))
static void gimp_unit_store_tree_model_init (GtkTreeModelIface *iface);
@ -186,9 +186,7 @@ gimp_unit_store_init (GimpUnitStore *store)
{
GimpUnitStorePrivate *private;
store->priv = gimp_unit_store_get_instance_private (store);
private = store->priv;
private = GET_PRIVATE (store);
private->has_pixels = TRUE;
private->has_percent = FALSE;

View File

@ -46,23 +46,8 @@ enum
};
#define GIMP_TYPE_UNIT_STORE (gimp_unit_store_get_type ())
#define GIMP_UNIT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_UNIT_STORE, GimpUnitStore))
#define GIMP_UNIT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_UNIT_STORE, GimpUnitStoreClass))
#define GIMP_IS_UNIT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_UNIT_STORE))
#define GIMP_IS_UNIT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_UNIT_STORE))
#define GIMP_UNIT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_UNIT_STORE, GimpUnitStoreClass))
typedef struct _GimpUnitStorePrivate GimpUnitStorePrivate;
typedef struct _GimpUnitStoreClass GimpUnitStoreClass;
struct _GimpUnitStore
{
GObject parent_instance;
GimpUnitStorePrivate *priv;
};
#define GIMP_TYPE_UNIT_STORE (gimp_unit_store_get_type ())
G_DECLARE_DERIVABLE_TYPE (GimpUnitStore, gimp_unit_store, GIMP, UNIT_STORE, GObject)
struct _GimpUnitStoreClass
{
@ -80,8 +65,6 @@ struct _GimpUnitStoreClass
};
GType gimp_unit_store_get_type (void) G_GNUC_CONST;
GimpUnitStore * gimp_unit_store_new (gint num_values);
void gimp_unit_store_set_has_pixels (GimpUnitStore *store,