Fix CID 1491093: attrib leaked if attvalue is null
[claws.git] / src / mimeview.h
blob4254aa389b8147f118e793691246cc8af9255373
1 /*
2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto
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>
30 #include "textview.h"
31 #include "messageview.h"
32 #include "procmime.h"
33 #include "noticeview.h"
35 typedef enum
37 MIMEVIEW_TEXT,
38 MIMEVIEW_VIEWER
39 } MimeViewType;
41 struct _MimeView
43 GtkWidget *hbox;
44 GtkWidget *paned;
45 GtkWidget *scrolledwin;
46 GtkWidget *ctree;
47 GtkWidget *mime_notebook;
48 GtkWidget *ctree_mainbox;
49 GtkWidget *icon_scroll;
50 GtkWidget *icon_grid;
51 GtkWidget *icon_mainbox;
52 GtkWidget *mime_toggle;
53 GtkWidget *scrollbutton;
54 GtkWidget *arrow;
55 MimeViewType type;
56 gboolean ctree_mode;
58 GtkWidget *popupmenu;
60 GtkTreePath *opened;
62 TextView *textview;
63 MimeViewer *mimeviewer;
65 MessageView *messageview;
67 MimeInfo *mimeinfo;
69 gchar *file;
71 GSList *viewers;
73 GtkTargetList *target_list; /* DnD */
75 gint icon_count;
76 MainWindow *mainwin;
78 NoticeView *siginfoview;
79 MimeInfo *siginfo;
80 MimeInfo *spec_part;
81 GtkUIManager *ui_manager;
82 GtkActionGroup *action_group;
83 gboolean signed_part;
85 GCancellable *sig_check_cancellable;
86 guint sig_check_timeout_tag;
89 struct _MimeViewerFactory
91 /**
92 * Array of supported content types.
93 * Must be NULL terminated and lower case
95 gchar **content_types;
96 gint priority;
98 MimeViewer *(*create_viewer) (void);
101 struct _MimeViewer
103 MimeViewerFactory *factory;
105 GtkWidget *(*get_widget) (MimeViewer *);
106 void (*show_mimepart) (MimeViewer *, const gchar *infile, MimeInfo *);
107 void (*clear_viewer) (MimeViewer *);
108 void (*destroy_viewer) (MimeViewer *);
109 gchar *(*get_selection) (MimeViewer *);
110 gboolean (*scroll_page) (MimeViewer *, gboolean up);
111 void (*scroll_one_line) (MimeViewer *, gboolean up);
112 gboolean (*text_search) (MimeViewer *, gboolean backward,
113 const gchar *str,
114 gboolean case_sensitive);
115 void (*print) (MimeViewer *);
116 MimeView *mimeview;
119 #ifdef __cplusplus
120 extern "C" {
121 #endif /* __cplusplus */
124 MimeView *mimeview_create (MainWindow *mainwin);
125 void mimeview_init (MimeView *mimeview);
126 void mimeview_show_message (MimeView *mimeview,
127 MimeInfo *mimeinfo,
128 const gchar *file);
129 gboolean mimeview_show_part (MimeView *mimeview,
130 MimeInfo *partinfo);
131 void mimeview_show_part_as_text (MimeView *mimeview,
132 MimeInfo *partinfo);
133 void mimeview_destroy (MimeView *mimeview);
134 void mimeview_update (MimeView *mimeview);
135 void mimeview_clear (MimeView *mimeview);
137 MimeInfo *mimeview_get_selected_part (MimeView *mimeview);
139 gboolean mimeview_pass_key_press_event (MimeView *mimeview,
140 GdkEventKey *event);
142 void mimeview_register_viewer_factory (MimeViewerFactory *factory);
143 void mimeview_unregister_viewer_factory (MimeViewerFactory *factory);
144 void mimeview_handle_cmd (MimeView *mimeview,
145 const gchar *cmd,
146 GdkEventButton *event,
147 gpointer data);
148 void mimeview_select_mimepart_icon (MimeView *mimeview,
149 MimeInfo *partinfo);
150 gboolean mimeview_scroll_page (MimeView *mimeview,
151 gboolean up);
152 void mimeview_scroll_one_line (MimeView *mimeview,
153 gboolean up);
154 gint mimeview_get_selected_part_num (MimeView *mimeview);
155 void mimeview_select_part_num (MimeView *mimeview,
156 gint i);
157 gboolean mimeview_has_viewer_for_content_type
158 (MimeView *mimeview,
159 const gchar *content_type);
160 gboolean mimeview_tree_is_empty (MimeView *mimeview);
161 void mimeview_save_as (MimeView *mimeview);
162 void mimeview_display_as_text (MimeView *mimeview);
163 void mimeview_launch (MimeView *mimeview,
164 MimeInfo *partinfo);
165 #ifndef G_OS_WIN32
166 void mimeview_open_with (MimeView *mimeview);
167 #endif
168 void mimeview_check_signature(MimeView *mimeview);
169 void mimeview_select_next_part(MimeView *mimeview);
170 void mimeview_select_prev_part(MimeView *mimeview);
173 #ifdef __cplusplus
175 #endif /* __cplusplus */
177 #endif /* __MIMEVIEW_H__ */