fix CID 1596595: Resource leaks, and CID 1596594: (CHECKED_RETURN)
[claws.git] / src / plugins / managesieve / sieve_editor.h
1 /*
2  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3  * Copyright (C) 2004-2015 the Claws Mail team
4  * Copyright (C) 2014-2015 Charles Lehner
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 3 of the License, or
9  * (at your option) 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, see <http://www.gnu.org/licenses/>.
18  * 
19  */
20
21 #ifndef SIEVE_EDITOR_H
22 #define SIEVE_EDITOR_H
23
24 #include "undo.h"
25
26 typedef struct SieveEditorPage SieveEditorPage;
27
28 struct SieveEditorPage
29 {
30         GtkWidget*      window;
31         GtkWidget*      status_text;
32         GtkWidget*      status_icon;
33         GtkWidget*      text;
34         GtkUIManager *ui_manager;
35         UndoMain        *undostruct;
36         struct SieveSession *session;
37         gchar *script_name;
38         gboolean        first_line;
39         gboolean        modified;
40         gboolean        closing;
41         gboolean        is_new;
42
43         /* callback for failure to load the script */
44         sieve_session_cb_fn on_load_error;
45         gpointer on_load_error_data;
46 };
47
48 void sieve_editors_close();
49 SieveEditorPage *sieve_editor_new(SieveSession *session, gchar *script_name);
50 SieveEditorPage *sieve_editor_get(SieveSession *session, gchar *script_name);
51 void sieve_editor_load(SieveEditorPage *page,
52                 sieve_session_cb_fn on_load_error, gpointer load_error_data);
53 void sieve_editor_append_text(SieveEditorPage *page, gchar *text, gint len);
54 void sieve_editor_close(SieveEditorPage *page);
55 void sieve_editor_show(SieveEditorPage *page);
56 void sieve_editor_present(SieveEditorPage *page);
57
58 #endif /* SIEVE_EDITOR_H */
59