GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 692863b3 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added "data" property.

2004-09-26  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdataeditor.[ch]: added "data" property.

	* app/widgets/gimpbrusheditor.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimppaletteeditor.c: pass the current data to
	g_object_new() so we never end up with initially empty editors.
parent db85b169
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdataeditor.[ch]: added "data" property.
* app/widgets/gimpbrusheditor.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimppaletteeditor.c: pass the current data to
g_object_new() so we never end up with initially empty editors.
2004-09-26 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdataeditor.[ch]: added CONSTRUCT_ONLY
......
......@@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpcontext.h"
#include "gimpbrusheditor.h"
#include "gimpenumwidgets.h"
......@@ -289,8 +290,15 @@ gimp_brush_editor_set_data (GimpDataEditor *editor,
GtkWidget *
gimp_brush_editor_new (Gimp *gimp)
{
GimpBrush *brush;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
brush = gimp_context_get_brush (gimp_get_user_context (gimp));
return g_object_new (GIMP_TYPE_BRUSH_EDITOR,
"data-factory", gimp->brush_factory,
"data", brush,
NULL);
}
......
......@@ -46,7 +46,8 @@
enum
{
PROP_0,
PROP_DATA_FACTORY
PROP_DATA_FACTORY,
PROP_DATA
};
......@@ -59,6 +60,10 @@ static void gimp_data_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_data_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
......@@ -132,6 +137,7 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gimp_data_editor_set_property;
object_class->get_property = gimp_data_editor_get_property;
object_class->dispose = gimp_data_editor_dispose;
klass->set_data = gimp_data_editor_real_set_data;
......@@ -140,8 +146,14 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
g_param_spec_object ("data-factory",
NULL, NULL,
GIMP_TYPE_DATA_FACTORY,
G_PARAM_WRITABLE |
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class, PROP_DATA,
g_param_spec_object ("data",
NULL, NULL,
GIMP_TYPE_DATA,
G_PARAM_READWRITE));
}
static void
......@@ -199,6 +211,32 @@ gimp_data_editor_set_property (GObject *object,
case PROP_DATA_FACTORY:
editor->data_factory = g_value_get_object (value);
break;
case PROP_DATA:
gimp_data_editor_set_data (editor,
(GimpData *) g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_data_editor_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
switch (property_id)
{
case PROP_DATA_FACTORY:
g_value_set_object (value, editor->data_factory);
break;
case PROP_DATA:
g_value_set_object (value, editor->data);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -314,7 +352,11 @@ gimp_data_editor_set_data (GimpDataEditor *editor,
editor->data_factory->container->children_type));
if (editor->data != data)
GIMP_DATA_EDITOR_GET_CLASS (editor)->set_data (editor, data);
{
GIMP_DATA_EDITOR_GET_CLASS (editor)->set_data (editor, data);
g_object_notify (G_OBJECT (editor), "data");
}
}
GimpData *
......
......@@ -507,11 +507,18 @@ GtkWidget *
gimp_gradient_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory)
{
GimpGradient *gradient;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gradient = gimp_context_get_gradient (gimp_get_user_context (gimp));
return g_object_new (GIMP_TYPE_GRADIENT_EDITOR,
"menu-factory", menu_factory,
"menu-identifier", "<GradientEditor>",
"ui-path", "/gradient-editor-popup",
"data-factory", gimp->gradient_factory,
"data", gradient,
NULL);
}
......
......@@ -500,11 +500,18 @@ GtkWidget *
gimp_palette_editor_new (Gimp *gimp,
GimpMenuFactory *menu_factory)
{
GimpPalette *palette;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
palette = gimp_context_get_palette (gimp_get_user_context (gimp));
return g_object_new (GIMP_TYPE_PALETTE_EDITOR,
"menu-factory", menu_factory,
"menu-identifier", "<PaletteEditor>",
"ui-path", "/palette-editor-popup",
"data-factory", gimp->palette_factory,
"data", palette,
NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment