[poppler] poppler/glib: poppler-enums.c, 1.2, 1.3 poppler-enums.h, 1.2, 1.3 poppler.cc, 1.2, 1.3 poppler.h, 1.6, 1.7 test-poppler-glib.c, 1.9, 1.10

Kristian Hogsberg krh at freedesktop.org
Wed May 11 13:01:45 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv25775/glib

Modified Files:
	poppler-enums.c poppler-enums.h poppler.cc poppler.h 
	test-poppler-glib.c 
Log Message:
2005-05-11  Kristian Høgsberg  <krh at redhat.com>

        * glib/poppler.cc (poppler_get_backend, poppler_get_version): Add
        these functions so it's easy to tell if poppler is using cairo or
        splash and what version.

        * glib/test-poppler-glib.c (main): Print out version and backend.



Index: poppler-enums.c
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-enums.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- poppler-enums.c	4 May 2005 06:32:38 -0000	1.2
+++ poppler-enums.c	11 May 2005 20:01:43 -0000	1.3
@@ -4,6 +4,7 @@
 #include "poppler-enums.h"
 #include "poppler-document.h"
 
+
 /* enumerations from "poppler-action.h" */
 GType
 poppler_action_type_get_type (void)
@@ -24,6 +25,7 @@
   }
   return etype;
 }
+
 GType
 poppler_dest_type_get_type (void)
 {
@@ -46,6 +48,7 @@
   return etype;
 }
 
+
 /* enumerations from "poppler-document.h" */
 GType
 poppler_page_layout_get_type (void)
@@ -66,6 +69,7 @@
   }
   return etype;
 }
+
 GType
 poppler_page_mode_get_type (void)
 {
@@ -85,6 +89,7 @@
   }
   return etype;
 }
+
 GType
 poppler_viewer_preferences_get_type (void)
 {
@@ -105,6 +110,7 @@
   }
   return etype;
 }
+
 GType
 poppler_permissions_get_type (void)
 {
@@ -125,6 +131,7 @@
   return etype;
 }
 
+
 /* enumerations from "poppler.h" */
 GType
 poppler_error_get_type (void)
@@ -140,6 +147,7 @@
   }
   return etype;
 }
+
 GType
 poppler_orientation_get_type (void)
 {
@@ -157,7 +165,25 @@
   }
   return etype;
 }
+
+GType
+poppler_backend_get_type (void)
+{
+  static GType etype = 0;
+  if (etype == 0) {
+    static const GEnumValue values[] = {
+      { POPPLER_BACKEND_UNKNOWN, "POPPLER_BACKEND_UNKNOWN", "unknown" },
+      { POPPLER_BACKEND_SPLASH, "POPPLER_BACKEND_SPLASH", "splash" },
+      { POPPLER_BACKEND_CAIRO, "POPPLER_BACKEND_CAIRO", "cairo" },
+      { 0, NULL, NULL }
+    };
+    etype = g_enum_register_static ("PopplerBackend", values);
+  }
+  return etype;
+}
+
 #define __POPPLER_ENUMS_C__
 
+
 /* Generated data ends here */
 

Index: poppler-enums.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-enums.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- poppler-enums.h	4 May 2005 06:32:38 -0000	1.2
+++ poppler-enums.h	11 May 2005 20:01:43 -0000	1.3
@@ -7,25 +7,40 @@
 #include <glib-object.h>
 
 G_BEGIN_DECLS
+
 /* enumerations from "poppler-action.h" */
+
 GType poppler_action_type_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_ACTION_TYPE (poppler_action_type_get_type())
+
 GType poppler_dest_type_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_DEST_TYPE (poppler_dest_type_get_type())
+
 /* enumerations from "poppler-document.h" */
+
 GType poppler_page_layout_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_PAGE_LAYOUT (poppler_page_layout_get_type())
+
 GType poppler_page_mode_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_PAGE_MODE (poppler_page_mode_get_type())
+
 GType poppler_viewer_preferences_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_VIEWER_PREFERENCES (poppler_viewer_preferences_get_type())
+
 GType poppler_permissions_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_PERMISSIONS (poppler_permissions_get_type())
+
 /* enumerations from "poppler.h" */
+
 GType poppler_error_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_ERROR (poppler_error_get_type())
+
 GType poppler_orientation_get_type (void) G_GNUC_CONST;
 #define POPPLER_TYPE_ORIENTATION (poppler_orientation_get_type())
+
+GType poppler_backend_get_type (void) G_GNUC_CONST;
+#define POPPLER_TYPE_BACKEND (poppler_backend_get_type())
+
 G_END_DECLS
 
 #endif /* __POPPLER_TYPE_ENUMS_H__ */

Index: poppler.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- poppler.cc	20 Mar 2005 05:44:06 -0000	1.2
+++ poppler.cc	11 May 2005 20:01:43 -0000	1.3
@@ -16,6 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <config.h>
 #include "poppler.h"
 
 GQuark poppler_error_quark (void)
@@ -27,3 +28,23 @@
 
   return q;
 }
+
+PopplerBackend
+poppler_get_backend (void)
+{
+#if defined (HAVE_CAIRO)
+  return POPPLER_BACKEND_CAIRO;
+#elif defined (HAVE_SPLASH)
+  return POPPLER_BACKEND_SPLASH;
+#else
+  return POPPLER_BACKEND_UNKNOWN;
+#endif
+}
+
+static const char poppler_version[] = PACKAGE_VERSION;
+
+const char *
+poppler_get_version (void)
+{
+  return poppler_version;
+}

Index: poppler.h
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- poppler.h	4 May 2005 06:32:38 -0000	1.6
+++ poppler.h	11 May 2005 20:01:43 -0000	1.7
@@ -51,6 +51,17 @@
 typedef struct _PopplerPSFile      PopplerPSFile;
 typedef union  _PopplerAction      PopplerAction;
 
+
+typedef enum
+{
+  POPPLER_BACKEND_UNKNOWN,
+  POPPLER_BACKEND_SPLASH,
+  POPPLER_BACKEND_CAIRO
+} PopplerBackend;
+
+PopplerBackend poppler_get_backend (void);
+const char *   poppler_get_version (void);
+
 G_END_DECLS
 
 #include "poppler-document.h"

Index: test-poppler-glib.c
===================================================================
RCS file: /cvs/poppler/poppler/glib/test-poppler-glib.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test-poppler-glib.c	26 Apr 2005 17:17:05 -0000	1.9
+++ test-poppler-glib.c	11 May 2005 20:01:43 -0000	1.10
@@ -51,7 +51,9 @@
 int main (int argc, char *argv[])
 {
   PopplerDocument *document;
+  PopplerBackend backend;
   PopplerPage *page;
+  GEnumValue *enum_value;
   char *label;
   GError *error;
   GdkPixbuf *pixbuf, *thumb;
@@ -65,11 +67,16 @@
 
   g_type_init ();
 
+  g_print ("Poppler version %s\n", poppler_get_version ());
+  backend = poppler_get_backend ();
+  enum_value = g_enum_get_value ((GEnumClass *) g_type_class_ref (POPPLER_TYPE_BACKEND), backend);
+  g_print ("Backend is %s\n", enum_value->value_name);
+
   error = NULL;
   document = poppler_document_new_from_file (argv[1], NULL, &error);
   if (document == NULL)
     FAIL (error->message);
-      
+
   print_document_info (document); 
 
   page = poppler_document_get_page_by_label (document, argv[2]);



More information about the poppler mailing list