1 /* Python plugin for Claws Mail
2 * Copyright (C) 2009-2018 Holger Berndt and The Claws Mail Team
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "claws-features.h"
24 #include <glib/gi18n.h>
26 #include "common/version.h"
30 #include "file-utils.h"
33 #include "prefs_common.h"
34 #include "prefs_gtk.h"
35 #include "python_prefs.h"
37 #define PREFS_BLOCK_NAME "Python"
39 PythonConfig python_config
;
41 static PrefParam prefs
[] = {
42 {"console_win_width", "-1", &python_config
.console_win_width
,
43 P_INT
, NULL
, NULL
, NULL
},
44 {"console_win_height", "-1", &python_config
.console_win_height
,
45 P_INT
, NULL
, NULL
, NULL
},
49 void python_prefs_init(void)
53 prefs_set_default(prefs
);
54 rcpath
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
, COMMON_RC
, NULL
);
55 prefs_read_config(prefs
, PREFS_BLOCK_NAME
, rcpath
, NULL
);
59 void python_prefs_done(void)
62 gchar
*rc_file_path
= g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S
,
64 pref_file
= prefs_write_open(rc_file_path
);
67 if (!(pref_file
) || (prefs_set_block_label(pref_file
, PREFS_BLOCK_NAME
) < 0))
70 if (prefs_write_param(prefs
, pref_file
->fp
) < 0) {
71 g_warning("failed to write Python plugin configuration");
72 prefs_file_close_revert(pref_file
);
76 if (fprintf(pref_file
->fp
, "\n") < 0) {
77 FILE_OP_ERROR(rc_file_path
, "fprintf");
78 prefs_file_close_revert(pref_file
);
80 prefs_file_close(pref_file
);