d8530a8f819755a03fab0f2abb19d01288f86649
[claws.git] / src / gtk / prefswindow.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail Team
4  *
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.
9  *
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.
14  *
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/>.
17  * 
18  */
19
20 #ifndef PREFSWINDOW_H
21 #define PREFSWINDOW_H 1
22
23 #include <glib.h>
24 #include <gtk/gtk.h>
25
26 typedef struct _PrefsPage PrefsPage;
27 typedef struct _PrefsWindow PrefsWindow;
28
29 typedef void (*PrefsCreateWidgetFunc) (PrefsPage *, GtkWindow *window, gpointer);
30 typedef void (*PrefsDestroyWidgetFunc) (PrefsPage *);
31 typedef void (*PrefsSavePageFunc) (PrefsPage *);
32 typedef gboolean (*PrefsCanClosePageFunc) (PrefsPage *);
33 typedef void (*PrefsOpenCallbackFunc) (GtkWindow *);
34 typedef void (*PrefsCloseCallbackFunc) (GtkWindow *);
35
36 struct _PrefsPage
37 {
38         gchar                   **path;
39         gboolean                  page_open;
40         GtkWidget                *widget;
41         gfloat                    weight;
42
43         PrefsCreateWidgetFunc     create_widget;
44         PrefsDestroyWidgetFunc    destroy_widget;
45         PrefsSavePageFunc         save_page;
46         PrefsCanClosePageFunc     can_close;
47 };
48
49 enum {
50         PREFS_PAGE_TITLE,               /* page title */
51         PREFS_PAGE_DATA,                /* PrefsTreeNode data */
52         PREFS_PAGE_DATA_AUTO_FREE,      /* auto free for PREFS_PAGE_DATA */
53         PREFS_PAGE_WEIGHT,              /* weight */
54         PREFS_PAGE_INDEX,               /* index in original page list */
55         N_PREFS_PAGE_COLUMNS
56 };
57
58 typedef struct _PrefsTreeNode PrefsTreeNode;
59
60 struct _PrefsWindow
61 {
62         GtkWidget *window;
63         GtkWidget *vbox;
64         GtkWidget *paned;
65         GtkWidget *scrolledwindow1;
66         GtkWidget *tree_view;
67         GtkWidget *table2;
68         GtkWidget *pagelabel;
69         GtkWidget *labelframe;
70         GtkWidget *vbox2;
71         GtkWidget *notebook;
72         GtkWidget *confirm_area;
73         GtkWidget *ok_btn;
74         GtkWidget *cancel_btn;
75         GtkWidget *apply_btn;
76         gint *save_width;
77         gint *save_height;
78         PrefsCloseCallbackFunc open_cb;
79         PrefsCloseCallbackFunc close_cb;
80
81         GtkWidget *empty_page;
82
83         gpointer         data;
84         GSList          *prefs_pages;
85         GDestroyNotify func;
86 };
87
88 struct _PrefsTreeNode
89 {
90         PrefsPage *page;
91         gfloat     treeweight; /* GTK2: not used */
92 };
93
94 void prefswindow_open_full              (const gchar *title, 
95                                          GSList *prefs_pages,
96                                          gpointer data,
97                                          GDestroyNotify func,
98                                          gint *save_width, gint *save_height,
99                                          gboolean preload_pages,
100                                          PrefsOpenCallbackFunc open_cb,
101                                          PrefsCloseCallbackFunc close_cb);
102
103 void prefswindow_open                   (const gchar *title, 
104                                          GSList *prefs_pages,
105                                          gpointer data,
106                                          gint *save_width, gint *save_height,
107                                          PrefsOpenCallbackFunc open_cb,
108                                          PrefsCloseCallbackFunc close_cb);
109
110 #endif