mirror of
https://gitlab.gnome.org/GNOME/evince
synced 2024-06-30 22:54:23 +00:00
libdocument: Add EvDcoumentMedia interface
This commit is contained in:
parent
cf424e5008
commit
61485ed2b3
|
@ -21,6 +21,7 @@ INST_H_SRC_FILES = \
|
|||
ev-document-info.h \
|
||||
ev-document-layers.h \
|
||||
ev-document-links.h \
|
||||
ev-document-media.h \
|
||||
ev-document-misc.h \
|
||||
ev-document-print.h \
|
||||
ev-document-security.h \
|
||||
|
@ -37,6 +38,7 @@ INST_H_SRC_FILES = \
|
|||
ev-link.h \
|
||||
ev-macros.h \
|
||||
ev-mapping-list.h \
|
||||
ev-media.h \
|
||||
ev-page.h \
|
||||
ev-render-context.h \
|
||||
ev-selection.h \
|
||||
|
@ -68,6 +70,7 @@ libevdocument3_la_SOURCES= \
|
|||
ev-document-fonts.c \
|
||||
ev-document-layers.c \
|
||||
ev-document-links.c \
|
||||
ev-document-media.c \
|
||||
ev-document-images.c \
|
||||
ev-document-print.c \
|
||||
ev-document-security.c \
|
||||
|
@ -80,6 +83,7 @@ libevdocument3_la_SOURCES= \
|
|||
ev-file-exporter.c \
|
||||
ev-file-helpers.c \
|
||||
ev-mapping-list.c \
|
||||
ev-media.c \
|
||||
ev-module.c \
|
||||
ev-page.c \
|
||||
ev-render-context.c \
|
||||
|
|
38
libdocument/ev-document-media.c
Normal file
38
libdocument/ev-document-media.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* ev-document-media.c
|
||||
* this file is part of evince, a gnome document_links viewer
|
||||
*
|
||||
* Copyright (C) 2015 Igalia S.L.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "ev-document-media.h"
|
||||
|
||||
G_DEFINE_INTERFACE (EvDocumentMedia, ev_document_media, 0)
|
||||
|
||||
static void
|
||||
ev_document_media_default_init (EvDocumentMediaInterface *klass)
|
||||
{
|
||||
}
|
||||
|
||||
EvMappingList *
|
||||
ev_document_media_get_media_mapping (EvDocumentMedia *document_media,
|
||||
EvPage *page)
|
||||
{
|
||||
EvDocumentMediaInterface *iface = EV_DOCUMENT_MEDIA_GET_IFACE (document_media);
|
||||
|
||||
return iface->get_media_mapping (document_media, page);
|
||||
}
|
61
libdocument/ev-document-media.h
Normal file
61
libdocument/ev-document-media.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* ev-document-media.h
|
||||
* this file is part of evince, a gnome document viewer
|
||||
*
|
||||
* Copyright (C) 2015 Igalia S.L.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__EV_EVINCE_DOCUMENT_H_INSIDE__) && !defined (EVINCE_COMPILATION)
|
||||
#error "Only <evince-document.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EV_DOCUMENT_MEDIA_H
|
||||
#define EV_DOCUMENT_MEDIA_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "ev-document.h"
|
||||
#include "ev-media.h"
|
||||
#include "ev-mapping-list.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EV_TYPE_DOCUMENT_MEDIA (ev_document_media_get_type ())
|
||||
#define EV_DOCUMENT_MEDIA(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_MEDIA, EvDocumentMedia))
|
||||
#define EV_IS_DOCUMENT_MEDIA(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT_MEDIA))
|
||||
#define EV_DOCUMENT_MEDIA_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_MEDIA, EvDocumentMediaInterface))
|
||||
#define EV_IS_DOCUMENT_MEDIA_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT_MEDIA))
|
||||
#define EV_DOCUMENT_MEDIA_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT_MEDIA, EvDocumentMediaInterface))
|
||||
|
||||
typedef struct _EvDocumentMedia EvDocumentMedia;
|
||||
typedef struct _EvDocumentMediaInterface EvDocumentMediaInterface;
|
||||
|
||||
struct _EvDocumentMediaInterface {
|
||||
GTypeInterface base_iface;
|
||||
|
||||
/* Methods */
|
||||
EvMappingList *(* get_media_mapping) (EvDocumentMedia *document_media,
|
||||
EvPage *page);
|
||||
};
|
||||
|
||||
GType ev_document_media_get_type (void) G_GNUC_CONST;
|
||||
EvMappingList *ev_document_media_get_media_mapping (EvDocumentMedia *document_media,
|
||||
EvPage *page);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* EV_DOCUMENT_MEDIA_H */
|
105
libdocument/ev-media.c
Normal file
105
libdocument/ev-media.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/* this file is part of evince, a gnome document viewer
|
||||
*
|
||||
* Copyright (C) 2015 Igalia S.L.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "ev-media.h"
|
||||
|
||||
struct _EvMediaPrivate {
|
||||
guint page;
|
||||
gchar *uri;
|
||||
gboolean show_controls;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (EvMedia, ev_media, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
ev_media_finalize (GObject *object)
|
||||
{
|
||||
EvMedia *media = EV_MEDIA (object);
|
||||
|
||||
g_clear_pointer (&media->priv->uri, g_free);
|
||||
|
||||
G_OBJECT_CLASS (ev_media_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ev_media_class_init (EvMediaClass *klass)
|
||||
{
|
||||
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_object_class->finalize = ev_media_finalize;
|
||||
|
||||
g_type_class_add_private (g_object_class, sizeof (EvMediaPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
ev_media_init (EvMedia *media)
|
||||
{
|
||||
media->priv = G_TYPE_INSTANCE_GET_PRIVATE (media, EV_TYPE_MEDIA, EvMediaPrivate);
|
||||
}
|
||||
|
||||
EvMedia *
|
||||
ev_media_new_for_uri (EvPage *page,
|
||||
const gchar *uri)
|
||||
{
|
||||
EvMedia *media;
|
||||
|
||||
g_return_val_if_fail (EV_IS_PAGE (page), NULL);
|
||||
g_return_val_if_fail (uri != NULL, NULL);
|
||||
|
||||
media = EV_MEDIA (g_object_new (EV_TYPE_MEDIA, NULL));
|
||||
media->priv->page = page->index;
|
||||
media->priv->uri = g_strdup (uri);
|
||||
|
||||
return media;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
ev_media_get_uri (EvMedia *media)
|
||||
{
|
||||
g_return_val_if_fail (EV_IS_MEDIA (media), NULL);
|
||||
|
||||
return media->priv->uri;
|
||||
}
|
||||
|
||||
guint
|
||||
ev_media_get_page_index (EvMedia *media)
|
||||
{
|
||||
g_return_val_if_fail (EV_IS_MEDIA (media), 0);
|
||||
|
||||
return media->priv->page;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ev_media_get_show_controls (EvMedia *media)
|
||||
{
|
||||
g_return_val_if_fail (EV_IS_MEDIA (media), FALSE);
|
||||
|
||||
return media->priv->show_controls;
|
||||
}
|
||||
|
||||
void
|
||||
ev_media_set_show_controls (EvMedia *media,
|
||||
gboolean show_controls)
|
||||
{
|
||||
g_return_if_fail (EV_IS_MEDIA (media));
|
||||
|
||||
media->priv->show_controls = show_controls;
|
||||
}
|
65
libdocument/ev-media.h
Normal file
65
libdocument/ev-media.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* this file is part of evince, a gnome document viewer
|
||||
*
|
||||
* Copyright (C) 2015 Igalia S.L.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__EV_EVINCE_DOCUMENT_H_INSIDE__) && !defined (EVINCE_COMPILATION)
|
||||
#error "Only <evince-document.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __EV_MEDIA_H__
|
||||
#define __EV_MEDIA_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "ev-page.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _EvMedia EvMedia;
|
||||
typedef struct _EvMediaClass EvMediaClass;
|
||||
typedef struct _EvMediaPrivate EvMediaPrivate;
|
||||
|
||||
#define EV_TYPE_MEDIA (ev_media_get_type())
|
||||
#define EV_MEDIA(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_MEDIA, EvMedia))
|
||||
#define EV_IS_MEDIA(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_MEDIA))
|
||||
#define EV_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_MEDIA, EvMediaClass))
|
||||
#define EV_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_MEDIA))
|
||||
#define EV_MEDIA_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_MEDIA, EvMediaClass))
|
||||
|
||||
struct _EvMedia {
|
||||
GObject base_instance;
|
||||
|
||||
EvMediaPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EvMediaClass {
|
||||
GObjectClass base_class;
|
||||
};
|
||||
|
||||
GType ev_media_get_type (void) G_GNUC_CONST;
|
||||
|
||||
EvMedia *ev_media_new_for_uri (EvPage *page,
|
||||
const gchar *uri);
|
||||
const gchar *ev_media_get_uri (EvMedia *media);
|
||||
guint ev_media_get_page_index (EvMedia *media);
|
||||
gboolean ev_media_get_show_controls (EvMedia *media);
|
||||
void ev_media_set_show_controls (EvMedia *media,
|
||||
gboolean show_controls);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __EV_MEDIA_H__ */
|
Loading…
Reference in New Issue
Block a user