summaryrefslogtreecommitdiff
path: root/glib/poppler-annot.cc
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-03-15 10:56:23 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2010-03-15 11:00:34 +0100
commit132b6f072fefd231d42f31626f1b5009c4e8319e (patch)
tree5722c33f6bc9b32b581d825068cb2e2ba1ff4f9a /glib/poppler-annot.cc
parentaecad2bb12be44825d273e364ec6a0444dac5605 (diff)
[glib] Add support for movie annotations
Based on patch by Hugo Mercier.
Diffstat (limited to 'glib/poppler-annot.cc')
-rw-r--r--glib/poppler-annot.cc97
1 files changed, 97 insertions, 0 deletions
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index 50496e79..b450e617 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -26,6 +26,7 @@ typedef struct _PopplerAnnotMarkupClass PopplerAnnotMarkupClass;
typedef struct _PopplerAnnotFreeTextClass PopplerAnnotFreeTextClass;
typedef struct _PopplerAnnotTextClass PopplerAnnotTextClass;
typedef struct _PopplerAnnotFileAttachmentClass PopplerAnnotFileAttachmentClass;
+typedef struct _PopplerAnnotMovieClass PopplerAnnotMovieClass;
struct _PopplerAnnot
{
@@ -78,11 +79,24 @@ struct _PopplerAnnotFileAttachmentClass
PopplerAnnotMarkupClass parent_class;
};
+struct _PopplerAnnotMovie
+{
+ PopplerAnnot parent_instance;
+
+ PopplerMovie *movie;
+};
+
+struct _PopplerAnnotMovieClass
+{
+ PopplerAnnotClass parent_class;
+};
+
G_DEFINE_TYPE (PopplerAnnot, poppler_annot, G_TYPE_OBJECT)
G_DEFINE_TYPE (PopplerAnnotMarkup, poppler_annot_markup, POPPLER_TYPE_ANNOT)
G_DEFINE_TYPE (PopplerAnnotText, poppler_annot_text, POPPLER_TYPE_ANNOT_MARKUP)
G_DEFINE_TYPE (PopplerAnnotFreeText, poppler_annot_free_text, POPPLER_TYPE_ANNOT_MARKUP)
G_DEFINE_TYPE (PopplerAnnotFileAttachment, poppler_annot_file_attachment, POPPLER_TYPE_ANNOT_MARKUP)
+G_DEFINE_TYPE (PopplerAnnotMovie, poppler_annot_movie, POPPLER_TYPE_ANNOT)
static void
poppler_annot_finalize (GObject *object)
@@ -191,6 +205,49 @@ _poppler_annot_file_attachment_new (Annot *annot)
return poppler_annot;
}
+
+static void
+poppler_annot_movie_finalize (GObject *object)
+{
+ PopplerAnnotMovie *annot_movie = POPPLER_ANNOT_MOVIE (object);
+
+ if (annot_movie->movie) {
+ g_object_unref (annot_movie->movie);
+ annot_movie->movie = NULL;
+ }
+
+ G_OBJECT_CLASS (poppler_annot_movie_parent_class)->finalize (object);
+}
+
+static void
+poppler_annot_movie_init (PopplerAnnotMovie *poppler_annot)
+{
+}
+
+static void
+poppler_annot_movie_class_init (PopplerAnnotMovieClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = poppler_annot_movie_finalize;
+}
+
+PopplerAnnot *
+_poppler_annot_movie_new (Annot *annot)
+{
+ PopplerAnnot *poppler_annot;
+ AnnotMovie *annot_movie;
+
+ poppler_annot = POPPLER_ANNOT (g_object_new (POPPLER_TYPE_ANNOT_MOVIE, NULL));
+ poppler_annot->annot = annot;
+
+ annot_movie = static_cast<AnnotMovie *>(poppler_annot->annot);
+ POPPLER_ANNOT_MOVIE (poppler_annot)->movie = _poppler_movie_new (annot_movie->getMovie());
+
+ return poppler_annot;
+}
+
+
/* Public methods */
/**
* poppler_annot_get_annot_type:
@@ -920,3 +977,43 @@ poppler_annot_callout_line_free (PopplerAnnotCalloutLine *callout)
{
g_free (callout);
}
+
+
+/* PopplerAnnotMovie */
+/**
+* poppler_annot_movie_get_title:
+* @poppler_annot: a #PopplerAnnotMovie
+*
+* Retrieves the movie title of @poppler_annot.
+*
+* Return value: the title text of @poppler_annot.
+*/
+gchar *
+poppler_annot_movie_get_title (PopplerAnnotMovie *poppler_annot)
+{
+ AnnotMovie *annot;
+ GooString *title;
+
+ g_return_val_if_fail (POPPLER_IS_ANNOT_MOVIE (poppler_annot), NULL);
+
+ annot = static_cast<AnnotMovie *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+ title = annot->getTitle ();
+
+ return title ? _poppler_goo_string_to_utf8 (title) : NULL;
+}
+
+/**
+* poppler_annot_movie_get_movie:
+* @poppler_annot: a #PopplerAnnotMovie
+*
+* Retrieves the movie object (PopplerMovie) stored in the @poppler_annot.
+*
+* Return value: the movie object stored in the @poppler_annot. The returned
+* object is owned by #PopplerAnnotMovie and should not be freed
+*/
+PopplerMovie *
+poppler_annot_movie_get_movie (PopplerAnnotMovie *poppler_annot)
+{
+ return poppler_annot->movie;
+}