added utility function gimp_container_view_install_properties() to reduce

2005-08-16  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontainerview.[ch]: added utility function
	gimp_container_view_install_properties() to reduce code duplication
	in classes implementing this interface.

	* app/widgets/gimpcontainerbox.c
	* app/widgets/gimpcontainercombobox.c
	* app/widgets/gimpcontainerentry.c: changed accordingly.
This commit is contained in:
Sven Neumann 2005-08-16 11:40:04 +00:00 committed by Sven Neumann
parent f2a786ec99
commit 19e7e076dc
6 changed files with 57 additions and 56 deletions

View file

@ -1,3 +1,13 @@
2005-08-16 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontainerview.[ch]: added utility function
gimp_container_view_install_properties() to reduce code duplication
in classes implementing this interface.
* app/widgets/gimpcontainerbox.c
* app/widgets/gimpcontainercombobox.c
* app/widgets/gimpcontainerentry.c: changed accordingly.
2005-08-16 Sven Neumann <sven@gimp.org>
* configure.in

View file

@ -112,21 +112,7 @@ gimp_container_box_class_init (GimpContainerBoxClass *klass)
object_class->set_property = gimp_container_view_set_property;
object_class->get_property = gimp_container_view_get_property;
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTAINER,
"container");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTEXT,
"context");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
"reorderable");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_SIZE,
"preview-size");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH,
"preview-border-width");
gimp_container_view_install_properties (object_class);
}
static void

View file

@ -127,21 +127,7 @@ gimp_container_combo_box_class_init (GimpContainerComboBoxClass *klass)
object_class->set_property = gimp_container_view_set_property;
object_class->get_property = gimp_container_view_get_property;
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTAINER,
"container");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTEXT,
"context");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
"reorderable");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_SIZE,
"preview-size");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH,
"preview-border-width");
gimp_container_view_install_properties (object_class);
}
static void

View file

@ -123,21 +123,7 @@ gimp_container_entry_class_init (GimpContainerEntryClass *klass)
object_class->set_property = gimp_container_view_set_property;
object_class->get_property = gimp_container_view_get_property;
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTAINER,
"container");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_CONTEXT,
"context");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
"reorderable");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_SIZE,
"preview-size");
g_object_class_override_property (object_class,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH,
"preview-border-width");
gimp_container_view_install_properties (object_class);
}
static void

View file

@ -291,6 +291,37 @@ gimp_container_view_get_private (GimpContainerView *view)
return private;
}
/**
* gimp_container_view_install_properties:
* @klass: the class structure for a type deriving from #GObject
*
* Installs the necessary properties for a class implementing
* #GimpContainerView. A #GimpContainerViewProp property is installed
* for each property, using the values from the #GimpContainerViewProp
* enumeration. The caller must make sure itself that the enumeration
* values don't collide with some other property values they
* are using (that's what %GIMP_CONTAINER_VIEW_PROP_LAST is good for).
**/
void
gimp_container_view_install_properties (GObjectClass *klass)
{
g_object_class_override_property (klass,
GIMP_CONTAINER_VIEW_PROP_CONTAINER,
"container");
g_object_class_override_property (klass,
GIMP_CONTAINER_VIEW_PROP_CONTEXT,
"context");
g_object_class_override_property (klass,
GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
"reorderable");
g_object_class_override_property (klass,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_SIZE,
"preview-size");
g_object_class_override_property (klass,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH,
"preview-border-width");
}
GimpContainer *
gimp_container_view_get_container (GimpContainerView *view)
{

View file

@ -23,15 +23,16 @@
#define __GIMP_CONTAINER_VIEW_H__
enum
typedef enum
{
GIMP_CONTAINER_VIEW_PROP_0,
GIMP_CONTAINER_VIEW_PROP_CONTAINER,
GIMP_CONTAINER_VIEW_PROP_CONTEXT,
GIMP_CONTAINER_VIEW_PROP_REORDERABLE,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_SIZE,
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH
};
GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH,
GIMP_CONTAINER_VIEW_PROP_LAST = GIMP_CONTAINER_VIEW_PROP_PREVIEW_BORDER_WIDTH
} GimpContainerViewProp;
#define GIMP_TYPE_CONTAINER_VIEW (gimp_container_view_interface_get_type ())
@ -131,14 +132,15 @@ void gimp_container_view_item_context (GimpContainerView *view,
/* convenience functions */
void gimp_container_view_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
void gimp_container_view_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
void gimp_container_view_install_properties (GObjectClass *klass);
void gimp_container_view_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
void gimp_container_view_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
#endif /* __GIMP_CONTAINER_VIEW_H__ */