1 /* Copyright (c) 2007, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <modest-mime-part-view.h>
33 #include <modest-marshal.h>
42 static guint mime_part_view_signals[LAST_SIGNAL] = { 0 };
45 * modest_mime_part_view_is_empty:
46 * @self: a #ModestMimePartView
48 * checks if the mail shown can be considered as empty or not.
50 * Returns: %TRUE if mail shown is empty, %FALSE otherwise.
53 modest_mime_part_view_is_empty (ModestMimePartView *self)
55 return MODEST_MIME_PART_VIEW_GET_IFACE (self)->is_empty_func (self);
59 * modest_mime_part_view_get_view_images:
60 * @self: a #ModestMimePartView
62 * checks if we have enabled capability to view contained images.
64 * Returns: %TRUE if we show images, %FALSE otherwise.
67 modest_mime_part_view_get_view_images (ModestMimePartView *self)
69 return MODEST_MIME_PART_VIEW_GET_IFACE (self)->get_view_images_func (self);
73 * modest_mime_part_view_set_view_images:
74 * @self: a #ModestMimePartView
75 * @view_images: a #gboolean
77 * set if we want to show images or not.
80 modest_mime_part_view_set_view_images (ModestMimePartView *self, gboolean view_images)
82 MODEST_MIME_PART_VIEW_GET_IFACE (self)->set_view_images_func (self, view_images);
86 * modest_mime_part_view_has_external_images:
87 * @self: a #ModestMimePartView
89 * checks if there are external images in the mime part.
91 * Returns: %TRUE if there are external images, %FALSE otherwise.
94 modest_mime_part_view_has_external_images (ModestMimePartView *self)
96 return MODEST_MIME_PART_VIEW_GET_IFACE (self)->has_external_images_func (self);
100 modest_mime_part_view_base_init (gpointer g_class)
102 static gboolean initialized = FALSE;
107 * ModestMimePartView::activate-link:
108 * @self: a #ModestMimePartView instance the signal is emitted
109 * @string: a string containing the URI
111 * This signal is emitted when a URI is activated
115 mime_part_view_signals[ACTIVATE_LINK] =
116 g_signal_new ("activate_link",
117 MODEST_TYPE_MIME_PART_VIEW,
119 G_STRUCT_OFFSET (ModestMimePartViewIface, activate_link),
121 modest_marshal_BOOLEAN__STRING,
125 * ModestMimePartView::link-hover:
126 * @self: a #ModestMimePartView instance the signal is emitted
127 * @string: a string containing the URI
129 * This signal is emitted when user passes the mouse over a link
133 mime_part_view_signals[LINK_HOVER] =
134 g_signal_new ("link_hover",
135 MODEST_TYPE_MIME_PART_VIEW,
137 G_STRUCT_OFFSET (ModestMimePartViewIface, link_hover),
139 modest_marshal_BOOLEAN__STRING,
144 * ModestMimePartView::fetch-url:
145 * @self: a #ModestMimePartView instance the signal is emitted
146 * @string: a string containing the URI
147 * @stream: a #TnyStream
149 * This signal is emitted when the page is rendered, and some
150 * url has to be resolved externally. You have to put the
151 * required information in the stream (images, etc).
155 mime_part_view_signals[FETCH_URL] =
156 g_signal_new ("fetch_url",
157 MODEST_TYPE_MIME_PART_VIEW,
159 G_STRUCT_OFFSET (ModestMimePartViewIface, fetch_url),
161 modest_marshal_BOOLEAN__STRING_OBJECT,
170 modest_mime_part_view_get_type (void)
172 static GType type = 0;
174 if (G_UNLIKELY(type == 0))
176 static const GTypeInfo info =
178 sizeof (ModestMimePartViewIface),
179 modest_mime_part_view_base_init, /* base_init */
180 NULL, /* base_finalize */
181 NULL, /* class_init */
182 NULL, /* class_finalize */
183 NULL, /* class_data */
186 NULL, /* instance_init */
190 type = g_type_register_static (G_TYPE_INTERFACE,
191 "ModestMimePartView", &info, 0);