app: make sure GimpToolPreset got the "gimp" construct property passed

and pass a Gimp when creating the preset editor's local model.
This commit is contained in:
Michael Natterer 2010-04-11 16:18:21 +02:00
parent 0f47beff78
commit 4c4c861aa1
2 changed files with 31 additions and 2 deletions

View File

@ -45,6 +45,9 @@ enum
static void gimp_tool_preset_config_iface_init (GimpConfigInterface *iface);
static GObject * gimp_tool_preset_constructor (GType type,
guint n_params,
GObjectConstructParam *params);
static void gimp_tool_preset_finalize (GObject *object);
static void gimp_tool_preset_set_property (GObject *object,
guint property_id,
@ -82,6 +85,7 @@ gimp_tool_preset_class_init (GimpToolPresetClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpDataClass *data_class = GIMP_DATA_CLASS (klass);
object_class->constructor = gimp_tool_preset_constructor;
object_class->finalize = gimp_tool_preset_finalize;
object_class->set_property = gimp_tool_preset_set_property;
object_class->get_property = gimp_tool_preset_get_property;
@ -120,6 +124,23 @@ gimp_tool_preset_init (GimpToolPreset *tool_preset)
tool_preset->tool_options = NULL;
}
static GObject *
gimp_tool_preset_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GimpToolPreset *preset;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
preset = GIMP_TOOL_PRESET (object);
g_assert (GIMP_IS_GIMP (preset->gimp));
return object;
}
static void
gimp_tool_preset_finalize (GObject *object)
{

View File

@ -78,7 +78,6 @@ gimp_tool_preset_editor_class_init (GimpToolPresetEditorClass *klass)
static void
gimp_tool_preset_editor_init (GimpToolPresetEditor *editor)
{
editor->tool_preset_model = g_object_new (GIMP_TYPE_TOOL_PRESET, NULL);
}
static GObject *
@ -86,10 +85,19 @@ gimp_tool_preset_editor_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
GObject *object;
GimpToolPresetEditor *editor;
GimpDataEditor *data_editor;
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
editor = GIMP_TOOL_PRESET_EDITOR (object);
data_editor = GIMP_DATA_EDITOR (editor);
editor->tool_preset_model = g_object_new (GIMP_TYPE_TOOL_PRESET,
"gimp", data_editor->context->gimp,
NULL);
gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE);
return object;