From aad601cdd13d8fc64913b31618403f9021715121 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Mon, 12 Jul 2010 18:00:48 +0000 Subject: [libdocument] Use G_DEFINE_INTERFACE() macro to define EvAnnotationMarkup iface --- diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c index b38fd0a..21ffc0a 100644 --- a/libdocument/ev-annotation.c +++ b/libdocument/ev-annotation.c @@ -24,9 +24,9 @@ #include "ev-annotation.h" -static void ev_annotation_markup_iface_base_init (EvAnnotationMarkupIface *iface); -static void ev_annotation_text_markup_iface_init (EvAnnotationMarkupIface *iface); -static void ev_annotation_attachment_markup_iface_init (EvAnnotationMarkupIface *iface); +static void ev_annotation_markup_default_init (EvAnnotationMarkupInterface *iface); +static void ev_annotation_text_markup_iface_init (EvAnnotationMarkupInterface *iface); +static void ev_annotation_attachment_markup_iface_init (EvAnnotationMarkupInterface *iface); enum { PROP_0, @@ -38,30 +38,7 @@ enum { }; G_DEFINE_ABSTRACT_TYPE (EvAnnotation, ev_annotation, G_TYPE_OBJECT) -GType -ev_annotation_markup_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) { - GType g_define_type_id; - const GTypeInfo our_info = { - sizeof (EvAnnotationMarkupIface), - (GBaseInitFunc) ev_annotation_markup_iface_base_init, - NULL, - }; - - g_define_type_id = g_type_register_static (G_TYPE_INTERFACE, - "EvAnnotationMarkup", - &our_info, (GTypeFlags)0); - g_type_interface_add_prerequisite (g_define_type_id, EV_TYPE_ANNOTATION); - - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - +G_DEFINE_INTERFACE (EvAnnotationMarkup, ev_annotation_markup, EV_TYPE_ANNOTATION) G_DEFINE_TYPE_WITH_CODE (EvAnnotationText, ev_annotation_text, EV_TYPE_ANNOTATION, { G_IMPLEMENT_INTERFACE (EV_TYPE_ANNOTATION_MARKUP, @@ -125,7 +102,7 @@ typedef struct { } EvAnnotationMarkupProps; static void -ev_annotation_markup_iface_base_init (EvAnnotationMarkupIface *iface) +ev_annotation_markup_default_init (EvAnnotationMarkupInterface *iface) { static gboolean initialized = FALSE; @@ -378,7 +355,7 @@ ev_annotation_text_class_init (EvAnnotationTextClass *klass) } static void -ev_annotation_text_markup_iface_init (EvAnnotationMarkupIface *iface) +ev_annotation_text_markup_iface_init (EvAnnotationMarkupInterface *iface) { } @@ -423,7 +400,7 @@ ev_annotation_attachment_class_init (EvAnnotationAttachmentClass *klass) } static void -ev_annotation_attachment_markup_iface_init (EvAnnotationMarkupIface *iface) +ev_annotation_attachment_markup_iface_init (EvAnnotationMarkupInterface *iface) { } diff --git a/libdocument/ev-annotation.h b/libdocument/ev-annotation.h index 8436cce..de8736e 100644 --- a/libdocument/ev-annotation.h +++ b/libdocument/ev-annotation.h @@ -44,10 +44,10 @@ G_BEGIN_DECLS /* EvAnnotationMarkup */ #define EV_TYPE_ANNOTATION_MARKUP (ev_annotation_markup_get_type ()) #define EV_ANNOTATION_MARKUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_ANNOTATION_MARKUP, EvAnnotationMarkup)) -#define EV_ANNOTATION_MARKUP_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_ANNOTATION_MARKUP, EvAnnotationMarkupIface)) +#define EV_ANNOTATION_MARKUP_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_ANNOTATION_MARKUP, EvAnnotationMarkupInterface)) #define EV_IS_ANNOTATION_MARKUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_ANNOTATION_MARKUP)) #define EV_IS_ANNOTATION_MARKUP_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_ANNOTATION_MARKUP)) -#define EV_ANNOTATION_MARKUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_ANNOTATION_MARKUP, EvAnnotationMarkupIface)) +#define EV_ANNOTATION_MARKUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_ANNOTATION_MARKUP, EvAnnotationMarkupInterface)) /* EvAnnotationText */ #define EV_TYPE_ANNOTATION_TEXT (ev_annotation_text_get_type()) @@ -69,7 +69,7 @@ typedef struct _EvAnnotation EvAnnotation; typedef struct _EvAnnotationClass EvAnnotationClass; typedef struct _EvAnnotationMarkup EvAnnotationMarkup; -typedef struct _EvAnnotationMarkupIface EvAnnotationMarkupIface; +typedef struct _EvAnnotationMarkupInterface EvAnnotationMarkupInterface; typedef struct _EvAnnotationText EvAnnotationText; typedef struct _EvAnnotationTextClass EvAnnotationTextClass; @@ -96,7 +96,7 @@ struct _EvAnnotationClass GObjectClass parent_class; }; -struct _EvAnnotationMarkupIface +struct _EvAnnotationMarkupInterface { GTypeInterface base_iface; }; -- cgit v0.9.1