* check for a valid foldername
[modest] / src / gnome / modest-msg-edit-window.c
1 /* Copyright (c) 2006, Nokia Corporation
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
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.
16  *
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.
28  */
29 #include <glib/gi18n.h>
30 #include <string.h>
31 #include <tny-account-store.h>
32 #include <tny-simple-list.h>
33 #include <modest-conf.h>
34 #include <modest-runtime.h>
35 #include <modest-tny-msg.h>
36
37 #include <widgets/modest-window-priv.h>
38 #include <widgets/modest-msg-edit-window.h>
39 #include <widgets/modest-msg-edit-window-ui.h>
40 #include <widgets/modest-combo-box.h>
41
42 #include <modest-widget-memory.h>
43 #include <modest-account-mgr-helpers.h>
44
45 static void  modest_msg_edit_window_class_init   (ModestMsgEditWindowClass *klass);
46 static void  modest_msg_edit_window_init         (ModestMsgEditWindow *obj);
47 static void  modest_msg_edit_window_finalize     (GObject *obj);
48
49 /* list my signals */
50 enum {
51         /* MY_SIGNAL_1, */
52         /* MY_SIGNAL_2, */
53         LAST_SIGNAL
54 };
55
56 typedef struct _ModestMsgEditWindowPrivate ModestMsgEditWindowPrivate;
57 struct _ModestMsgEditWindowPrivate {
58
59         GtkWidget   *toolbar;
60         GtkWidget   *menubar;
61
62         GtkWidget   *msg_body;
63         
64         ModestProtoList *from_field_protos;
65         GtkWidget   *from_field;
66         
67         GtkWidget   *to_field;
68         GtkWidget   *cc_field;
69         GtkWidget   *bcc_field;
70         GtkWidget   *subject_field;
71
72         gboolean    sent;
73 };
74
75 #define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
76                                                     MODEST_TYPE_MSG_EDIT_WINDOW, \
77                                                     ModestMsgEditWindowPrivate))
78 /* globals */
79 static GtkWindowClass *parent_class = NULL;
80
81 /* uncomment the following if you have defined any signals */
82 /* static guint signals[LAST_SIGNAL] = {0}; */
83
84 GType
85 modest_msg_edit_window_get_type (void)
86 {
87         static GType my_type = 0;
88         if (!my_type) {
89                 static const GTypeInfo my_info = {
90                         sizeof(ModestMsgEditWindowClass),
91                         NULL,           /* base init */
92                         NULL,           /* base finalize */
93                         (GClassInitFunc) modest_msg_edit_window_class_init,
94                         NULL,           /* class finalize */
95                         NULL,           /* class data */
96                         sizeof(ModestMsgEditWindow),
97                         1,              /* n_preallocs */
98                         (GInstanceInitFunc) modest_msg_edit_window_init,
99                         NULL
100                 };
101                 my_type = g_type_register_static (MODEST_TYPE_WINDOW,
102                                                   "ModestMsgEditWindow",
103                                                   &my_info, 0);
104         }
105         return my_type;
106 }
107
108
109 static void
110 save_state (ModestWindow *self)
111 {
112         modest_widget_memory_save (modest_runtime_get_conf (),
113                                     G_OBJECT(self), "modest-edit-msg-window");
114 }
115
116
117 static void
118 restore_settings (ModestMsgEditWindow *self)
119 {
120         modest_widget_memory_restore (modest_runtime_get_conf (),
121                                       G_OBJECT(self), "modest-edit-msg-window");
122 }
123
124 static void
125 modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass)
126 {
127         GObjectClass *gobject_class;
128         ModestWindowClass *modest_window_class;
129         
130         gobject_class = (GObjectClass*) klass;
131         modest_window_class = (ModestWindowClass*) klass;
132
133         parent_class            = g_type_class_peek_parent (klass);
134         gobject_class->finalize = modest_msg_edit_window_finalize;
135
136         g_type_class_add_private (gobject_class, sizeof(ModestMsgEditWindowPrivate));
137
138         modest_window_class->save_state_func = save_state;
139 }
140
141 static void
142 modest_msg_edit_window_init (ModestMsgEditWindow *obj)
143 {
144         ModestMsgEditWindowPrivate *priv;
145         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
146
147         priv->toolbar       = NULL;
148         priv->menubar       = NULL;
149         priv->msg_body      = NULL;
150         priv->from_field    = NULL;
151         priv->to_field      = NULL;
152         priv->cc_field      = NULL;
153         priv->bcc_field     = NULL;
154         priv->subject_field = NULL;
155         priv->sent          = FALSE;
156 }
157
158 /** 
159  * @result: A ModestPairList, which must be freed with modest_pair_list_free().
160  */
161 static ModestPairList*
162 get_transports (void)
163 {
164         ModestAccountMgr *account_mgr;
165         GSList *transports = NULL;
166         GSList *cursor, *accounts;
167         
168         account_mgr = modest_runtime_get_account_mgr();
169         cursor = accounts = modest_account_mgr_account_names (account_mgr, TRUE);
170         while (cursor) {
171                 gchar *account_name = cursor->data ? g_strdup((gchar*)cursor->data) : NULL;
172                 gchar *from_string  = modest_account_mgr_get_from_string (account_mgr,
173                                                                           account_name);
174                 if (!from_string)  {
175                         /* something went wrong: ignore this one */
176                         g_free (account_name);
177                         cursor->data = NULL;
178                 } else {
179                         ModestPair *pair;
180                         pair = modest_pair_new ((gpointer) account_name,
181                                                 (gpointer) from_string , TRUE);
182                         transports = g_slist_prepend (transports, pair);
183                 } /* don't free account name; it's freed when the transports list is freed */
184                 cursor = cursor->next;
185         }
186         g_slist_free (accounts);
187         return transports;
188 }
189
190
191 static void
192 on_from_combo_changed (ModestComboBox *combo, ModestWindow *win)
193 {
194         modest_window_set_active_account (
195                 win, modest_combo_box_get_active_id(combo));
196 }
197
198
199
200 static void
201 init_window (ModestMsgEditWindow *obj, const gchar* account)
202 {
203         GtkWidget *to_button, *cc_button, *bcc_button; 
204         GtkWidget *header_table;
205         GtkWidget *main_vbox;
206         ModestMsgEditWindowPrivate *priv;
207         ModestWindowPrivate *parent_priv;
208         
209         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
210         parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
211
212         to_button     = gtk_button_new_with_label (_("To..."));
213         cc_button     = gtk_button_new_with_label (_("Cc..."));
214         bcc_button    = gtk_button_new_with_label (_("Bcc..."));
215         
216         /* Note: This ModestPairList* must exist for as long as the combo
217          * that uses it, because the ModestComboBox uses the ID opaquely, 
218          * so it can't know how to manage its memory. */ 
219         priv->from_field_protos = get_transports ();
220         priv->from_field    = modest_combo_box_new (priv->from_field_protos, g_str_equal);
221         
222         if (account) {
223                 modest_combo_box_set_active_id (MODEST_COMBO_BOX(priv->from_field),
224                                                 (gpointer)account);
225                 modest_window_set_active_account (MODEST_WINDOW(obj), account);
226         }
227         /* auto-update the active account */
228         g_signal_connect (G_OBJECT(priv->from_field), "changed", G_CALLBACK(on_from_combo_changed), obj);
229         
230         priv->to_field      = gtk_entry_new_with_max_length (80);
231         priv->cc_field      = gtk_entry_new_with_max_length (80);
232         priv->bcc_field     = gtk_entry_new_with_max_length (80);
233         priv->subject_field = gtk_entry_new_with_max_length (80);
234         
235         header_table = gtk_table_new (5,2, FALSE);
236         
237         gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
238                           0,1,0,1, GTK_SHRINK, 0, 0, 0);
239         gtk_table_attach (GTK_TABLE(header_table), to_button,     0,1,1,2, GTK_SHRINK, 0, 0, 0);
240         gtk_table_attach (GTK_TABLE(header_table), cc_button,     0,1,2,3, GTK_SHRINK, 0, 0, 0);
241         gtk_table_attach (GTK_TABLE(header_table), bcc_button,    0,1,3,4, GTK_SHRINK, 0, 0, 0);
242         gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
243                           0,1,4,5, GTK_SHRINK, 0, 0, 0);
244
245         gtk_table_attach_defaults (GTK_TABLE(header_table), priv->from_field,   1,2,0,1);
246         gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field,     1,2,1,2);
247         gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field,     1,2,2,3);
248         gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field,    1,2,3,4);
249         gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,4,5);
250
251         priv->msg_body = gtk_text_view_new ();
252         
253         main_vbox = gtk_vbox_new  (FALSE, 6);
254
255         gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 0);
256         gtk_box_pack_start (GTK_BOX(main_vbox), priv->toolbar, FALSE, FALSE, 0);
257         gtk_box_pack_start (GTK_BOX(main_vbox), header_table, FALSE, FALSE, 6);
258         gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_body, TRUE, TRUE, 6);
259
260         gtk_widget_show_all (GTK_WIDGET(main_vbox));
261         gtk_container_add (GTK_CONTAINER(obj), main_vbox);
262 }
263
264
265 static void
266 modest_msg_edit_window_finalize (GObject *obj)
267 {
268         ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
269         
270         /* These had to stay alive for as long as the comboboxes that used them: */
271         modest_pair_list_free (priv->from_field_protos);
272         
273         G_OBJECT_CLASS(parent_class)->finalize (obj);
274 }
275
276
277
278 static gboolean
279 on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgEditWindow *self)
280 {
281         modest_window_save_state (MODEST_WINDOW(self));
282         return FALSE;
283 }
284
285
286 static void
287 set_msg (ModestMsgEditWindow *self, TnyMsg *msg)
288 {
289         TnyHeader *header;
290         GtkTextBuffer *buf;
291         const gchar *to, *cc, *bcc, *subject;
292         ModestMsgEditWindowPrivate *priv;
293         gchar *body;
294         
295         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self));
296         g_return_if_fail (TNY_IS_MSG (msg));
297
298         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
299
300         header  = tny_msg_get_header (msg);
301         to      = tny_header_get_to (header);
302         cc      = tny_header_get_cc (header);
303         bcc     = tny_header_get_bcc (header);
304         subject = tny_header_get_subject (header);
305
306         if (to)
307                 gtk_entry_set_text (GTK_ENTRY(priv->to_field), to);
308         if (cc)
309                 gtk_entry_set_text (GTK_ENTRY(priv->cc_field), cc);
310         if (bcc)
311                 gtk_entry_set_text (GTK_ENTRY(priv->bcc_field),  bcc);
312         if (subject)
313                 gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject);
314
315         
316         buf  = gtk_text_view_get_buffer (GTK_TEXT_VIEW(priv->msg_body));
317         body = modest_tny_msg_get_body (msg, FALSE, NULL);
318         if (body) 
319                 gtk_text_buffer_set_text (buf, body, -1);
320         g_free (body);
321 }
322
323
324 ModestWindow *
325 modest_msg_edit_window_new (TnyMsg *msg, const gchar *account)
326 {
327         ModestMsgEditWindow *self;
328         ModestMsgEditWindowPrivate *priv;
329         ModestWindowPrivate *parent_priv;
330         GtkActionGroup *action_group;
331         GError *error = NULL;
332
333         g_return_val_if_fail (msg, NULL);
334         
335         self = MODEST_MSG_EDIT_WINDOW(g_object_new(MODEST_TYPE_MSG_EDIT_WINDOW, NULL));
336         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(self);
337         parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
338         
339         parent_priv->ui_manager = gtk_ui_manager_new();
340         action_group = gtk_action_group_new ("ModestMsgEditWindowActions");
341
342         /* Add common actions */
343         gtk_action_group_add_actions (action_group,
344                                       modest_msg_edit_action_entries,
345                                       G_N_ELEMENTS (modest_msg_edit_action_entries),
346                                       self);
347         gtk_action_group_add_toggle_actions (action_group,
348                                              modest_msg_edit_toggle_action_entries,
349                                              G_N_ELEMENTS (modest_msg_edit_toggle_action_entries),
350                                              self);
351         gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
352         g_object_unref (action_group);
353
354         /* Load the UI definition */
355         gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager,
356                                          MODEST_UIDIR "modest-msg-edit-window-ui.xml",
357                                          &error);
358         if (error) {
359                 g_printerr ("modest: could not merge modest-msg-edit-window-ui.xml: %s\n", error->message);
360                 g_error_free (error);
361                 error = NULL;
362         }
363         /* ****** */
364
365         /* Add accelerators */
366         gtk_window_add_accel_group (GTK_WINDOW (self), 
367                                     gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
368
369         /* Toolbar / Menubar */
370         priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
371         priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
372
373         gtk_toolbar_set_tooltips (GTK_TOOLBAR (priv->toolbar), TRUE);
374
375         /* Init window */
376         init_window (MODEST_MSG_EDIT_WINDOW(self), account);
377
378         restore_settings (MODEST_MSG_EDIT_WINDOW(self));
379         
380         gtk_window_set_title (GTK_WINDOW(self), "Modest");
381         gtk_window_set_icon_from_file (GTK_WINDOW(self), MODEST_APP_ICON, NULL);
382
383         g_signal_connect (G_OBJECT(self), "delete-event",
384                           G_CALLBACK(on_delete_event), self);
385         
386         set_msg (self, msg);
387         
388         return MODEST_WINDOW(self);
389 }
390
391
392 MsgData * 
393 modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window)
394 {
395         MsgData *data;
396         
397         const gchar *account_name;
398         gchar *from_string = NULL;
399         ModestMsgEditWindowPrivate *priv;
400         
401         g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window), NULL);
402
403         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (edit_window);
404         
405         account_name = (gchar*)modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->from_field));
406         if (account_name) 
407                 from_string = modest_account_mgr_get_from_string (
408                         modest_runtime_get_account_mgr(), account_name);
409         if (!from_string) {
410                 g_printerr ("modest: cannot get from string\n");
411                 return NULL;
412         }
413         
414         
415         
416         data = g_slice_new0 (MsgData);
417         data->from    =  from_string; /* will be freed when data is freed */
418         data->to      =  g_strdup (gtk_entry_get_text (GTK_ENTRY(priv->to_field)));
419         data->cc      =  g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->cc_field)));
420         data->bcc     =  g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->bcc_field)));
421         data->subject =  g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->subject_field)));
422         data->msg_id = NULL;
423
424         GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
425         GtkTextIter b, e;
426         gtk_text_buffer_get_bounds (buf, &b, &e);
427         data->plain_body =  gtk_text_buffer_get_text (buf, &b, &e, FALSE); /* Returns a copy. */
428
429         /* No rich supported yet, then html body is NULL */
430         data->html_body = NULL;
431
432         return data;
433 }
434
435 void 
436 modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
437                                       MsgData *data)
438 {
439         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window));
440
441         if (!data)
442                 return;
443
444         g_free (data->to);
445         g_free (data->cc);
446         g_free (data->bcc);
447         g_free (data->subject);
448         g_free (data->plain_body);
449         g_free (data->html_body);
450
451         /* TODO: Free data->attachments? */
452
453         g_slice_free (MsgData, data);
454 }
455
456 /* Rich formatting API functions */
457 ModestMsgEditFormat
458 modest_msg_edit_window_get_format (ModestMsgEditWindow *self)
459 {
460         return MODEST_MSG_EDIT_FORMAT_TEXT;
461 }
462
463 void
464 modest_msg_edit_window_set_format (ModestMsgEditWindow *self,
465                                    ModestMsgEditFormat format)
466 {
467         switch (format) {
468         case MODEST_MSG_EDIT_FORMAT_TEXT:
469                 break;
470         case MODEST_MSG_EDIT_FORMAT_HTML:
471                 g_message ("HTML format not supported in Gnome ModestMsgEditWindow");
472                 break;
473         default:
474                 break;
475         }
476 }
477
478 ModestMsgEditFormatState *
479 modest_msg_edit_window_get_format_state (ModestMsgEditWindow *self)
480 {
481         ModestMsgEditFormatState *format_state;
482
483         g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self), NULL);
484
485         format_state = g_new0 (ModestMsgEditFormatState, 1);
486
487         return format_state;
488 }
489
490 void
491 modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, 
492                                          const ModestMsgEditFormatState *format_state)
493 {
494         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (self));
495
496         /* Ends silently as set_format_state should do nothing when edit window format
497            is not HTML */
498         return;
499 }
500
501 void
502 modest_msg_edit_window_select_color (ModestMsgEditWindow *window)
503 {
504         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
505
506         g_message ("Select color operation is not supported");
507 }
508
509 void
510 modest_msg_edit_window_select_file_format (ModestMsgEditWindow *window,
511                                            gint file_format)
512 {
513         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
514
515         g_message ("Select file format operation is not supported");
516 }
517
518 void
519 modest_msg_edit_window_select_font (ModestMsgEditWindow *window)
520 {
521         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
522
523         g_message ("Select font operation is not supported");
524 }
525
526 void
527 modest_msg_edit_window_select_background_color (ModestMsgEditWindow *window)
528 {
529         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
530
531         g_message ("Select background color operation is not supported");
532 }
533
534 void
535 modest_msg_edit_window_insert_image (ModestMsgEditWindow *window)
536 {
537         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
538
539         g_message ("Insert image operation is not supported");
540 }
541
542 void
543 modest_msg_edit_window_attach_file (ModestMsgEditWindow *window)
544 {
545         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
546
547         g_message ("Attach file operation is not supported");
548 }
549
550 void
551 modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window,
552                                            GList *att_list)
553 {
554         g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
555
556         g_message ("Remove attachments operation is not supported");
557 }
558
559 void
560 modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, 
561                                 gboolean show)
562 {
563         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
564
565         g_message ("not implemented yet %s", __FUNCTION__);
566 }
567 void
568 modest_msg_edit_window_show_bcc (ModestMsgEditWindow *window, 
569                                 gboolean show)
570 {
571         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
572
573         g_message ("not implemented yet %s", __FUNCTION__);
574 }
575 void
576 modest_msg_edit_window_undo (ModestMsgEditWindow *window)
577 {
578         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
579       
580         g_message ("not implemented yet %s", __FUNCTION__);
581 }
582 void
583 modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window)
584 {
585         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
586       
587         g_message ("not implemented yet %s", __FUNCTION__);
588 }
589 void
590 modest_msg_edit_window_set_priority_flags (ModestMsgEditWindow *window,
591                                            TnyHeaderFlags priority_flags)
592 {
593         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
594       
595         g_message ("not implemented yet %s", __FUNCTION__);
596 }
597
598
599 void
600 modest_msg_edit_window_select_contacts (ModestMsgEditWindow *window)
601 {
602         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
603
604         g_message ("not implemented yet %s", __FUNCTION__);
605 }
606
607 gboolean
608 modest_msg_edit_window_check_names (ModestMsgEditWindow *window)
609 {
610         g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
611
612         g_message ("not implemented yet %s", __FUNCTION__);
613         return TRUE;
614 }
615
616 void
617 modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
618                                         gint file_format)
619 {
620         g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
621
622         g_message ("not implemented yet %s", __FUNCTION__);
623 }
624
625 gboolean 
626 modest_msg_edit_window_get_sent (ModestMsgEditWindow *window)
627 {
628         ModestMsgEditWindowPrivate *priv;
629
630         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
631         return priv->sent;
632 }
633
634 void 
635 modest_msg_edit_window_set_sent (ModestMsgEditWindow *window, 
636                                  gboolean sent)
637 {
638         ModestMsgEditWindowPrivate *priv;
639
640         priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
641         priv->sent = sent;
642 }