mirror of https://github.com/GNOME/gimp.git
added CONSTRUCT_ONLY "data-factory" property. Removed
2004-09-26 Michael Natterer <mitch@gimp.org> * app/widgets/gimpdataeditor.[ch]: added CONSTRUCT_ONLY "data-factory" property. Removed gimp_data_editor_construct(). * app/widgets/gimpbrusheditor.c * app/widgets/gimpgradienteditor.c * app/widgets/gimppaletteeditor.c: pass the construct parameters to g_object_new().
This commit is contained in:
parent
07e65b01cd
commit
db85b16927
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004-09-26 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/widgets/gimpdataeditor.[ch]: added CONSTRUCT_ONLY
|
||||||
|
"data-factory" property. Removed gimp_data_editor_construct().
|
||||||
|
|
||||||
|
* app/widgets/gimpbrusheditor.c
|
||||||
|
* app/widgets/gimpgradienteditor.c
|
||||||
|
* app/widgets/gimppaletteeditor.c: pass the construct parameters
|
||||||
|
to g_object_new().
|
||||||
|
|
||||||
2004-09-26 Sven Neumann <sven@gimp.org>
|
2004-09-26 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpcolorframe.c: changed label alignment to be more
|
* app/widgets/gimpcolorframe.c: changed label alignment to be more
|
||||||
|
|
|
@ -289,19 +289,9 @@ gimp_brush_editor_set_data (GimpDataEditor *editor,
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_brush_editor_new (Gimp *gimp)
|
gimp_brush_editor_new (Gimp *gimp)
|
||||||
{
|
{
|
||||||
GimpBrushEditor *editor;
|
return g_object_new (GIMP_TYPE_BRUSH_EDITOR,
|
||||||
|
"data-factory", gimp->brush_factory,
|
||||||
editor = g_object_new (GIMP_TYPE_BRUSH_EDITOR, NULL);
|
NULL);
|
||||||
|
|
||||||
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
|
|
||||||
gimp->brush_factory,
|
|
||||||
NULL, NULL, NULL))
|
|
||||||
{
|
|
||||||
g_object_unref (editor);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GTK_WIDGET (editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpdataeditor.c
|
* gimpdataeditor.c
|
||||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
* Copyright (C) 2002-2004 Michael Natterer <mitch@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -43,11 +43,22 @@
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_DATA_FACTORY
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gimp_data_editor_class_init (GimpDataEditorClass *klass);
|
static void gimp_data_editor_class_init (GimpDataEditorClass *klass);
|
||||||
static void gimp_data_editor_init (GimpDataEditor *view);
|
static void gimp_data_editor_init (GimpDataEditor *view);
|
||||||
|
|
||||||
static void gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface);
|
static void gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface);
|
||||||
|
|
||||||
|
static void gimp_data_editor_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec);
|
||||||
static void gimp_data_editor_dispose (GObject *object);
|
static void gimp_data_editor_dispose (GObject *object);
|
||||||
|
|
||||||
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
|
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
|
||||||
|
@ -120,9 +131,17 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
object_class->dispose = gimp_data_editor_dispose;
|
object_class->set_property = gimp_data_editor_set_property;
|
||||||
|
object_class->dispose = gimp_data_editor_dispose;
|
||||||
|
|
||||||
klass->set_data = gimp_data_editor_real_set_data;
|
klass->set_data = gimp_data_editor_real_set_data;
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class, PROP_DATA_FACTORY,
|
||||||
|
g_param_spec_object ("data-factory",
|
||||||
|
NULL, NULL,
|
||||||
|
GIMP_TYPE_DATA_FACTORY,
|
||||||
|
G_PARAM_WRITABLE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -133,8 +152,7 @@ gimp_data_editor_init (GimpDataEditor *editor)
|
||||||
editor->data_editable = FALSE;
|
editor->data_editable = FALSE;
|
||||||
|
|
||||||
editor->name_entry = gtk_entry_new ();
|
editor->name_entry = gtk_entry_new ();
|
||||||
gtk_box_pack_start (GTK_BOX (editor), editor->name_entry,
|
gtk_box_pack_start (GTK_BOX (editor), editor->name_entry, FALSE, FALSE, 0);
|
||||||
FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (editor->name_entry);
|
gtk_widget_show (editor->name_entry);
|
||||||
|
|
||||||
g_signal_connect (editor->name_entry, "activate",
|
g_signal_connect (editor->name_entry, "activate",
|
||||||
|
@ -168,6 +186,25 @@ gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface)
|
||||||
docked_iface->get_aux_info = gimp_data_editor_get_aux_info;
|
docked_iface->get_aux_info = gimp_data_editor_get_aux_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_data_editor_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GimpDataEditor *editor = GIMP_DATA_EDITOR (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_DATA_FACTORY:
|
||||||
|
editor->data_factory = g_value_get_object (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_data_editor_dispose (GObject *object)
|
gimp_data_editor_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
|
@ -266,38 +303,6 @@ gimp_data_editor_real_set_data (GimpDataEditor *editor,
|
||||||
gtk_widget_set_sensitive (editor->name_entry, editor->data_editable);
|
gtk_widget_set_sensitive (editor->name_entry, editor->data_editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_data_editor_construct (GimpDataEditor *editor,
|
|
||||||
GimpDataFactory *data_factory,
|
|
||||||
GimpMenuFactory *menu_factory,
|
|
||||||
const gchar *menu_identifier,
|
|
||||||
const gchar *ui_identifier)
|
|
||||||
{
|
|
||||||
GimpData *data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_DATA_EDITOR (editor), FALSE);
|
|
||||||
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (data_factory), FALSE);
|
|
||||||
g_return_val_if_fail (menu_factory == NULL ||
|
|
||||||
GIMP_IS_MENU_FACTORY (menu_factory), FALSE);
|
|
||||||
g_return_val_if_fail (menu_factory == NULL ||
|
|
||||||
menu_identifier != NULL, FALSE);
|
|
||||||
|
|
||||||
editor->data_factory = data_factory;
|
|
||||||
|
|
||||||
if (menu_factory && menu_identifier && ui_identifier)
|
|
||||||
gimp_editor_create_menu (GIMP_EDITOR (editor),
|
|
||||||
menu_factory, menu_identifier, ui_identifier,
|
|
||||||
editor);
|
|
||||||
|
|
||||||
data = (GimpData *)
|
|
||||||
gimp_context_get_by_type (gimp_get_user_context (data_factory->gimp),
|
|
||||||
data_factory->container->children_type);
|
|
||||||
|
|
||||||
gimp_data_editor_set_data (editor, data);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_data_editor_set_data (GimpDataEditor *editor,
|
gimp_data_editor_set_data (GimpDataEditor *editor,
|
||||||
GimpData *data)
|
GimpData *data)
|
||||||
|
@ -377,4 +382,3 @@ gimp_data_editor_save_dirty (GimpDataEditor *editor)
|
||||||
if (data && data->dirty && data->writable)
|
if (data && data->dirty && data->writable)
|
||||||
gimp_data_factory_data_save_single (editor->data_factory, data);
|
gimp_data_factory_data_save_single (editor->data_factory, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpdataeditor.h
|
* gimpdataeditor.h
|
||||||
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
* Copyright (C) 2002-2004 Michael Natterer <mitch@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
#define GIMP_DATA_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DATA_EDITOR, GimpDataEditorClass))
|
#define GIMP_DATA_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DATA_EDITOR, GimpDataEditorClass))
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GimpDataEditorClass GimpDataEditorClass;
|
typedef struct _GimpDataEditorClass GimpDataEditorClass;
|
||||||
|
|
||||||
struct _GimpDataEditor
|
struct _GimpDataEditor
|
||||||
{
|
{
|
||||||
|
@ -55,23 +55,16 @@ struct _GimpDataEditorClass
|
||||||
GimpEditorClass parent_class;
|
GimpEditorClass parent_class;
|
||||||
|
|
||||||
/* virtual functions */
|
/* virtual functions */
|
||||||
|
|
||||||
void (* set_data) (GimpDataEditor *editor,
|
void (* set_data) (GimpDataEditor *editor,
|
||||||
GimpData *data);
|
GimpData *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_data_editor_get_type (void) G_GNUC_CONST;
|
GType gimp_data_editor_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean gimp_data_editor_construct (GimpDataEditor *editor,
|
void gimp_data_editor_set_data (GimpDataEditor *editor,
|
||||||
GimpDataFactory *data_factory,
|
GimpData *data);
|
||||||
GimpMenuFactory *menu_factory,
|
GimpData * gimp_data_editor_get_data (GimpDataEditor *editor);
|
||||||
const gchar *menu_identifier,
|
|
||||||
const gchar *ui_identifier);
|
|
||||||
|
|
||||||
void gimp_data_editor_set_data (GimpDataEditor *editor,
|
|
||||||
GimpData *data);
|
|
||||||
GimpData * gimp_data_editor_get_data (GimpDataEditor *editor);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_DATA_EDITOR_H__ */
|
#endif /* __GIMP_DATA_EDITOR_H__ */
|
||||||
|
|
|
@ -507,20 +507,12 @@ GtkWidget *
|
||||||
gimp_gradient_editor_new (Gimp *gimp,
|
gimp_gradient_editor_new (Gimp *gimp,
|
||||||
GimpMenuFactory *menu_factory)
|
GimpMenuFactory *menu_factory)
|
||||||
{
|
{
|
||||||
GimpGradientEditor *editor;
|
return g_object_new (GIMP_TYPE_GRADIENT_EDITOR,
|
||||||
|
"menu-factory", menu_factory,
|
||||||
editor = g_object_new (GIMP_TYPE_GRADIENT_EDITOR, NULL);
|
"menu-identifier", "<GradientEditor>",
|
||||||
|
"ui-path", "/gradient-editor-popup",
|
||||||
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
|
"data-factory", gimp->gradient_factory,
|
||||||
gimp->gradient_factory,
|
NULL);
|
||||||
menu_factory, "<GradientEditor>",
|
|
||||||
"/gradient-editor-popup"))
|
|
||||||
{
|
|
||||||
g_object_unref (editor);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GTK_WIDGET (editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -500,20 +500,12 @@ GtkWidget *
|
||||||
gimp_palette_editor_new (Gimp *gimp,
|
gimp_palette_editor_new (Gimp *gimp,
|
||||||
GimpMenuFactory *menu_factory)
|
GimpMenuFactory *menu_factory)
|
||||||
{
|
{
|
||||||
GimpPaletteEditor *editor;
|
return g_object_new (GIMP_TYPE_PALETTE_EDITOR,
|
||||||
|
"menu-factory", menu_factory,
|
||||||
editor = g_object_new (GIMP_TYPE_PALETTE_EDITOR, NULL);
|
"menu-identifier", "<PaletteEditor>",
|
||||||
|
"ui-path", "/palette-editor-popup",
|
||||||
if (! gimp_data_editor_construct (GIMP_DATA_EDITOR (editor),
|
"data-factory", gimp->palette_factory,
|
||||||
gimp->palette_factory,
|
NULL);
|
||||||
menu_factory, "<PaletteEditor>",
|
|
||||||
"/palette-editor-popup"))
|
|
||||||
{
|
|
||||||
g_object_unref (editor);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GTK_WIDGET (editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue