File: ev-media.c

package info (click to toggle)
evince 48.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,028 kB
  • sloc: ansic: 73,001; xml: 288; sh: 129; makefile: 22
file content (103 lines) | stat: -rw-r--r-- 2,578 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* 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_WITH_PRIVATE (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;
}

static void
ev_media_init (EvMedia *media)
{
        media->priv = ev_media_get_instance_private (media);
}

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;
}