remove unnecessary cm_return_val_if_fail()
[claws.git] / src / mimeview.h
blob2f87b8c3acb521f23043969ea10c335afce3f797
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_show_part_as_text (MimeView *mimeview,
151 MimeInfo *partinfo);
152 void mimeview_destroy (MimeView *mimeview);
153 void mimeview_update (MimeView *mimeview);
154 void mimeview_clear (MimeView *mimeview);
156 MimeInfo *mimeview_get_selected_part (MimeView *mimeview);
158 gboolean mimeview_pass_key_press_event (MimeView *mimeview,
159 GdkEventKey *event);
161 void mimeview_register_viewer_factory (MimeViewerFactory *factory);
162 void mimeview_unregister_viewer_factory (MimeViewerFactory *factory);
163 void mimeview_handle_cmd (MimeView *mimeview,
164 const gchar *cmd,
165 GdkEventButton *event,
166 gpointer data);
167 void mimeview_select_mimepart_icon (MimeView *mimeview,
168 MimeInfo *partinfo);
169 gboolean mimeview_scroll_page (MimeView *mimeview,
170 gboolean up);
171 void mimeview_scroll_one_line (MimeView *mimeview,
172 gboolean up);
173 gint mimeview_get_selected_part_num (MimeView *mimeview);
174 void mimeview_select_part_num (MimeView *mimeview,
175 gint i);
176 gboolean mimeview_has_viewer_for_content_type
177 (MimeView *mimeview,
178 const gchar *content_type);
179 gboolean mimeview_tree_is_empty (MimeView *mimeview);
180 void mimeview_save_as (MimeView *mimeview);
181 void mimeview_display_as_text (MimeView *mimeview);
182 void mimeview_launch (MimeView *mimeview,
183 MimeInfo *partinfo);
184 #ifndef G_OS_WIN32
185 void mimeview_open_with (MimeView *mimeview);
186 #endif
187 void mimeview_check_signature(MimeView *mimeview);
188 void mimeview_select_next_part(MimeView *mimeview);
189 void mimeview_select_prev_part(MimeView *mimeview);
192 #ifdef __cplusplus
194 #endif /* __cplusplus */
196 #endif /* __MIMEVIEW_H__ */