~noskcaj/ubuntu/vivid/gnome-keyring/3.15.90

« back to all changes in this revision

Viewing changes to gcr/gcr-viewer.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-14 22:13:02 UTC
  • mfrom: (1.3.1)
  • mto: (80.2.8 experimental) (1.1.77)
  • mto: This revision was merged to the branch mainline in revision 148.
  • Revision ID: package-import@ubuntu.com-20120514221302-0l3gjmqpe6xopond
ImportĀ upstreamĀ versionĀ 3.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2008 Stefan Walter
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU Lesser General Public License as
6
 
 * published by the Free Software Foundation; either version 2.1 of
7
 
 * the License, or (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful, but
10
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
 * Lesser General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU Lesser General Public
15
 
 * License along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17
 
 * 02111-1307, USA.
18
 
 */
19
 
 
20
 
#include "config.h"
21
 
 
22
 
#include "gcr-display-scrolled.h"
23
 
#include "gcr-display-view.h"
24
 
#include "gcr-renderer.h"
25
 
#include "gcr-viewer.h"
26
 
 
27
 
/* -----------------------------------------------------------------------------
28
 
 * INTERFACE
29
 
 */
30
 
 
31
 
static void
32
 
gcr_viewer_base_init (gpointer gobject_iface)
33
 
{
34
 
        static gboolean initialized = FALSE;
35
 
        if (!initialized) {
36
 
 
37
 
                initialized = TRUE;
38
 
        }
39
 
}
40
 
 
41
 
GType
42
 
gcr_viewer_get_type (void)
43
 
{
44
 
        static GType type = 0;
45
 
        if (!type) {
46
 
                static const GTypeInfo info = {
47
 
                        sizeof (GcrViewerIface),
48
 
                        gcr_viewer_base_init,  /* base init */
49
 
                        NULL,                  /* base finalize */
50
 
                };
51
 
                type = g_type_register_static (G_TYPE_INTERFACE, "GcrViewerIface", &info, 0);
52
 
                g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
53
 
        }
54
 
 
55
 
        return type;
56
 
}
57
 
 
58
 
/* -----------------------------------------------------------------------------
59
 
 * PUBLIC
60
 
 */
61
 
 
62
 
GcrViewer*
63
 
gcr_viewer_new (void)
64
 
{
65
 
        return GCR_VIEWER (_gcr_display_view_new ());
66
 
}
67
 
 
68
 
GcrViewer*
69
 
gcr_viewer_new_scrolled (void)
70
 
{
71
 
        return GCR_VIEWER (_gcr_display_scrolled_new ());
72
 
}
73
 
 
74
 
void
75
 
gcr_viewer_add_renderer (GcrViewer *self, GcrRenderer *renderer)
76
 
{
77
 
        g_return_if_fail (GCR_IS_VIEWER (self));
78
 
        g_return_if_fail (GCR_IS_RENDERER (renderer));
79
 
        g_return_if_fail (GCR_VIEWER_GET_INTERFACE (self)->add_renderer);
80
 
        GCR_VIEWER_GET_INTERFACE (self)->add_renderer (self, renderer);
81
 
}
82
 
 
83
 
void
84
 
gcr_viewer_remove_renderer (GcrViewer *self, GcrRenderer *renderer)
85
 
{
86
 
        g_return_if_fail (GCR_IS_VIEWER (self));
87
 
        g_return_if_fail (GCR_IS_RENDERER (renderer));
88
 
        g_return_if_fail (GCR_VIEWER_GET_INTERFACE (self)->remove_renderer);
89
 
        GCR_VIEWER_GET_INTERFACE (self)->remove_renderer (self, renderer);
90
 
}
91
 
 
92
 
guint
93
 
gcr_viewer_count_renderers (GcrViewer *self)
94
 
{
95
 
        g_return_val_if_fail (GCR_IS_VIEWER (self), 0);
96
 
        g_return_val_if_fail (GCR_VIEWER_GET_INTERFACE (self)->count_renderers, 0);
97
 
        return GCR_VIEWER_GET_INTERFACE (self)->count_renderers (self);
98
 
}
99
 
 
100
 
GcrRenderer*
101
 
gcr_viewer_get_renderer (GcrViewer *self, guint index_)
102
 
{
103
 
        g_return_val_if_fail (GCR_IS_VIEWER (self), NULL);
104
 
        g_return_val_if_fail (GCR_VIEWER_GET_INTERFACE (self)->get_renderer, NULL);
105
 
        return GCR_VIEWER_GET_INTERFACE (self)->get_renderer (self, index_);
106
 
}