remove unnecessary cm_return_val_if_fail()
[claws.git] / src / gtk / prefswindow.h
blob8916e972aee17b97be3d9da28c2cc6c884084e48
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 PREFSWINDOW_H
21 #define PREFSWINDOW_H 1
23 #include <glib.h>
24 #include <gtk/gtk.h>
26 typedef struct _PrefsPage PrefsPage;
27 typedef struct _PrefsWindow PrefsWindow;
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) (PrefsWindow *);
34 typedef void (*PrefsApplyCallbackFunc) (PrefsWindow *);
35 typedef void (*PrefsCloseCallbackFunc) (PrefsWindow *);
37 struct _PrefsPage
39 gchar **path;
40 gboolean page_open;
41 GtkWidget *widget;
42 gfloat weight;
44 PrefsCreateWidgetFunc create_widget;
45 PrefsDestroyWidgetFunc destroy_widget;
46 PrefsSavePageFunc save_page;
47 PrefsCanClosePageFunc can_close;
50 enum {
51 PREFS_PAGE_TITLE, /* page title */
52 PREFS_PAGE_DATA, /* PrefsTreeNode data */
53 PREFS_PAGE_DATA_AUTO_FREE, /* auto free for PREFS_PAGE_DATA */
54 PREFS_PAGE_WEIGHT, /* weight */
55 PREFS_PAGE_INDEX, /* index in original page list */
56 N_PREFS_PAGE_COLUMNS
59 typedef struct _PrefsTreeNode PrefsTreeNode;
61 struct _PrefsWindow
63 GtkWidget *window;
64 GtkWidget *vbox;
65 GtkWidget *paned;
66 GtkWidget *scrolledwindow1;
67 GtkWidget *tree_view;
68 GtkWidget *table2;
69 GtkWidget *pagelabel;
70 GtkWidget *labelframe;
71 GtkWidget *vbox2;
72 GtkWidget *notebook;
73 GtkWidget *confirm_area;
74 GtkWidget *ok_btn;
75 GtkWidget *cancel_btn;
76 GtkWidget *apply_btn;
77 gint *save_width;
78 gint *save_height;
79 PrefsCloseCallbackFunc open_cb;
80 PrefsApplyCallbackFunc apply_cb;
81 PrefsCloseCallbackFunc close_cb;
82 gint dialog_response; /* Useful for close_cb callbacks */
84 GtkWidget *empty_page;
86 gpointer data;
87 GSList *prefs_pages;
88 GDestroyNotify func;
91 enum
93 PREFSWINDOW_RESPONSE_CANCEL,
94 PREFSWINDOW_RESPONSE_OK,
95 PREFSWINDOW_RESPONSE_APPLY
98 struct _PrefsTreeNode
100 PrefsPage *page;
101 gfloat treeweight; /* GTK2: not used */
104 void prefswindow_open_full (const gchar *title,
105 GSList *prefs_pages,
106 gpointer data,
107 GDestroyNotify func,
108 gint *save_width, gint *save_height,
109 gboolean preload_pages,
110 PrefsOpenCallbackFunc open_cb,
111 PrefsApplyCallbackFunc apply_cb,
112 PrefsCloseCallbackFunc close_cb);
114 void prefswindow_open (const gchar *title,
115 GSList *prefs_pages,
116 gpointer data,
117 gint *save_width, gint *save_height,
118 PrefsOpenCallbackFunc open_cb,
119 PrefsApplyCallbackFunc apply_cb,
120 PrefsCloseCallbackFunc close_cb);
122 #endif