Commit 3437b9e1 authored by Jonathan Blandford Blandford's avatar Jonathan Blandford Blandford
Browse files

Tue Mar 29 22:49:15 2005 Jonathan Blandford <jrb@redhat.com>

        * glib/poppler-action.[ch]: New item to encapsulate links.
        * glib/poppler-document.[ch] (poppler_index_iter_get_action): New
        function to get the action.  Also, fix some warnings.
        * glib/poppler-private.h (_poppler_action_new): New function.
        * glib/test-poppler-glib.c: Fix warnings.
parent cab0ec4d
Tue Mar 29 22:49:15 2005 Jonathan Blandford <jrb@redhat.com>
* glib/poppler-action.[ch]: New item to encapsulate links.
* glib/poppler-document.[ch] (poppler_index_iter_get_action): New
function to get the action. Also, fix some warnings.
* glib/poppler-private.h (_poppler_action_new): New function.
* glib/test-poppler-glib.c: Fix warnings.
Tue Mar 29 02:36:00 2005 Jonathan Blandford <jrb@redhat.com>
* glib/poppler-document.[ch] (PopplerIndexIter): Add an iter to
......
......@@ -8,12 +8,14 @@ INCLUDES = \
poppler_glib_includedir = $(includedir)/poppler/glib
poppler_glib_include_HEADERS = \
poppler-action.h \
poppler-document.h \
poppler-page.h \
poppler.h
lib_LTLIBRARIES = libpoppler-glib.la
libpoppler_glib_la_SOURCES = \
poppler-action.cc \
poppler-document.cc \
poppler-page.cc \
poppler.cc \
......
......@@ -350,57 +350,26 @@ unicode_to_char (Unicode *unicode,
}
void
poppler_index_iter_get_values (PopplerIndexIter *iter,
char **text,
char **link_string,
int *page)
PopplerAction *
poppler_index_iter_get_action (PopplerIndexIter *iter)
{
OutlineItem *item;
LinkAction *action;
LinkAction *link_action;
PopplerAction *action;
gchar *title;
g_return_if_fail (iter != NULL);
g_return_if_fail (text != NULL);
g_return_if_fail (link_string != NULL);
g_return_if_fail (page != NULL);
g_return_val_if_fail (iter != NULL, NULL);
item = (OutlineItem *)iter->items->get (iter->index);
*text = unicode_to_char (item->getTitle(),
link_action = item->getAction ();
title = unicode_to_char (item->getTitle(),
item->getTitleLength ());
*page = -1;
action = item->getAction ();
if (action->getKind () == actionGoTo) {
LinkDest *link_dest;
LinkGoTo *link_goto;
Ref page_ref;
gint page_num = -1;
GooString *named_dest;
link_goto = dynamic_cast <LinkGoTo *> (action);
link_dest = link_goto->getDest ();
named_dest = link_goto->getNamedDest ();
if (link_dest != NULL) {
link_dest = link_dest->copy ();
} else if (named_dest != NULL) {
named_dest = named_dest->copy ();
link_dest = iter->document->doc->findDest (named_dest);
delete named_dest;
}
if (link_dest != NULL) {
if (link_dest->isPageRef ()) {
page_ref = link_dest->getPageRef ();
page_num = iter->document->doc->findPage (page_ref.num, page_ref.gen);
} else {
page_num = link_dest->getPageNum ();
}
delete link_dest;
}
if (page_num > 0)
*page = page_num - 1;
}
action = _poppler_action_new (iter->document, link_action, title);
g_free (title);
return action;
}
gboolean
......
......@@ -22,6 +22,7 @@
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "poppler.h"
#include "poppler-action.h"
G_BEGIN_DECLS
......@@ -50,11 +51,7 @@ GType poppler_document_get_type (void) G_GNUC_CONST;
/* Interface for getting the Index of a poppler_document */
PopplerIndexIter *poppler_index_iter_new (PopplerDocument *document);
PopplerIndexIter *poppler_index_iter_get_child (PopplerIndexIter *parent);
//PopplerAction *poppler_index_iter_get_action (PopplerIndexIter *iter); /* Use when PopplerAction exists */
void poppler_index_iter_get_values (PopplerIndexIter *iter,
char **text,
char **link_string,
int *page);
PopplerAction *poppler_index_iter_get_action (PopplerIndexIter *iter);
gboolean poppler_index_iter_next (PopplerIndexIter *iter);
void poppler_index_iter_free (PopplerIndexIter *iter);
......
#ifndef __POPPLER_PRIVATE_H__
#define __POPPLER_PRIVATE_H__
#include <PDFDoc.h>
#include <Link.h>
struct _PopplerDocument
{
GObject parent_instance;
......@@ -15,7 +18,12 @@ struct _PopplerPage
int index;
};
PopplerPage *
_poppler_page_new (PopplerDocument *document, Page *page, int index);
PopplerPage *_poppler_page_new (PopplerDocument *document,
Page *page,
int index);
PopplerAction *_poppler_action_new (PopplerDocument *document,
LinkAction *link,
const gchar *title);
#endif
......@@ -38,5 +38,6 @@ G_END_DECLS
#include "poppler-document.h"
#include "poppler-page.h"
#include "poppler-action.h"
#endif /* __POPPLER_GLIB_H__ */
......@@ -9,7 +9,7 @@ int main (int argc, char *argv[])
{
PopplerDocument *document;
PopplerPage *page;
char *filename, *title, *label;
char *title, *label;
GError *error;
GdkPixbuf *pixbuf, *thumb;
double width, height;
......@@ -61,4 +61,6 @@ int main (int argc, char *argv[])
FAIL (error->message);
g_object_unref (G_OBJECT (document));
return 0;
}
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