diff options
author | Marco Pesenti Gritti <marco@src.gnome.org> | 2005-01-10 19:08:15 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2005-01-10 19:08:15 (GMT) |
commit | 2d5fe16a0b4a8bbb85933e471a62550384446821 (patch) | |
tree | 8cf9cc024c35796da1b6d75b6d1d1f9312f9ed3d /backend | |
parent | d906aff9da8222c4377c558cbb079be0dc26613f (diff) |
Rename bookmark to link, and use "Index" for the sidebar panel.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/Makefile.am | 8 | ||||
-rw-r--r-- | backend/ev-bookmark.h | 79 | ||||
-rw-r--r-- | backend/ev-document-bookmarks.c | 101 | ||||
-rw-r--r-- | backend/ev-document-bookmarks.h | 85 | ||||
-rw-r--r-- | backend/ev-document-links.c | 101 | ||||
-rw-r--r-- | backend/ev-document-links.h | 80 | ||||
-rw-r--r-- | backend/ev-link.c (renamed from backend/ev-bookmark.c) | 160 | ||||
-rw-r--r-- | backend/ev-link.h | 79 |
8 files changed, 344 insertions, 349 deletions
diff --git a/backend/Makefile.am b/backend/Makefile.am index 03a9103..ea599fd 100644 --- a/backend/Makefile.am +++ b/backend/Makefile.am @@ -11,14 +11,14 @@ noinst_LTLIBRARIES = libevbackend.la libevbackend_la_SOURCES= \ ev-backend-marshal.c \ - ev-bookmark.c \ - ev-bookmark.h \ + ev-link.c \ + ev-link.h \ ev-document.c \ ev-document.h \ ev-document-thumbnails.c \ ev-document-thumbnails.h \ - ev-document-bookmarks.c \ - ev-document-bookmarks.h \ + ev-document-links.c \ + ev-document-links.h \ ev-document-find.c \ ev-document-find.h \ ev-ps-exporter.c \ diff --git a/backend/ev-bookmark.h b/backend/ev-bookmark.h deleted file mode 100644 index 654ee94..0000000 --- a/backend/ev-bookmark.h +++ /dev/null @@ -1,79 +0,0 @@ -/* this file is part of evince, a gnome document viewer - * - * Copyright (C) 2005 Red Hat, Inc. - * - * Evince is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Evince is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef EV_BOOKMARK_H -#define EV_BOOKMARK_H - -#include <glib-object.h> - -G_BEGIN_DECLS - -typedef struct _EvBookmark EvBookmark; -typedef struct _EvBookmarkClass EvBookmarkClass; -typedef struct _EvBookmarkPrivate EvBookmarkPrivate; - -#define EV_TYPE_BOOKMARK (ev_bookmark_get_type()) -#define EV_BOOKMARK(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_BOOKMARK, EvBookmark)) -#define EV_BOOKMARK_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), EV_TYPE_BOOKMARK, EvBookmarkClass)) -#define EV_IS_BOOKMARK(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_BOOKMARK)) -#define EV_IS_BOOKMARK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_BOOKMARK)) -#define EV_BOOKMARK_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_BOOKMARK, EvBookmarkClass)) - -#define EV_TYPE_BOOKMARK_TYPE (ev_bookmark_type_get_type ()) - -typedef enum -{ - EV_BOOKMARK_TYPE_TITLE, - EV_BOOKMARK_TYPE_LINK, - EV_BOOKMARK_TYPE_EXTERNAL_URI -} EvBookmarkType; - -struct _EvBookmark { - GObject base_instance; - EvBookmarkPrivate *priv; -}; - -struct _EvBookmarkClass { - GObjectClass base_class; -}; - -GType ev_bookmark_type_get_type (void); -GType ev_bookmark_get_type (void); - -EvBookmark *ev_bookmark_new_title (const char *title); -EvBookmark *ev_bookmark_new_link (const char *title, - int page); -EvBookmark *ev_bookmark_new_external (const char *title, - const char *uri); -const char *ev_bookmark_get_title (EvBookmark *bookmark); -void ev_bookmark_set_title (EvBookmark *bookmark, - const char *title); -const char *ev_bookmark_get_uri (EvBookmark *bookmark); -void ev_bookmark_set_uri (EvBookmark *bookmark, - const char *uri); -EvBookmarkType ev_bookmark_get_bookmark_type (EvBookmark *bookmark); -void ev_bookmark_set_bookmark_type (EvBookmark *bookmark, - EvBookmarkType type); -int ev_bookmark_get_page (EvBookmark *bookmark); -void ev_bookmark_set_page (EvBookmark *bookmark, - int page); - -G_END_DECLS - -#endif /* !EV_BOOKMARK_H */ diff --git a/backend/ev-document-bookmarks.c b/backend/ev-document-bookmarks.c deleted file mode 100644 index 7b0d141..0000000 --- a/backend/ev-document-bookmarks.c +++ /dev/null @@ -1,101 +0,0 @@ -/* ev-document-bookmarks.h - * this file is part of evince, a gnome document_bookmarks viewer - * - * Copyright (C) 2004 Red Hat, Inc. - * - * Author: - * Jonathan Blandford <jrb@alum.mit.edu> - * - * Evince is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Evince is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "ev-document-bookmarks.h" - -GType -ev_document_bookmarks_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) - { - static const GTypeInfo our_info = - { - sizeof (EvDocumentBookmarksIface), - NULL, - NULL, - }; - - type = g_type_register_static (G_TYPE_INTERFACE, - "EvDocumentBookmarks", - &our_info, (GTypeFlags)0); - } - - return type; -} - -gboolean -ev_document_bookmarks_has_document_bookmarks (EvDocumentBookmarks *document_bookmarks) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - return iface->has_document_bookmarks (document_bookmarks); -} - -EvDocumentBookmarksIter * -ev_document_bookmarks_begin_read (EvDocumentBookmarks *document_bookmarks) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - - return iface->begin_read (document_bookmarks); -} - -EvBookmark * -ev_document_bookmarks_get_bookmark (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - - return iface->get_bookmark (document_bookmarks, iter); -} - -EvDocumentBookmarksIter * -ev_document_bookmarks_get_child (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - - return iface->get_child (document_bookmarks, iter); -} - - -gboolean -ev_document_bookmarks_next (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - - return iface->next (document_bookmarks, iter); -} - - -void -ev_document_bookmarks_free_iter (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter) -{ - EvDocumentBookmarksIface *iface = EV_DOCUMENT_BOOKMARKS_GET_IFACE (document_bookmarks); - - iface->free_iter (document_bookmarks, iter); -} diff --git a/backend/ev-document-bookmarks.h b/backend/ev-document-bookmarks.h deleted file mode 100644 index 6ee36a7..0000000 --- a/backend/ev-document-bookmarks.h +++ /dev/null @@ -1,85 +0,0 @@ -/* ev-document-bookmarks.h - * this file is part of evince, a gnome document_bookmarks viewer - * - * Copyright (C) 2004 Red Hat, Inc. - * - * Author: - * Jonathan Blandford <jrb@alum.mit.edu> - * - * Evince is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Evince is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -/* Acrobat insists on calling the TOC a bookmark, b/c they allow people to add - * their own.. We will continue this convention despite it being an obviously - * bad name. - */ - -#ifndef EV_DOCUMENT_BOOKMARKS_H -#define EV_DOCUMENT_BOOKMARKS_H - -#include <glib-object.h> -#include <glib.h> -#include <gdk/gdk.h> - -#include "ev-document.h" -#include "ev-bookmark.h" - -G_BEGIN_DECLS - - -#define EV_TYPE_DOCUMENT_BOOKMARKS (ev_document_bookmarks_get_type ()) -#define EV_DOCUMENT_BOOKMARKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_BOOKMARKS, EvDocumentBookmarks)) -#define EV_DOCUMENT_BOOKMARKS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_BOOKMARKS, EvDocumentBookmarksIface)) -#define EV_IS_DOCUMENT_BOOKMARKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_BOOKMARKS)) -#define EV_IS_DOCUMENT_BOOKMARKS_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_BOOKMARKS)) -#define EV_DOCUMENT_BOOKMARKS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_BOOKMARKS, EvDocumentBookmarksIface)) - -typedef struct _EvDocumentBookmarks EvDocumentBookmarks; -typedef struct _EvDocumentBookmarksIface EvDocumentBookmarksIface; -typedef struct _EvDocumentBookmarksIter EvDocumentBookmarksIter; - -struct _EvDocumentBookmarksIface -{ - GTypeInterface base_iface; - - /* Methods */ - gboolean (* has_document_bookmarks) (EvDocumentBookmarks *document_bookmarks); - EvDocumentBookmarksIter *(* begin_read) (EvDocumentBookmarks *document_bookmarks); - EvBookmark *(* get_bookmark) (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); - EvDocumentBookmarksIter *(* get_child) (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); - gboolean (* next) (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); - void (* free_iter) (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); -}; - -GType ev_document_bookmarks_get_type (void); -gboolean ev_document_bookmarks_has_document_bookmarks (EvDocumentBookmarks *document_bookmarks); -EvDocumentBookmarksIter *ev_document_bookmarks_begin_read (EvDocumentBookmarks *document_bookmarks); -EvBookmark *ev_document_bookmarks_get_bookmark (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); -EvDocumentBookmarksIter *ev_document_bookmarks_get_child (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); -gboolean ev_document_bookmarks_next (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); -void ev_document_bookmarks_free_iter (EvDocumentBookmarks *document_bookmarks, - EvDocumentBookmarksIter *iter); - - -G_END_DECLS - -#endif diff --git a/backend/ev-document-links.c b/backend/ev-document-links.c new file mode 100644 index 0000000..242efb6 --- /dev/null +++ b/backend/ev-document-links.c @@ -0,0 +1,101 @@ +/* ev-document-links.h + * this file is part of evince, a gnome document_links viewer + * + * Copyright (C) 2004 Red Hat, Inc. + * + * Author: + * Jonathan Blandford <jrb@alum.mit.edu> + * + * Evince is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Evince is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "ev-document-links.h" + +GType +ev_document_links_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo our_info = + { + sizeof (EvDocumentLinksIface), + NULL, + NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, + "EvDocumentLinks", + &our_info, (GTypeFlags)0); + } + + return type; +} + +gboolean +ev_document_links_has_document_links (EvDocumentLinks *document_links) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + return iface->has_document_links (document_links); +} + +EvDocumentLinksIter * +ev_document_links_begin_read (EvDocumentLinks *document_links) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + + return iface->begin_read (document_links); +} + +EvLink * +ev_document_links_get_link (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + + return iface->get_link (document_links, iter); +} + +EvDocumentLinksIter * +ev_document_links_get_child (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + + return iface->get_child (document_links, iter); +} + + +gboolean +ev_document_links_next (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + + return iface->next (document_links, iter); +} + + +void +ev_document_links_free_iter (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter) +{ + EvDocumentLinksIface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); + + iface->free_iter (document_links, iter); +} diff --git a/backend/ev-document-links.h b/backend/ev-document-links.h new file mode 100644 index 0000000..4576e8c --- /dev/null +++ b/backend/ev-document-links.h @@ -0,0 +1,80 @@ +/* ev-document-links.h + * this file is part of evince, a gnome document_links viewer + * + * Copyright (C) 2004 Red Hat, Inc. + * + * Author: + * Jonathan Blandford <jrb@alum.mit.edu> + * + * Evince is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Evince is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef EV_DOCUMENT_LINKS_H +#define EV_DOCUMENT_LINKS_H + +#include <glib-object.h> +#include <glib.h> +#include <gdk/gdk.h> + +#include "ev-document.h" +#include "ev-link.h" + +G_BEGIN_DECLS + + +#define EV_TYPE_DOCUMENT_LINKS (ev_document_links_get_type ()) +#define EV_DOCUMENT_LINKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_LINKS, EvDocumentLinks)) +#define EV_DOCUMENT_LINKS_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_LINKS, EvDocumentLinksIface)) +#define EV_IS_DOCUMENT_LINKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_LINKS)) +#define EV_IS_DOCUMENT_LINKS_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_LINKS)) +#define EV_DOCUMENT_LINKS_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_LINKS, EvDocumentLinksIface)) + +typedef struct _EvDocumentLinks EvDocumentLinks; +typedef struct _EvDocumentLinksIface EvDocumentLinksIface; +typedef struct _EvDocumentLinksIter EvDocumentLinksIter; + +struct _EvDocumentLinksIface +{ + GTypeInterface base_iface; + + /* Methods */ + gboolean (* has_document_links) (EvDocumentLinks *document_links); + EvDocumentLinksIter *(* begin_read) (EvDocumentLinks *document_links); + EvLink *(* get_link) (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); + EvDocumentLinksIter *(* get_child) (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); + gboolean (* next) (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); + void (* free_iter) (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); +}; + +GType ev_document_links_get_type (void); +gboolean ev_document_links_has_document_links (EvDocumentLinks *document_links); +EvDocumentLinksIter *ev_document_links_begin_read (EvDocumentLinks *document_links); +EvLink *ev_document_links_get_link (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); +EvDocumentLinksIter *ev_document_links_get_child (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); +gboolean ev_document_links_next (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); +void ev_document_links_free_iter (EvDocumentLinks *document_links, + EvDocumentLinksIter *iter); + + +G_END_DECLS + +#endif diff --git a/backend/ev-bookmark.c b/backend/ev-link.c index f2d9f23..14ef3a2 100644 --- a/backend/ev-bookmark.c +++ b/backend/ev-link.c @@ -22,7 +22,7 @@ #include "config.h" #endif -#include "ev-bookmark.h" +#include "ev-link.h" enum { PROP_0, @@ -32,51 +32,51 @@ enum { PROP_URI }; -struct _EvBookmarkPrivate { +struct _EvLinkPrivate { char *title; char *uri; - EvBookmarkType type; + EvLinkType type; int page; }; static GObjectClass *parent_class = NULL; -G_DEFINE_TYPE (EvBookmark, ev_bookmark, G_TYPE_OBJECT) +G_DEFINE_TYPE (EvLink, ev_link, G_TYPE_OBJECT) -#define EV_BOOKMARK_GET_PRIVATE(object) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_BOOKMARK, EvBookmarkPrivate)) +#define EV_LINK_GET_PRIVATE(object) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_LINK, EvLinkPrivate)) GType -ev_bookmark_type_get_type (void) +ev_link_type_get_type (void) { static GType type = 0; if (G_UNLIKELY (type == 0)) { static const GEnumValue values[] = { - { EV_BOOKMARK_TYPE_TITLE, "EV_BOOKMARK_TYPE_TITLE", "title" }, - { EV_BOOKMARK_TYPE_LINK, "EV_BOOKMARK_TYPE_LINK", "link" }, - { EV_BOOKMARK_TYPE_EXTERNAL_URI, "EV_BOOKMARK_TYPE_EXTERNAL_URI", "external" }, + { EV_LINK_TYPE_TITLE, "EV_LINK_TYPE_TITLE", "title" }, + { EV_LINK_TYPE_PAGE, "EV_LINK_TYPE_PAGE", "page" }, + { EV_LINK_TYPE_EXTERNAL_URI, "EV_LINK_TYPE_EXTERNAL_URI", "external" }, { 0, NULL, NULL } }; - type = g_enum_register_static ("EvBookmarkType", values); + type = g_enum_register_static ("EvLinkType", values); } return type; } const char * -ev_bookmark_get_title (EvBookmark *self) +ev_link_get_title (EvLink *self) { - g_return_val_if_fail (EV_IS_BOOKMARK (self), NULL); + g_return_val_if_fail (EV_IS_LINK (self), NULL); return self->priv->title; } void -ev_bookmark_set_title (EvBookmark* self, const char *title) +ev_link_set_title (EvLink* self, const char *title) { - g_assert (EV_IS_BOOKMARK (self)); + g_assert (EV_IS_LINK (self)); g_assert (title != NULL); if (self->priv->title != NULL) { @@ -89,17 +89,17 @@ ev_bookmark_set_title (EvBookmark* self, const char *title) } const char * -ev_bookmark_get_uri (EvBookmark *self) +ev_link_get_uri (EvLink *self) { - g_return_val_if_fail (EV_IS_BOOKMARK (self), NULL); + g_return_val_if_fail (EV_IS_LINK (self), NULL); return self->priv->uri; } void -ev_bookmark_set_uri (EvBookmark* self, const char *uri) +ev_link_set_uri (EvLink* self, const char *uri) { - g_assert (EV_IS_BOOKMARK (self)); + g_assert (EV_IS_LINK (self)); g_assert (uri != NULL); if (self->priv->uri != NULL) { @@ -111,18 +111,18 @@ ev_bookmark_set_uri (EvBookmark* self, const char *uri) g_object_notify (G_OBJECT (self), "uri"); } -EvBookmarkType -ev_bookmark_get_bookmark_type (EvBookmark *self) +EvLinkType +ev_link_get_link_type (EvLink *self) { - g_return_val_if_fail (EV_IS_BOOKMARK (self), 0); + g_return_val_if_fail (EV_IS_LINK (self), 0); return self->priv->type; } void -ev_bookmark_set_bookmark_type (EvBookmark* self, EvBookmarkType type) +ev_link_set_link_type (EvLink* self, EvLinkType type) { - g_assert (EV_IS_BOOKMARK (self)); + g_assert (EV_IS_LINK (self)); self->priv->type = type; @@ -130,17 +130,17 @@ ev_bookmark_set_bookmark_type (EvBookmark* self, EvBookmarkType type) } int -ev_bookmark_get_page (EvBookmark *self) +ev_link_get_page (EvLink *self) { - g_return_val_if_fail (EV_IS_BOOKMARK (self), 0); + g_return_val_if_fail (EV_IS_LINK (self), 0); return self->priv->page; } void -ev_bookmark_set_page (EvBookmark* self, int page) +ev_link_set_page (EvLink* self, int page) { - g_assert (EV_IS_BOOKMARK (self)); + g_assert (EV_IS_LINK (self)); self->priv->page = page; @@ -148,12 +148,12 @@ ev_bookmark_set_page (EvBookmark* self, int page) } static void -ev_bookmark_get_property (GObject *object, guint prop_id, GValue *value, - GParamSpec *param_spec) +ev_link_get_property (GObject *object, guint prop_id, GValue *value, + GParamSpec *param_spec) { - EvBookmark *self; + EvLink *self; - self = EV_BOOKMARK (object); + self = EV_LINK (object); switch (prop_id) { case PROP_TITLE: @@ -177,25 +177,25 @@ ev_bookmark_get_property (GObject *object, guint prop_id, GValue *value, } static void -ev_bookmark_set_property (GObject *object, guint prop_id, const GValue *value, - GParamSpec *param_spec) +ev_link_set_property (GObject *object, guint prop_id, const GValue *value, + GParamSpec *param_spec) { - EvBookmark *self; + EvLink *self; - self = EV_BOOKMARK (object); + self = EV_LINK (object); switch (prop_id) { case PROP_TITLE: - ev_bookmark_set_title (self, g_value_get_string (value)); + ev_link_set_title (self, g_value_get_string (value)); break; case PROP_URI: - ev_bookmark_set_uri (self, g_value_get_string (value)); + ev_link_set_uri (self, g_value_get_string (value)); break; case PROP_TYPE: - ev_bookmark_set_bookmark_type (self, g_value_get_enum (value)); + ev_link_set_link_type (self, g_value_get_enum (value)); break; case PROP_PAGE: - ev_bookmark_set_page (self, g_value_get_int (value)); + ev_link_set_page (self, g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, @@ -208,11 +208,11 @@ ev_bookmark_set_property (GObject *object, guint prop_id, const GValue *value, static void ev_window_dispose (GObject *object) { - EvBookmarkPrivate *priv; + EvLinkPrivate *priv; - g_return_if_fail (EV_IS_BOOKMARK (object)); + g_return_if_fail (EV_IS_LINK (object)); - priv = EV_BOOKMARK (object)->priv; + priv = EV_LINK (object)->priv; if (priv->title) { g_free (priv->title); @@ -223,15 +223,15 @@ ev_window_dispose (GObject *object) } static void -ev_bookmark_init (EvBookmark *ev_bookmark) +ev_link_init (EvLink *ev_link) { - ev_bookmark->priv = EV_BOOKMARK_GET_PRIVATE (ev_bookmark); + ev_link->priv = EV_LINK_GET_PRIVATE (ev_link); - ev_bookmark->priv->type = EV_BOOKMARK_TYPE_TITLE; + ev_link->priv->type = EV_LINK_TYPE_TITLE; } static void -ev_bookmark_class_init (EvBookmarkClass *ev_window_class) +ev_link_class_init (EvLinkClass *ev_window_class) { GObjectClass *g_object_class; @@ -239,72 +239,72 @@ ev_bookmark_class_init (EvBookmarkClass *ev_window_class) g_object_class = G_OBJECT_CLASS (ev_window_class); g_object_class->dispose = ev_window_dispose; - g_object_class->set_property = ev_bookmark_set_property; - g_object_class->get_property = ev_bookmark_get_property; + g_object_class->set_property = ev_link_set_property; + g_object_class->get_property = ev_link_get_property; - g_type_class_add_private (g_object_class, sizeof (EvBookmarkPrivate)); + g_type_class_add_private (g_object_class, sizeof (EvLinkPrivate)); g_object_class_install_property (g_object_class, PROP_TITLE, g_param_spec_string ("title", - "Bookmark Title", - "The bookmark title", + "Link Title", + "The link title", NULL, G_PARAM_READWRITE)); g_object_class_install_property (g_object_class, PROP_URI, g_param_spec_string ("uri", - "Bookmark URI", - "The bookmark URI", + "Link URI", + "The link URI", NULL, G_PARAM_READWRITE)); g_object_class_install_property (g_object_class, PROP_TYPE, g_param_spec_enum ("type", - "Bookmark Type", - "The bookmark type", - EV_TYPE_BOOKMARK_TYPE, - EV_BOOKMARK_TYPE_TITLE, + "Link Type", + "The link type", + EV_TYPE_LINK_TYPE, + EV_LINK_TYPE_TITLE, G_PARAM_READWRITE)); g_object_class_install_property (g_object_class, PROP_PAGE, g_param_spec_int ("page", - "Bookmark Page", - "The bookmark page", + "Link Page", + "The link page", 0, G_MAXINT, 0, G_PARAM_READWRITE)); } -EvBookmark * -ev_bookmark_new_title (const char *title) +EvLink * +ev_link_new_title (const char *title) { - return EV_BOOKMARK (g_object_new (EV_TYPE_BOOKMARK, - "title", title, - "type", EV_BOOKMARK_TYPE_TITLE, - NULL)); + return EV_LINK (g_object_new (EV_TYPE_LINK, + "title", title, + "type", EV_LINK_TYPE_TITLE, + NULL)); } -EvBookmark * -ev_bookmark_new_link (const char *title, int page) +EvLink * +ev_link_new_page (const char *title, int page) { - return EV_BOOKMARK (g_object_new (EV_TYPE_BOOKMARK, - "title", title, - "page", page, - "type", EV_BOOKMARK_TYPE_LINK, - NULL)); + return EV_LINK (g_object_new (EV_TYPE_LINK, + "title", title, + "page", page, + "type", EV_LINK_TYPE_PAGE, + NULL)); } -EvBookmark * -ev_bookmark_new_external (const char *title, const char *uri) +EvLink * +ev_link_new_external (const char *title, const char *uri) { - return EV_BOOKMARK (g_object_new (EV_TYPE_BOOKMARK, - "title", title, - "uri", uri, - "type", EV_BOOKMARK_TYPE_EXTERNAL_URI, - NULL)); + return EV_LINK (g_object_new (EV_TYPE_LINK, + "title", title, + "uri", uri, + "type", EV_LINK_TYPE_EXTERNAL_URI, + NULL)); } diff --git a/backend/ev-link.h b/backend/ev-link.h new file mode 100644 index 0000000..00d97c4 --- /dev/null +++ b/backend/ev-link.h @@ -0,0 +1,79 @@ +/* this file is part of evince, a gnome document viewer + * + * Copyright (C) 2005 Red Hat, Inc. + * + * Evince is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Evince is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef EV_LINK_H +#define EV_LINK_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +typedef struct _EvLink EvLink; +typedef struct _EvLinkClass EvLinkClass; +typedef struct _EvLinkPrivate EvLinkPrivate; + +#define EV_TYPE_LINK (ev_link_get_type()) +#define EV_LINK(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_LINK, EvLink)) +#define EV_LINK_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), EV_TYPE_LINK, EvLinkClass)) +#define EV_IS_LINK(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_LINK)) +#define EV_IS_LINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_LINK)) +#define EV_LINK_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_LINK, EvLinkClass)) + +#define EV_TYPE_LINK_TYPE (ev_link_type_get_type ()) + +typedef enum +{ + EV_LINK_TYPE_TITLE, + EV_LINK_TYPE_PAGE, + EV_LINK_TYPE_EXTERNAL_URI +} EvLinkType; + +struct _EvLink { + GObject base_instance; + EvLinkPrivate *priv; +}; + +struct _EvLinkClass { + GObjectClass base_class; +}; + +GType ev_link_type_get_type (void); +GType ev_link_get_type (void); + +EvLink *ev_link_new_title (const char *title); +EvLink *ev_link_new_page (const char *title, + int page); +EvLink *ev_link_new_external (const char *title, + const char *uri); +const char *ev_link_get_title (EvLink *link); +void ev_link_set_title (EvLink *link, + const char *title); +const char *ev_link_get_uri (EvLink *link); +void ev_link_set_uri (EvLink *link, + const char *uri); +EvLinkType ev_link_get_link_type (EvLink *link); +void ev_link_set_link_type (EvLink *link, + EvLinkType type); +int ev_link_get_page (EvLink *link); +void ev_link_set_page (EvLink *link, + int page); + +G_END_DECLS + +#endif /* !EV_LINK_H */ |