Fix bug #3574: Template addressing
[claws.git] / src / mimeview.h
blobe520d55e4fb6367dc392dff8e0ad44688da85e3c
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef MIMEVIEW_H
21 #define MIMEVIEW_H
23 typedef struct _MimeViewerFactory MimeViewerFactory;
24 typedef struct _MimeViewer MimeViewer;
26 #include <glib.h>
27 #include <gdk/gdk.h>
28 #include <gtk/gtk.h>
29 #ifdef USE_PTHREAD
30 #include <pthread.h>
31 #endif
33 #include "textview.h"
34 #include "messageview.h"
35 #include "procmime.h"
36 #include "noticeview.h"
38 typedef enum
40 MIMEVIEW_TEXT,
41 MIMEVIEW_VIEWER
42 } MimeViewType;
44 #ifdef USE_PTHREAD
45 typedef struct _SigCheckData SigCheckData;
46 struct _SigCheckData
48 pthread_t th;
49 pthread_t cancel_th;
50 gboolean th_init;
51 gboolean cancel_th_init;
53 MimeInfo *siginfo;
54 gboolean free_after_use;
55 gboolean destroy_mimeview;
56 gboolean timeout;
58 #endif
60 struct _MimeView
62 GtkWidget *hbox;
63 GtkWidget *paned;
64 GtkWidget *scrolledwin;
65 GtkWidget *ctree;
66 GtkWidget *mime_notebook;
67 GtkWidget *ctree_mainbox;
68 GtkWidget *icon_scroll;
69 GtkWidget *icon_vbox;
70 GtkWidget *icon_mainbox;
71 GtkWidget *mime_toggle;
72 GtkWidget *scrollbutton;
73 MimeViewType type;
74 gboolean ctree_mode;
76 GtkWidget *popupmenu;
78 GtkTreePath *opened;
80 TextView *textview;
81 MimeViewer *mimeviewer;
83 MessageView *messageview;
85 MimeInfo *mimeinfo;
87 gchar *file;
89 GSList *viewers;
91 GtkTargetList *target_list; /* DnD */
93 gint icon_count;
94 MainWindow *mainwin;
96 NoticeView *siginfoview;
97 MimeInfo *siginfo;
98 MimeInfo *spec_part;
99 GtkUIManager *ui_manager;
100 GtkActionGroup *action_group;
101 gboolean signed_part;
103 #ifdef USE_PTHREAD
104 SigCheckData *check_data;
105 #endif
108 struct _MimeViewerFactory
111 * Array of supported content types.
112 * Must be NULL terminated and lower case
114 gchar **content_types;
115 gint priority;
117 MimeViewer *(*create_viewer) (void);
120 struct _MimeViewer
122 MimeViewerFactory *factory;
124 GtkWidget *(*get_widget) (MimeViewer *);
125 void (*show_mimepart) (MimeViewer *, const gchar *infile, MimeInfo *);
126 void (*clear_viewer) (MimeViewer *);
127 void (*destroy_viewer) (MimeViewer *);
128 gchar *(*get_selection) (MimeViewer *);
129 gboolean (*scroll_page) (MimeViewer *, gboolean up);
130 void (*scroll_one_line) (MimeViewer *, gboolean up);
131 gboolean (*text_search) (MimeViewer *, gboolean backward,
132 const gchar *str,
133 gboolean case_sensitive);
134 void (*print) (MimeViewer *);
135 MimeView *mimeview;
138 #ifdef __cplusplus
139 extern "C" {
140 #endif /* __cplusplus */
143 MimeView *mimeview_create (MainWindow *mainwin);
144 void mimeview_init (MimeView *mimeview);
145 void mimeview_show_message (MimeView *mimeview,
146 MimeInfo *mimeinfo,
147 const gchar *file);
148 gboolean mimeview_show_part (MimeView *mimeview,
149 MimeInfo *partinfo);
150 void mimeview_destroy (MimeView *mimeview);
151 void mimeview_update (MimeView *mimeview);
152 void mimeview_clear (MimeView *mimeview);
154 MimeInfo *mimeview_get_selected_part (MimeView *mimeview);
156 gboolean mimeview_pass_key_press_event (MimeView *mimeview,
157 GdkEventKey *event);
159 void mimeview_register_viewer_factory (MimeViewerFactory *factory);
160 void mimeview_unregister_viewer_factory (MimeViewerFactory *factory);
161 void mimeview_handle_cmd (MimeView *mimeview,
162 const gchar *cmd,
163 GdkEventButton *event,
164 gpointer data);
165 void mimeview_select_mimepart_icon (MimeView *mimeview,
166 MimeInfo *partinfo);
167 gboolean mimeview_scroll_page (MimeView *mimeview,
168 gboolean up);
169 void mimeview_scroll_one_line (MimeView *mimeview,
170 gboolean up);
171 gint mimeview_get_selected_part_num (MimeView *mimeview);
172 void mimeview_select_part_num (MimeView *mimeview,
173 gint i);
174 gboolean mimeview_has_viewer_for_content_type
175 (MimeView *mimeview,
176 const gchar *content_type);
177 gboolean mimeview_tree_is_empty (MimeView *mimeview);
178 void mimeview_save_as (MimeView *mimeview);
179 void mimeview_display_as_text (MimeView *mimeview);
180 void mimeview_launch (MimeView *mimeview,
181 MimeInfo *partinfo);
182 #ifndef G_OS_WIN32
183 void mimeview_open_with (MimeView *mimeview);
184 #endif
185 void mimeview_check_signature(MimeView *mimeview);
186 void mimeview_select_next_part(MimeView *mimeview);
187 void mimeview_select_prev_part(MimeView *mimeview);
190 #ifdef __cplusplus
192 #endif /* __cplusplus */
194 #endif /* __MIMEVIEW_H__ */