[poppler] 4 commits - glib/demo glib/poppler-page.cc glib/poppler-page.h glib/reference

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Mon Sep 13 05:37:34 PDT 2010


 glib/demo/page.c                    |    2 -
 glib/poppler-page.cc                |   52 +++++++++++++++++++++++++++---------
 glib/poppler-page.h                 |    1 
 glib/reference/poppler-sections.txt |    1 
 4 files changed, 42 insertions(+), 14 deletions(-)

New commits:
commit f49aa86812ed8ad91d41c675bc670b3d88d3444a
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 13 14:37:10 2010 +0200

    [glib] doc: Document PopplerPage:label property

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 81f81de..0e5de5c 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1259,6 +1259,11 @@ poppler_page_class_init (PopplerPageClass *klass)
   gobject_class->finalize = poppler_page_finalize;
   gobject_class->get_property = poppler_page_get_property;
 
+  /**
+   * PopplerPage:label:
+   *
+   * The label of the page or %NULL. See also poppler_page_get_label()
+   */
   g_object_class_install_property (G_OBJECT_CLASS (klass),
 				   PROP_LABEL,
 				   g_param_spec_string ("label",
commit f41fe7ae6e374100574c49d1bb7a3ddc646786c8
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 13 14:36:43 2010 +0200

    [glib] doc: Add poppler_page_get_label to poppler-sections.txt

diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt
index d3e4c3a..6582766 100644
--- a/glib/reference/poppler-sections.txt
+++ b/glib/reference/poppler-sections.txt
@@ -15,6 +15,7 @@ PopplerPageTransitionAlignment
 PopplerPageTransitionDirection
 PopplerSelectionStyle
 poppler_page_get_index
+poppler_page_get_label
 poppler_page_get_size
 poppler_page_get_crop_box
 poppler_page_get_duration
commit 91b8246766a8e5d9cca385b5854667d7967a9d71
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 13 14:22:56 2010 +0200

    [glib-demo] Use poppler_page_get_label() instead of g_object_get()

diff --git a/glib/demo/page.c b/glib/demo/page.c
index ee034f0..7ab008c 100644
--- a/glib/demo/page.c
+++ b/glib/demo/page.c
@@ -137,7 +137,7 @@ pgd_page_set_page (PgdPageDemo *demo,
 	g_free (str);
 
 	if (page) {
-		g_object_get (G_OBJECT (page), "label", &str, NULL);
+		str = poppler_page_get_label (page);
 		gtk_label_set_text (GTK_LABEL (demo->label), str);
 		g_free (str);
 	} else {
commit b82412ef86091f4d249c818cebf00e4c59bae311
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Sep 13 14:22:03 2010 +0200

    [glib] Add poppler_page_get_label()
    
    It's just an accessor for the property label

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 60d311d..81f81de 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -133,6 +133,29 @@ poppler_page_get_index (PopplerPage *page)
 }
 
 /**
+ * poppler_page_get_label:
+ * @page: a #PopplerPage
+ *
+ * Returns the label of @page. Note that page labels
+ * and page indices might not coincide.
+ *
+ * Return value: a new allocated string containing the label of @page,
+ *               or %NULL if @page doesn't have a label
+ *
+ * Since: 0.16
+ **/
+gchar *
+poppler_page_get_label (PopplerPage *page)
+{
+  GooString label;
+
+  g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
+
+  page->document->doc->getCatalog ()->indexToLabel (page->index, &label);
+  return _poppler_goo_string_to_utf8 (&label);
+}
+
+/**
  * poppler_page_get_duration:
  * @page: a #PopplerPage
  *
@@ -1211,20 +1234,20 @@ poppler_page_render_to_ps (PopplerPage   *page,
 }
 
 static void
-poppler_page_get_property (GObject *object,
-			   guint prop_id,
-			   GValue *value,
+poppler_page_get_property (GObject    *object,
+			   guint       prop_id,
+			   GValue     *value,
 			   GParamSpec *pspec)
 {
   PopplerPage *page = POPPLER_PAGE (object);
-  GooString label;
 
   switch (prop_id)
     {
     case PROP_LABEL:
-      page->document->doc->getCatalog ()->indexToLabel (page->index, &label);
-      g_value_take_string (value, _poppler_goo_string_to_utf8(&label));
+      g_value_take_string (value, poppler_page_get_label (page));
       break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
 }
 
@@ -1232,19 +1255,17 @@ static void
 poppler_page_class_init (PopplerPageClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GParamSpec *pspec;
 
   gobject_class->finalize = poppler_page_finalize;
   gobject_class->get_property = poppler_page_get_property;
 
-  pspec = g_param_spec_string ("label",
-			       "Page Label",
-			       "The label of the page",
-			       NULL,
-			       G_PARAM_READABLE);
   g_object_class_install_property (G_OBJECT_CLASS (klass),
 				   PROP_LABEL,
-				   pspec);
+				   g_param_spec_string ("label",
+							"Page Label",
+							"The label of the page",
+							NULL,
+							G_PARAM_READABLE));
 }
 
 static void
diff --git a/glib/poppler-page.h b/glib/poppler-page.h
index a14689d..e6cf5ee 100644
--- a/glib/poppler-page.h
+++ b/glib/poppler-page.h
@@ -85,6 +85,7 @@ void                   poppler_page_get_size             (PopplerPage        *pa
 							  double             *width,
 							  double             *height);
 int                    poppler_page_get_index            (PopplerPage        *page);
+gchar                 *poppler_page_get_label            (PopplerPage        *page);
 double                 poppler_page_get_duration         (PopplerPage        *page);
 PopplerPageTransition *poppler_page_get_transition       (PopplerPage        *page);
 gboolean               poppler_page_get_thumbnail_size   (PopplerPage        *page,


More information about the poppler mailing list