1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
<title>TnyMsgView</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
7
<link rel="start" href="index.html" title="Reference Manual of the tinymail framework">
8
<link rel="up" href="libtinymailui.html" title="libtinymailui - ui abstraction library">
9
<link rel="prev" href="libtinymail-tny-header-view.html" title="TnyHeaderView">
10
<link rel="next" href="libtinymail-tny-msg-window.html" title="TnyMsgWindow">
11
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="preface" href="pr01.html" title="Introduction">
14
<link rel="reference" href="rn01.html" title="Object Index">
15
<link rel="reference" href="rn02.html" title="API Reference">
16
<link rel="chapter" href="libtinymail.html" title="libtinymail - main abstraction library">
17
<link rel="chapter" href="libtinymailui.html" title="libtinymailui - ui abstraction library">
18
<link rel="chapter" href="libtinymailui-gtk.html" title="libtinymailui-gtk - an optional ui implementation library">
19
<link rel="chapter" href="libtinymail-gnomevfs.html" title="libtinymail-gnomevfs - an optional implementation library">
20
<link rel="chapter" href="libtinymailui-mozembed.html" title="libtinymailui-mozembed - an optional ui implementation library">
21
<link rel="chapter" href="libtinymail-gnome-desktop.html" title="libtinymail-gnome-desktop - implementations for a gnome desktop">
22
<link rel="chapter" href="libtinymail-camel.html" title="libtinymail-camel - implementation of the main library">
23
<link rel="index" href="ix01.html" title="Index">
25
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
26
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
28
<td><a accesskey="p" href="libtinymail-tny-header-view.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
29
<td><a accesskey="u" href="libtinymailui.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
30
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
31
<th width="100%" align="center">Reference Manual of the tinymail framework</th>
32
<td><a accesskey="n" href="libtinymail-tny-msg-window.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
34
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2658371" class="shortcut">Top</a>
36
<a href="#id2658669" class="shortcut">Description</a>
38
<a href="#id2658562" class="shortcut">Object Hierarchy</a>
40
<a href="#id2658587" class="shortcut">Prerequisites</a>
42
<a href="#id2658609" class="shortcut">Known Derived Interfaces</a>
44
<a href="#id2658632" class="shortcut">Known Implementations</a></nobr></td></tr>
46
<div class="refentry" lang="en">
47
<a name="libtinymail-tny-msg-view"></a><div class="titlepage"></div>
48
<div class="refnamediv"><table width="100%"><tr>
51
<a name="id2658371"></a><span class="refentrytitle">TnyMsgView</span>
53
<p>TnyMsgView — A type that defines a view for a message</p>
55
<td valign="top" align="right"></td>
57
<div class="refsynopsisdiv">
59
<a name="TnyMsgView"></a><pre class="synopsis">
63
<a href="libtinymail-tny-msg-view.html#TnyMsgView-struct">TnyMsgView</a>;
64
<a href="libtinymail-tny-msg-view.html#TnyMsgViewIface">TnyMsgViewIface</a>;
65
<a href="libtinymail-tny-msg.html#TnyMsg">TnyMsg</a>* <a href="libtinymail-tny-msg-view.html#tny-msg-view-get-msg">tny_msg_view_get_msg</a> (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);
66
void <a href="libtinymail-tny-msg-view.html#tny-msg-view-set-msg">tny_msg_view_set_msg</a> (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self,
67
<a href="libtinymail-tny-msg.html#TnyMsg">TnyMsg</a> *msg);
68
void <a href="libtinymail-tny-msg-view.html#tny-msg-view-clear">tny_msg_view_clear</a> (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);
69
void <a href="libtinymail-tny-msg-view.html#tny-msg-view-set-unavailable">tny_msg_view_set_unavailable</a> (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);
70
<a href="libtinymail-tny-mime-part-view.html#TnyMimePartView">TnyMimePartView</a>* <a href="libtinymail-tny-msg-view.html#tny-msg-view-create-mime-part-view-for">tny_msg_view_create_mime_part_view_for</a>
71
(<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self,
72
<a href="libtinymail-tny-mime-part.html#TnyMimePart">TnyMimePart</a> *part);
73
<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a>* <a href="libtinymail-tny-msg-view.html#tny-msg-view-create-new-inline-viewer">tny_msg_view_create_new_inline_viewer</a>
74
(<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);
78
<div class="refsect1" lang="en">
79
<a name="id2658562"></a><h2>Object Hierarchy</h2>
80
<pre class="synopsis">
86
<div class="refsect1" lang="en">
87
<a name="id2658587"></a><h2>Prerequisites</h2>
90
<a href="libtinymail-tny-mime-part-view.html#TnyMimePartView">TnyMimePartView</a>.</p>
92
<div class="refsect1" lang="en">
93
<a name="id2658609"></a><h2>Known Derived Interfaces</h2>
95
TnyMsgView is required by
96
<a href="libtinymail-tny-msg-window.html#TnyMsgWindow">TnyMsgWindow</a>.</p>
98
<div class="refsect1" lang="en">
99
<a name="id2658632"></a><h2>Known Implementations</h2>
101
TnyMsgView is implemented by
102
<a href="TnyMozEmbedMsgView.html" title="TnyMozEmbedMsgView">TnyMozEmbedMsgView</a>, <a href="TnyGtkMsgView.html" title="TnyGtkMsgView">TnyGtkMsgView</a> and <a href="TnyGtkMsgWindow.html" title="TnyGtkMsgWindow">TnyGtkMsgWindow</a>.</p>
104
<div class="refsect1" lang="en">
105
<a name="id2658669"></a><h2>Description</h2>
107
A type that defines a view for a <a href="libtinymail-tny-msg.html#TnyMsg"><span class="type">TnyMsg</span></a> implementation. The type is sometimes decorated by a
108
<a href="libtinymail-tny-msg-window.html#TnyMsgWindow"><span class="type">TnyMsgWindow</span></a> implementation.
111
<div class="refsect1" lang="en">
112
<a name="id2658702"></a><h2>Details</h2>
113
<div class="refsect2" lang="en">
114
<a name="id2658712"></a><h3>
115
<a name="TnyMsgView-struct"></a>TnyMsgView</h3>
116
<a class="indexterm" name="id2658725"></a><pre class="programlisting">typedef struct _TnyMsgView TnyMsgView;</pre>
122
<div class="refsect2" lang="en">
123
<a name="id2658740"></a><h3>
124
<a name="TnyMsgViewIface"></a>TnyMsgViewIface</h3>
125
<a class="indexterm" name="id2658753"></a><pre class="programlisting">typedef struct {
126
GTypeInterface parent;
128
TnyMsg* (*get_msg_func) (TnyMsgView *self);
129
void (*set_msg_func) (TnyMsgView *self, TnyMsg *msg);
130
void (*set_unavailable_func) (TnyMsgView *self);
131
void (*clear_func) (TnyMsgView *self);
132
TnyMimePartView* (*create_mime_part_view_for_func) (TnyMsgView *self, TnyMimePart *part);
133
TnyMsgView* (*create_new_inline_viewer_func) (TnyMsgView *self);
141
<div class="refsect2" lang="en">
142
<a name="id2658775"></a><h3>
143
<a name="tny-msg-view-get-msg"></a>tny_msg_view_get_msg ()</h3>
144
<a class="indexterm" name="id2658788"></a><pre class="programlisting"><a href="libtinymail-tny-msg.html#TnyMsg">TnyMsg</a>* tny_msg_view_get_msg (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);</pre>
146
Get the current message of <em class="parameter"><code>self</code></em>. If <em class="parameter"><code>self</code></em> is not displaying any message,
147
NULL will be returned. Else the return value must be unreferenced after use.
150
Implementors: this method should return the mime part this view is currently
151
viewing. It must add a reference to the instance before returning it. If the
152
view isn't viewing any mime part, it must return NULL.
155
Usually this method is an alias for tny_mime_part_view_get_part of
156
<a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a></p>
160
<div class="variablelist"><table border="0">
161
<col align="left" valign="top">
164
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
165
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
169
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
170
<td> A <a href="libtinymail-tny-msg.html#TnyMsg"><span class="type">TnyMsg</span></a> instance or NULL
177
<div class="refsect2" lang="en">
178
<a name="id2658896"></a><h3>
179
<a name="tny-msg-view-set-msg"></a>tny_msg_view_set_msg ()</h3>
180
<a class="indexterm" name="id2658910"></a><pre class="programlisting">void tny_msg_view_set_msg (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self,
181
<a href="libtinymail-tny-msg.html#TnyMsg">TnyMsg</a> *msg);</pre>
183
Set the message which view <em class="parameter"><code>self</code></em> must display.
186
Implementors: this method should cause <em class="parameter"><code>self</code></em> to show <em class="parameter"><code>msg</code></em> to the user.
187
This includes showing the header (for which you can make a composition with
188
a <a href="libtinymail-tny-header-view.html#TnyHeaderView"><span class="type">TnyHeaderView</span></a>), the message body and the attachments (for which you
189
typically use the <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a> interface and implementations).
192
You can get a list of mime parts using the tny_mime_part_get_parts API of
193
the <a href="libtinymail-tny-mime-part.html#TnyMimePart"><span class="type">TnyMimePart</span></a> type. You can use the tny_msg_view_create_mime_part_view_for
194
API to get an instance of a <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a> that can view the mime part.
197
Usually this method is an alias or decorator for tny_mime_part_view_set_part
198
of <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a>
203
<div class="informalexample"><pre class="programlisting">
205
tny_my_msg_view_set_msg (TnyMsgView *self, TnyMsg *msg)
207
TnyIterator *iterator;
208
TnyList *list = tny_simple_list_new ();
209
tny_msg_view_clear (self);
210
header = tny_msg_get_header (msg);
211
tny_header_view_set_header (priv->headerview, header);
212
g_object_unref (G_OBJECT (header));
213
tny_mime_part_view_set_part (TNY_MIME_PART_VIEW (self),
214
TNY_MIME_PART (msg));
215
tny_mime_part_get_parts (TNY_MIME_PART (msg), list);
216
iterator = tny_list_create_iterator (list);
217
while (!tny_iterator_is_done (iterator))
219
TnyMimePart *part = tny_iterator_get_current (iterator);
220
TnyMimePartView *mpview;
221
mpview = tny_msg_view_create_mime_part_view_for (self, part);
223
tny_mime_part_view_set_part (mpview, part);
224
g_object_unref (G_OBJECT(part));
225
tny_iterator_next (iterator);
227
g_object_unref (G_OBJECT (iterator));
228
g_object_unref (G_OBJECT (list));
234
ps. For a real and complete working example take a look at the implementation of
235
<a href="TnyGtkMsgView.html" title="TnyGtkMsgView"><span class="type">TnyGtkMsgView</span></a> in libtinymailui-gtk.</p>
239
<div class="variablelist"><table border="0">
240
<col align="left" valign="top">
243
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
244
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
248
<td><span class="term"><em class="parameter"><code>msg</code></em> :</span></td>
249
<td> A <a href="libtinymail-tny-msg.html#TnyMsg"><span class="type">TnyMsg</span></a> instace
256
<div class="refsect2" lang="en">
257
<a name="id2659130"></a><h3>
258
<a name="tny-msg-view-clear"></a>tny_msg_view_clear ()</h3>
259
<a class="indexterm" name="id2659144"></a><pre class="programlisting">void tny_msg_view_clear (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);</pre>
261
Clear <em class="parameter"><code>self</code></em> (show nothing)
264
Implementors: this method should clear <em class="parameter"><code>self</code></em> (display nothing and clearup)</p>
268
<div class="variablelist"><table border="0">
269
<col align="left" valign="top">
271
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
272
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
278
<div class="refsect2" lang="en">
279
<a name="id2659217"></a><h3>
280
<a name="tny-msg-view-set-unavailable"></a>tny_msg_view_set_unavailable ()</h3>
281
<a class="indexterm" name="id2659231"></a><pre class="programlisting">void tny_msg_view_set_unavailable (<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);</pre>
283
Set <em class="parameter"><code>self</code></em> to display that a message was unavailable
286
Implementors: this method should set <em class="parameter"><code>self</code></em> to display a message like
287
"Message unavailable" or trigger another indication that a specific message
292
<div class="variablelist"><table border="0">
293
<col align="left" valign="top">
295
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
296
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
302
<div class="refsect2" lang="en">
303
<a name="id2659307"></a><h3>
304
<a name="tny-msg-view-create-mime-part-view-for"></a>tny_msg_view_create_mime_part_view_for ()</h3>
305
<a class="indexterm" name="id2659322"></a><pre class="programlisting"><a href="libtinymail-tny-mime-part-view.html#TnyMimePartView">TnyMimePartView</a>* tny_msg_view_create_mime_part_view_for
306
(<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self,
307
<a href="libtinymail-tny-mime-part.html#TnyMimePart">TnyMimePart</a> *part);</pre>
309
Create a <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a> instance for viewing <em class="parameter"><code>part</code></em>. The returned instance
310
must be unreferenced after use.
313
Implementors: This method should create and return a new <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a>
314
that is suitable for displaying <em class="parameter"><code>part</code></em>.
319
<div class="informalexample"><pre class="programlisting">
320
static TnyMimePartView*
321
tny_my_html_msg_view_create_mime_part_view_for (TnyMsgView *self, TnyMimePart *part)
323
TnyMimePartView *retval = NULL;
324
g_assert (TNY_IS_MIME_PART (part));
325
if (tny_mime_part_content_type_is (part, "text/html"))
327
GtkWidget *widget = (GtkWidget *) self;
328
retval = tny_my_html_mime_part_view_new ();
330
retval = TNY_GTK_MSG_VIEW_CLASS (parent_class)->create_mime_part_view_for_func (self, part);
337
ps. For a real and complete working example take a look at the implementation of
338
<a href="TnyMozEmbedMsgView.html" title="TnyMozEmbedMsgView"><span class="type">TnyMozEmbedMsgView</span></a> in libtinymailui-mozembed.</p>
342
<div class="variablelist"><table border="0">
343
<col align="left" valign="top">
346
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
347
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
351
<td><span class="term"><em class="parameter"><code>part</code></em> :</span></td>
352
<td> A <a href="libtinymail-tny-mime-part.html#TnyMimePart"><span class="type">TnyMimePart</span></a> instance
356
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
357
<td> A <a href="libtinymail-tny-mime-part-view.html#TnyMimePartView"><span class="type">TnyMimePartView</span></a> instance for viewing <em class="parameter"><code>part</code></em>
364
<div class="refsect2" lang="en">
365
<a name="id2659508"></a><h3>
366
<a name="tny-msg-view-create-new-inline-viewer"></a>tny_msg_view_create_new_inline_viewer ()</h3>
367
<a class="indexterm" name="id2659522"></a><pre class="programlisting"><a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a>* tny_msg_view_create_new_inline_viewer
368
(<a href="libtinymail-tny-msg-view.html#TnyMsgView">TnyMsgView</a> *self);</pre>
370
Create a new <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> that can be used to display an inline message.
371
Usually it will return a new instance of the same type as <em class="parameter"><code>self</code></em>. The
372
returned instance must be unreferenced after use.
375
Implementors: This method should create and return a new <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
376
usually of the same type as <em class="parameter"><code>self</code></em>. This method will be used when a
377
<a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> needs to create a <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance for displaying inlined
378
messages (like what message/rfc822 mime parts are). For example the
379
<a href="TnyGtkMsgView.html" title="TnyGtkMsgView"><span class="type">TnyGtkMsgView</span></a> implementation will use this method to create for itself a
380
new <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance that it can embed in itself.
385
<div class="informalexample"><pre class="programlisting">
387
tny_my_html_msg_view_create_new_inline_viewer (TnyMsgView *self)
389
return tny_my_html_msg_view_new ();
395
Note that if you want to pass contructor parameters, that you will have to
396
store them yourself (for example in a static global field in the .c file) and
397
repeat them in the new instance that will be created by this method.</p>
401
<div class="variablelist"><table border="0">
402
<col align="left" valign="top">
405
<td><span class="term"><em class="parameter"><code>self</code></em> :</span></td>
406
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
410
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
411
<td> A <a href="libtinymail-tny-msg-view.html#TnyMsgView"><span class="type">TnyMsgView</span></a> instance
418
<div class="refsect1" lang="en">
419
<a name="id2659691"></a><h2>See Also</h2>
421
<a href="libtinymail-tny-msg.html#TnyMsg"><span class="type">TnyMsg</span></a>, <span class="type">TnyMsgMimePart</span>, <a href="libtinymail-tny-msg-window.html#TnyMsgWindow"><span class="type">TnyMsgWindow</span></a>, <a href="TnyGtkMsgView.html" title="TnyGtkMsgView"><span class="type">TnyGtkMsgView</span></a>, <a href="TnyGtkMsgWindow.html" title="TnyGtkMsgWindow"><span class="type">TnyGtkMsgWindow</span></a>