Commit 6b40c7f3 authored by Ell's avatar Ell

libgimpcolor: port all interfaces to G_DEFINE_INTERFACE()

... instead of calling g_type_register_static() ourselves.

Keep the old foo_interface_get_type() (replaced with
foo_get_type()) around as deprecated functions, to maintain ABI
compatibility.  They will be removed in a separate commit in
master, so that this commit can be easily cherry-picked to
gimp-2-10.
parent cdd96059
......@@ -21,6 +21,7 @@ EXPORTS
gimp_cmyka_set_uchar
gimp_color_managed_get_color_profile
gimp_color_managed_get_icc_profile
gimp_color_managed_get_type
gimp_color_managed_interface_get_type
gimp_color_managed_profile_changed
gimp_color_profile_get_copyright
......
......@@ -46,61 +46,39 @@ enum
};
static void gimp_color_managed_base_init (GimpColorManagedInterface *iface);
G_DEFINE_INTERFACE (GimpColorManaged, gimp_color_managed, G_TYPE_OBJECT)
static guint gimp_color_managed_signals[LAST_SIGNAL] = { 0 };
/* private functions */
GType
gimp_color_managed_interface_get_type (void)
{
static GType iface_type = 0;
if (! iface_type)
{
const GTypeInfo iface_info =
{
sizeof (GimpColorManagedInterface),
(GBaseInitFunc) gimp_color_managed_base_init,
(GBaseFinalizeFunc) NULL,
};
iface_type = g_type_register_static (G_TYPE_INTERFACE,
"GimpColorManagedInterface",
&iface_info, 0);
g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
}
return iface_type;
return gimp_color_managed_get_type ();
}
static void
gimp_color_managed_base_init (GimpColorManagedInterface *iface)
gimp_color_managed_default_init (GimpColorManagedInterface *iface)
{
static gboolean initialized = FALSE;
if (! initialized)
{
gimp_color_managed_signals[PROFILE_CHANGED] =
g_signal_new ("profile-changed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorManagedInterface,
profile_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
iface->get_icc_profile = NULL;
iface->get_color_profile = NULL;
iface->profile_changed = NULL;
initialized = TRUE;
}
gimp_color_managed_signals[PROFILE_CHANGED] =
g_signal_new ("profile-changed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorManagedInterface,
profile_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
/* public functions */
/**
* gimp_color_managed_get_icc_profile:
* @managed: an object the implements the #GimpColorManaged interface
......
......@@ -31,7 +31,7 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_TYPE_COLOR_MANAGED (gimp_color_managed_interface_get_type ())
#define GIMP_TYPE_COLOR_MANAGED (gimp_color_managed_get_type ())
#define GIMP_IS_COLOR_MANAGED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_MANAGED))
#define GIMP_COLOR_MANAGED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_MANAGED, GimpColorManaged))
#define GIMP_COLOR_MANAGED_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_COLOR_MANAGED, GimpColorManagedInterface))
......@@ -55,6 +55,9 @@ struct _GimpColorManagedInterface
};
GType gimp_color_managed_get_type (void) G_GNUC_CONST;
GIMP_DEPRECATED_FOR (gimp_color_managed_get_type)
GType gimp_color_managed_interface_get_type (void) G_GNUC_CONST;
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
......
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