#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_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);
enum {
PROP_0,
G_IMPLEMENT_INTERFACE (EV_TYPE_ANNOTATION_MARKUP,
ev_annotation_text_markup_iface_init);
});
+G_DEFINE_TYPE_WITH_CODE (EvAnnotationAttachment, ev_annotation_attachment, EV_TYPE_ANNOTATION,
+ {
+ G_IMPLEMENT_INTERFACE (EV_TYPE_ANNOTATION_MARKUP,
+ ev_annotation_attachment_markup_iface_init);
+ });
/* EvAnnotation */
static void
g_object_class->finalize = ev_annotation_finalize;
}
-EvAnnotation *
-ev_annotation_text_new (EvPage *page)
-{
- EvAnnotation *annot;
-
- annot = EV_ANNOTATION (g_object_new (EV_TYPE_ANNOTATION_TEXT, NULL));
- annot->page = g_object_ref (page);
-
- return annot;
-}
-
/* EvAnnotationMarkup */
typedef struct {
gchar *label;
{
}
+EvAnnotation *
+ev_annotation_text_new (EvPage *page)
+{
+ EvAnnotation *annot;
+
+ annot = EV_ANNOTATION (g_object_new (EV_TYPE_ANNOTATION_TEXT, NULL));
+ annot->page = g_object_ref (page);
+
+ return annot;
+}
+
+/* EvAnnotationAttachment */
+static void
+ev_annotation_attachment_finalize (GObject *object)
+{
+ EvAnnotationAttachment *annot = EV_ANNOTATION_ATTACHMENT (object);
+
+ if (annot->attachment) {
+ g_object_unref (annot->attachment);
+ annot->attachment = NULL;
+ }
+
+ G_OBJECT_CLASS (ev_annotation_attachment_parent_class)->finalize (object);
+}
+
+static void
+ev_annotation_attachment_init (EvAnnotationAttachment *annot)
+{
+}
+
+static void
+ev_annotation_attachment_class_init (EvAnnotationAttachmentClass *klass)
+{
+ GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
+
+ ev_annotation_markup_class_install_properties (g_object_class);
+
+ g_object_class->finalize = ev_annotation_attachment_finalize;
+}
+
+static void
+ev_annotation_attachment_markup_iface_init (EvAnnotationMarkupIface *iface)
+{
+}
+
+EvAnnotation *
+ev_annotation_attachment_new (EvPage *page,
+ EvAttachment *attachment)
+{
+ EvAnnotation *annot;
+
+ g_return_val_if_fail (EV_IS_ATTACHMENT (attachment), NULL);
+
+ annot = EV_ANNOTATION (g_object_new (EV_TYPE_ANNOTATION_ATTACHMENT, NULL));
+ annot->page = g_object_ref (page);
+ EV_ANNOTATION_ATTACHMENT (annot)->attachment = g_object_ref (attachment);
+
+ return annot;
+}
#include <glib-object.h>
#include "ev-document.h"
+#include "ev-attachment.h"
G_BEGIN_DECLS
#define EV_IS_ANNOTATION_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_ANNOTATION_TEXT))
#define EV_ANNOTATION_TEXT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_ANNOTATION_TEXT, EvAnnotationTextClass))
-typedef struct _EvAnnotation EvAnnotation;
-typedef struct _EvAnnotationClass EvAnnotationClass;
+/* EvAnnotationText */
+#define EV_TYPE_ANNOTATION_ATTACHMENT (ev_annotation_attachment_get_type())
+#define EV_ANNOTATION_ATTACHMENT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_ANNOTATION_ATTACHMENT, EvAnnotationAttachment))
+#define EV_ANNOTATION_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_ANNOTATION_ATTACHMENT, EvAnnotationAttachmentClass))
+#define EV_IS_ANNOTATION_ATTACHMENT(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_ANNOTATION_ATTACHMENT))
+#define EV_IS_ANNOTATION_ATTACHMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_ANNOTATION_ATTACHMENT))
+#define EV_ANNOTATION_ATTACHMENT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_ANNOTATION_ATTACHMENT, EvAnnotationAttachmentClass))
+
+typedef struct _EvAnnotation EvAnnotation;
+typedef struct _EvAnnotationClass EvAnnotationClass;
-typedef struct _EvAnnotationMarkup EvAnnotationMarkup;
-typedef struct _EvAnnotationMarkupIface EvAnnotationMarkupIface;
+typedef struct _EvAnnotationMarkup EvAnnotationMarkup;
+typedef struct _EvAnnotationMarkupIface EvAnnotationMarkupIface;
-typedef struct _EvAnnotationText EvAnnotationText;
-typedef struct _EvAnnotationTextClass EvAnnotationTextClass;
+typedef struct _EvAnnotationText EvAnnotationText;
+typedef struct _EvAnnotationTextClass EvAnnotationTextClass;
+
+typedef struct _EvAnnotationAttachment EvAnnotationAttachment;
+typedef struct _EvAnnotationAttachmentClass EvAnnotationAttachmentClass;
struct _EvAnnotation
{
EvAnnotationClass parent_class;
};
+struct _EvAnnotationAttachment
+{
+ EvAnnotation parent;
+
+ EvAttachment *attachment;
+};
+
+struct _EvAnnotationAttachmentClass
+{
+ EvAnnotationClass parent_class;
+};
+
/* EvAnnotation */
GType ev_annotation_get_type (void) G_GNUC_CONST;
GType ev_annotation_text_get_type (void) G_GNUC_CONST;
EvAnnotation *ev_annotation_text_new (EvPage *page);
+/* EvAnnotationText */
+GType ev_annotation_attachment_get_type (void) G_GNUC_CONST;
+EvAnnotation *ev_annotation_attachment_new (EvPage *page,
+ EvAttachment *attachment);
+
G_END_DECLS
#endif /* EV_ANNOTATION_H */