Use G_DEFINE_BOXED_TYPE for all boxed types

We actually need a couple more macros for registering GValue
transformation functions. Those should be added to upstream
GLib.
This commit is contained in:
Emmanuele Bassi
2010-10-08 15:21:57 +01:00
parent 09a830d294
commit 7dd09e2186
13 changed files with 123 additions and 280 deletions

View File

@ -87,13 +87,6 @@
#include "clutter-bezier.h"
#include "clutter-private.h"
static void clutter_path_register_transforms (GType type);
G_DEFINE_TYPE_WITH_CODE (ClutterPath,
clutter_path,
G_TYPE_INITIALLY_UNOWNED,
clutter_path_register_transforms (g_define_type_id));
#define CLUTTER_PATH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_PATH, \
ClutterPathPrivate))
@ -143,6 +136,21 @@ static void clutter_path_node_full_free (ClutterPathNodeFull *node);
static void clutter_path_finalize (GObject *object);
static void clutter_value_transform_path_string (const GValue *src,
GValue *dest);
static void clutter_value_transform_string_path (const GValue *src,
GValue *dest);
G_DEFINE_BOXED_TYPE (ClutterPathNode, clutter_path_node,
clutter_path_node_copy,
clutter_path_node_free);
G_DEFINE_TYPE_WITH_CODE (ClutterPath,
clutter_path,
G_TYPE_INITIALLY_UNOWNED,
CLUTTER_REGISTER_VALUE_TRANSFORM_TO (G_TYPE_STRING, clutter_value_transform_path_string)
CLUTTER_REGISTER_VALUE_TRANSFORM_FROM (G_TYPE_STRING, clutter_value_transform_string_path));
static void
clutter_path_get_property (GObject *gobject,
guint prop_id,
@ -240,16 +248,6 @@ clutter_value_transform_string_path (const GValue *src,
g_value_take_object (dest, new_path);
}
static void
clutter_path_register_transforms (GType type)
{
g_value_register_transform_func (type, G_TYPE_STRING,
clutter_value_transform_path_string);
g_value_register_transform_func (G_TYPE_STRING, type,
clutter_value_transform_string_path);
}
static void
clutter_path_finalize (GObject *object)
{
@ -1583,19 +1581,3 @@ clutter_path_node_equal (const ClutterPathNode *node_a,
return TRUE;
}
GType
clutter_path_node_get_type (void)
{
static GType our_type = 0;
if (G_UNLIKELY (!our_type))
{
our_type =
g_boxed_type_register_static (I_("ClutterPathNode"),
(GBoxedCopyFunc) clutter_path_node_copy,
(GBoxedFreeFunc) clutter_path_node_free);
}
return our_type;
}