summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2009-04-21 18:08:06 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2009-04-21 18:09:37 +0200
commit9c2714a3e1c02f445661618e24bcd27f1392b2b7 (patch)
tree06e60ee9f1221025e0137d60948d81562303578c /glib
parenteec550e8b3cf96aefed9b03a78d365c2848fb8f2 (diff)
[glib] Implement poppler_annot_set_contents()
Diffstat (limited to 'glib')
-rw-r--r--glib/poppler-annot.cc25
-rw-r--r--glib/poppler-annot.h2
2 files changed, 27 insertions, 0 deletions
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index a2c51e44..5e5a4aa1 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -252,6 +252,31 @@ poppler_annot_get_contents (PopplerAnnot *poppler_annot)
}
/**
+ * poppler_annot_set_contents:
+ * @poppler_annot: a #PopplerAnnot
+ * @contents: a text string containing the new contents
+ *
+ * Sets the contents of @poppler_annot to the given value,
+ * replacing the current contents.
+ **/
+void
+poppler_annot_set_contents (PopplerAnnot *poppler_annot,
+ const gchar *contents)
+{
+ GooString *goo_tmp;
+ gchar *tmp;
+ gsize length = 0;
+
+ g_return_if_fail (POPPLER_IS_ANNOT (poppler_annot));
+
+ tmp = contents ? g_convert (contents, -1, "UTF16BE", "UTF8", NULL, &length, NULL) : NULL;
+ goo_tmp = new GooString (tmp, length);
+ g_free (tmp);
+ poppler_annot->annot->setContents (goo_tmp);
+ delete (goo_tmp);
+}
+
+/**
* poppler_annot_get_name:
* @poppler_annot: a #PopplerAnnot
*
diff --git a/glib/poppler-annot.h b/glib/poppler-annot.h
index 3e38975c..714e87b7 100644
--- a/glib/poppler-annot.h
+++ b/glib/poppler-annot.h
@@ -133,6 +133,8 @@ struct _PopplerAnnotCalloutLine
GType poppler_annot_get_type (void) G_GNUC_CONST;
PopplerAnnotType poppler_annot_get_annot_type (PopplerAnnot *poppler_annot);
gchar *poppler_annot_get_contents (PopplerAnnot *poppler_annot);
+void poppler_annot_set_contents (PopplerAnnot *poppler_annot,
+ const gchar *contents);
gchar *poppler_annot_get_name (PopplerAnnot *poppler_annot);
gchar *poppler_annot_get_modified (PopplerAnnot *poppler_annot);
PopplerAnnotFlag poppler_annot_get_flags (PopplerAnnot *poppler_annot);