made "stock-id" a property of the GimpViewable object.

2003-04-04  Sven Neumann  <sven@gimp.org>

	* app/core/gimpviewable.c: made "stock-id" a property of the
	GimpViewable object.
This commit is contained in:
Sven Neumann 2003-04-04 17:32:08 +00:00 committed by Sven Neumann
parent fc6b33190a
commit 1ba5fb8d35
2 changed files with 64 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2003-04-04 Sven Neumann <sven@gimp.org>
* app/core/gimpviewable.c: made stock_id a property of the
GimpViewable object.
2003-04-04 Sven Neumann <sven@gimp.org>
* etc/Makefile.am

View File

@ -27,10 +27,18 @@
#include "base/temp-buf.h"
#include "config/gimpconfig-params.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
enum
{
PROP_0,
PROP_STOCK_ID
};
enum
{
INVALIDATE_PREVIEW,
@ -42,7 +50,15 @@ enum
static void gimp_viewable_class_init (GimpViewableClass *klass);
static void gimp_viewable_init (GimpViewable *viewable);
static void gimp_viewable_finalize (GObject *object);
static void gimp_viewable_finalize (GObject *object);
static void gimp_viewable_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_viewable_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static gsize gimp_viewable_get_memsize (GimpObject *object);
@ -125,6 +141,8 @@ gimp_viewable_class_init (GimpViewableClass *klass)
G_TYPE_NONE, 0);
object_class->finalize = gimp_viewable_finalize;
object_class->get_property = gimp_viewable_get_property;
object_class->set_property = gimp_viewable_set_property;
gimp_object_class->get_memsize = gimp_viewable_get_memsize;
@ -138,6 +156,9 @@ gimp_viewable_class_init (GimpViewableClass *klass)
klass->get_popup_size = NULL;
klass->get_preview = NULL;
klass->get_new_preview = NULL;
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_STOCK_ID, "stock-id",
NULL, NULL, 0);
}
static void
@ -162,6 +183,41 @@ gimp_viewable_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_viewable_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
case PROP_STOCK_ID:
gimp_viewable_set_stock_id (GIMP_VIEWABLE (object),
g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_viewable_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
switch (property_id)
{
case PROP_STOCK_ID:
g_value_set_string (value, GIMP_VIEWABLE (object)->stock_id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static gsize
gimp_viewable_get_memsize (GimpObject *object)
{
@ -510,4 +566,6 @@ gimp_viewable_set_stock_id (GimpViewable *viewable,
g_free (viewable->stock_id);
viewable->stock_id = g_strdup (stock_id);
g_object_notify (G_OBJECT (viewable), "stock-id");
}