Commit c10ea2dd authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-05-11 Kristian Høgsberg <krh@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.
parent 7d189e33
2005-05-11 Kristian Høgsberg <krh@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.
2005-05-06 Kristian Høgsberg <krh@redhat.com>
* glib/Makefile.am (libpoppler_glib_la_LIBADD): Link poppler-glib
......
......@@ -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 @@ poppler_action_type_get_type (void)
}
return etype;
}
GType
poppler_dest_type_get_type (void)
{
......@@ -46,6 +48,7 @@ poppler_dest_type_get_type (void)
return etype;
}
/* enumerations from "poppler-document.h" */
GType
poppler_page_layout_get_type (void)
......@@ -66,6 +69,7 @@ poppler_page_layout_get_type (void)
}
return etype;
}
GType
poppler_page_mode_get_type (void)
{
......@@ -85,6 +89,7 @@ poppler_page_mode_get_type (void)
}
return etype;
}
GType
poppler_viewer_preferences_get_type (void)
{
......@@ -105,6 +110,7 @@ poppler_viewer_preferences_get_type (void)
}
return etype;
}
GType
poppler_permissions_get_type (void)
{
......@@ -125,6 +131,7 @@ poppler_permissions_get_type (void)
return etype;
}
/* enumerations from "poppler.h" */
GType
poppler_error_get_type (void)
......@@ -140,6 +147,7 @@ poppler_error_get_type (void)
}
return etype;
}
GType
poppler_orientation_get_type (void)
{
......@@ -157,7 +165,25 @@ poppler_orientation_get_type (void)
}
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 */
......@@ -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__ */
......
......@@ -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 @@ GQuark poppler_error_quark (void)
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;
}
......@@ -51,6 +51,17 @@ typedef struct _PopplerPage PopplerPage;
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"
......
......@@ -51,7 +51,9 @@ print_document_info (PopplerDocument *document)
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 @@ int main (int argc, char *argv[])
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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment