1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms of the GNU Lesser General Public License as published by
4  * the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful, but
7  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
8  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9  * for more details.
10  *
11  * You should have received a copy of the GNU Lesser General Public License
12  * along with this program; if not, see <http://www.gnu.org/licenses/>.
13  *
14  *
15  * Authors:
16  *		Chris Lahey <clahey@ximian.com>
17  *		Miguel de Icaza <miguel@ximian.com>
18  *
19  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
20  *
21  */
22 
23 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
24 #error "Only <e-util/e-util.h> should be included directly."
25 #endif
26 
27 #ifndef _E_TABLE_CONFIG_H_
28 #define _E_TABLE_CONFIG_H_
29 
30 #include <e-util/e-table-specification.h>
31 
32 /* Standard GObject macros */
33 #define E_TYPE_TABLE_CONFIG \
34 	(e_table_config_get_type ())
35 #define E_TABLE_CONFIG(obj) \
36 	(G_TYPE_CHECK_INSTANCE_CAST \
37 	((obj), E_TYPE_TABLE_CONFIG, ETableConfig))
38 #define E_TABLE_CONFIG_CLASS(cls) \
39 	(G_TYPE_CHECK_CLASS_CAST \
40 	((cls), E_TYPE_TABLE_CONFIG, ETableConfigClass))
41 #define E_IS_TABLE_CONFIG(obj) \
42 	(G_TYPE_CHECK_INSTANCE_TYPE \
43 	((obj), E_TYPE_TABLE_CONFIG))
44 #define E_IS_TABLE_CONFIG_CLASS(cls) \
45 	(G_TYPE_CHECK_CLASS_TYPE \
46 	((cls), E_TYPE_TABLE_CONFIG))
47 #define E_TABLE_CONFIG_GET_CLASS(obj) \
48 	(G_TYPE_INSTANCE_GET_CLASS \
49 	((obj), E_TYPE_TABLE_CONFIG, ETableConfigClass))
50 
51 G_BEGIN_DECLS
52 
53 typedef struct _ETableConfigSortWidgets ETableConfigSortWidgets;
54 
55 typedef struct _ETableConfig ETableConfig;
56 typedef struct _ETableConfigClass ETableConfigClass;
57 
58 struct _ETableConfigSortWidgets {
59 	GtkWidget    *combo;
60 	GtkWidget    *frames;
61 	GtkWidget    *radio_ascending;
62 	GtkWidget    *radio_descending;
63 	GtkWidget    *view_check; /* Only for group dialog */
64 	guint         changed_id, toggled_id;
65 	gpointer e_table_config;
66 };
67 
68 struct _ETableConfig {
69 	GObject parent;
70 
71 	gchar *header;
72 
73 	/*
74 	 * Our various dialog boxes
75 	 */
76 	GtkWidget *dialog_toplevel;
77 	GtkWidget *dialog_group_by;
78 	GtkWidget *dialog_sort;
79 
80 	/*
81 	 * The state we manipulate
82 	 */
83 	ETableSpecification *source_spec;
84 	ETableState         *source_state, *state, *temp_state;
85 
86 	GtkWidget *sort_label;
87 	GtkWidget *group_label;
88 	GtkWidget *fields_label;
89 
90 	ETableConfigSortWidgets sort[4];
91 	ETableConfigSortWidgets group[4];
92 
93 	gchar *domain;
94 
95 	/*
96 	 * List of valid column names
97 	 */
98 	GSList *column_names;
99 };
100 
101 struct _ETableConfigClass {
102 	GObjectClass parent_class;
103 
104 	/* Signals */
105 	void		(*changed)		(ETableConfig *config);
106 };
107 
108 GType		e_table_config_get_type		(void) G_GNUC_CONST;
109 ETableConfig *	e_table_config_new		(const gchar *header,
110 						 ETableSpecification *spec,
111 						 ETableState *state,
112 						 GtkWindow *parent_window);
113 ETableConfig *	e_table_config_construct	(ETableConfig *etco,
114 						 const gchar *header,
115 						 ETableSpecification *spec,
116 						 ETableState *state,
117 						 GtkWindow *parent_window);
118 void		e_table_config_raise		(ETableConfig *config);
119 
120 G_END_DECLS
121 
122 #endif /* _E_TABLE_CONFIG_H */
123