1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
2 /* Balsa E-Mail Client
3  * Copyright (C) 1997-2013 Stuart Parmenter and others,
4  *                         See the file AUTHORS for a list.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19  * 02111-1307, USA.
20  */
21 
22 #ifndef __BALSA_MESSAGE_H__
23 #define __BALSA_MESSAGE_H__
24 
25 #ifndef BALSA_VERSION
26 # error "Include config.h before this file."
27 #endif
28 
29 #include "libbalsa.h"
30 #include "balsa-app.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif				/* __cplusplus */
35 
36 
37 #define BALSA_TYPE_MESSAGE          (balsa_message_get_type ())
38 #define BALSA_MESSAGE(obj)          G_TYPE_CHECK_INSTANCE_CAST (obj, BALSA_TYPE_MESSAGE, BalsaMessage)
39 #define BALSA_MESSAGE_CLASS(klass)  G_TYPE_CHECK_CLASS_CAST (klass, BALSA_TYPE_MESSAGE, BalsaMessageClass)
40 #define BALSA_IS_MESSAGE(obj)       G_TYPE_CHECK_INSTANCE_TYPE (obj, BALSA_TYPE_MESSAGE)
41 
42 
43 typedef struct _BalsaMessage BalsaMessage;
44 typedef struct _BalsaMessageClass BalsaMessageClass;
45 
46 typedef struct _BalsaPartInfo BalsaPartInfo;
47 
48 typedef struct _BalsaMimeWidget BalsaMimeWidget;
49 
50 typedef enum {
51     BALSA_MESSAGE_FOCUS_STATE_NO,
52     BALSA_MESSAGE_FOCUS_STATE_YES,
53     BALSA_MESSAGE_FOCUS_STATE_HOLD
54 } BalsaMessageFocusState;
55 
56 struct _BalsaMessage {
57 	GtkNotebook parent;
58 
59         /* Top-level MIME widget */
60         BalsaMimeWidget *bm_widget;
61 
62 	/* header-related information */
63 	ShownHeaders shown_headers;
64 
65 	/* Widgets to hold content */
66 	GtkWidget *scroll;
67 
68         /* Widget to hold structure tree */
69         GtkWidget *treeview;
70         gint info_count;
71         GList *save_all_list;
72         GtkWidget *save_all_popup;
73 
74 	gboolean wrap_text;
75 
76         BalsaPartInfo *current_part;
77         GtkWidget *parts_popup;
78         gboolean force_inline;
79 
80 	LibBalsaMessage *message;
81 
82 	gboolean close_with_msg;
83 
84         BalsaMessageFocusState focus_state;
85 
86         /* Find-in-message stuff */
87         GtkWidget  *find_bar;
88         GtkWidget  *find_entry;
89         GtkWidget  *find_next;
90         GtkWidget  *find_prev;
91         GtkWidget  *find_sep;
92         GtkWidget  *find_label;
93         GtkTextIter find_iter;
94         gboolean    find_forward;
95 
96         /* Tab position for headers */
97         gint tab_position;
98 
99         /* Widget to hold Faces */
100         GtkWidget *face_box;
101 
102 #ifdef HAVE_HTML_WIDGET
103         gpointer html_find_info;
104 #endif				/* HAVE_HTML_WIDGET */
105 };
106 
107 struct _BalsaMessageClass {
108 	GtkNotebookClass parent_class;
109 
110 	void (*select_part) (BalsaMessage * message);
111 };
112 
113 GType balsa_message_get_type(void);
114 GtkWidget *balsa_message_new(void);
115 void balsa_message_set_close(BalsaMessage * bmessage,
116 			     gboolean close_with_msg);
117 
118 gboolean balsa_message_set(BalsaMessage * bmessage,
119 			   LibBalsaMailbox * mailbox, guint msgno);
120 
121 void balsa_message_next_part(BalsaMessage * bmessage);
122 gboolean balsa_message_has_next_part(BalsaMessage * bmessage);
123 void balsa_message_previous_part(BalsaMessage * bmessage);
124 gboolean balsa_message_has_previous_part(BalsaMessage * bmessage);
125 void balsa_message_save_current_part(BalsaMessage * bmessage);
126 void balsa_message_copy_part(const gchar *url, LibBalsaMessageBody *part);
127 
128 void balsa_message_set_displayed_headers(BalsaMessage * bmessage,
129 					     ShownHeaders sh);
130 void balsa_message_set_wrap(BalsaMessage * bmessage, gboolean wrap);
131 
132 gboolean balsa_message_can_select(BalsaMessage * bmessage);
133 gboolean balsa_message_grab_focus(BalsaMessage * bmessage);
134 gchar * balsa_message_sender_to_gchar(InternetAddressList * list, gint which);
135 GtkWidget *balsa_message_current_part_widget(BalsaMessage * bmessage);
136 GtkWindow *balsa_get_parent_window(GtkWidget *widget);
137 
138 #ifdef HAVE_HTML_WIDGET
139 #define BALSA_MESSAGE_ZOOM_KEY "balsa-message-zoom"
140 gboolean balsa_message_can_zoom(BalsaMessage * bm);
141 void balsa_message_zoom(BalsaMessage * bm, gint in_out);
142 #endif				/* HAVE_HTML_WIDGET */
143 
144 #ifdef HAVE_GPGME
145 void balsa_message_perform_crypto(LibBalsaMessage * message,
146 				  LibBalsaChkCryptoMode chk_mode,
147 				  gboolean no_mp_signed,
148 				  guint max_ref);
149 #endif
150 
151 void balsa_message_find_in_message (BalsaMessage * bm);
152 
153 #ifdef __cplusplus
154 }
155 #endif				/* __cplusplus */
156 #endif				/* __BALSA_MESSAGE_H__ */
157