removed GSList declaration causing trouble on MacOS-X
[claws.git] / src / toolbar.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 Hiroyuki Yamamoto
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 2 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, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __CUSTOM_TOOLBAR_H__
21 #define __CUSTOM_TOOLBAR_H__
22
23 #define SEPARATOR            "separator"
24 #define SEPARATOR_PIXMAP     "---"
25
26 typedef enum {
27         TOOLBAR_MAIN,   
28         TOOLBAR_COMPOSE,
29 } Toolbar;
30
31 #define TOOLBAR_DESTROY_ITEMS(t_item_list) \
32 { \
33         ToolbarItem *t_item; \
34         while (t_item_list != NULL) { \
35                 t_item = (ToolbarItem*)t_item_list->data; \
36                 t_item_list = g_slist_remove(t_item_list, t_item); \
37                 if (t_item->file) \
38                         g_free(t_item->file); \
39                 if (t_item->text) \
40                         g_free(t_item->text);\
41                 g_free(t_item);\
42         }\
43         g_slist_free(t_item_list);\
44 }
45
46 #define TOOLBAR_DESTROY_ACTIONS(t_action_list) \
47 { \
48         ToolbarSylpheedActions *t_action; \
49         while (t_action_list != NULL) { \
50                 t_action = (ToolbarSylpheedActions*)t_action_list->data;\
51                 t_action_list = \
52                         g_slist_remove(t_action_list, t_action);\
53                 if (t_action->name) \
54                         g_free(t_action->name); \
55                 g_free(t_action); \
56         } \
57         g_slist_free(t_action_list); \
58 }
59
60 typedef struct _ToolbarConfig ToolbarConfig;
61 struct _ToolbarConfig {
62         const gchar  *conf_file;
63         GSList       *item_list;
64 };
65
66
67 /* enum holds available actions for both 
68    Compose Toolbar and Main Toolbar 
69 */
70 enum {
71         /* main toolbar */
72         A_RECEIVE_ALL = 0,
73         A_RECEIVE_CUR,
74         A_SEND_QUEUED,
75         A_COMPOSE_EMAIL,
76         A_COMPOSE_NEWS,
77         A_REPLY_MESSAGE,
78         A_REPLY_SENDER,
79         A_REPLY_ALL,
80         A_REPLY_ML,
81         A_FORWARD,
82         A_DELETE,
83         A_EXECUTE,
84         A_GOTO_NEXT,
85
86         /* compose toolbar */
87         A_SEND,
88         A_SENDL,
89         A_DRAFT,
90         A_INSERT,
91         A_ATTACH,
92         A_SIG,
93         A_EXTEDITOR,
94         A_LINEWRAP,
95         A_ADDRBOOK,
96
97         /* common items */
98         A_SYL_ACTIONS,
99         A_SEPARATOR,
100
101         N_ACTION_VAL
102 };
103
104 typedef struct _ToolbarText ToolbarText;
105 struct _ToolbarText 
106 {
107         gchar *index_str;
108         gchar *descr;
109 };
110
111 typedef struct _ToolbarItem ToolbarItem;
112 struct _ToolbarItem 
113 {
114         gint      index;
115         gchar    *file;
116         gchar    *text;
117         gpointer  parent;
118 };
119
120 typedef struct _ToolbarSylpheedActions ToolbarSylpheedActions;
121 struct _ToolbarSylpheedActions
122 {
123         GtkWidget *widget;
124         gchar     *name;
125 };
126
127
128 void      toolbar_action_execute           (GtkWidget           *widget,
129                                             GSList              *action_list, 
130                                             gpointer            data,
131                                             gint                source);
132
133 GList    *toolbar_get_action_items         (Toolbar            source);
134
135 void      toolbar_save_config_file         (Toolbar            source);
136 void      toolbar_read_config_file         (Toolbar            source);
137
138 void      toolbar_set_default              (Toolbar            source);
139 void      toolbar_clear_list               (Toolbar            source);
140
141 GSList   *toolbar_get_list                 (Toolbar            source);
142 void      toolbar_set_list_item            (ToolbarItem        *t_item, 
143                                             Toolbar            source);
144
145 gint      toolbar_ret_val_from_descr       (const gchar        *descr);
146 gchar    *toolbar_ret_descr_from_val       (gint                val);
147
148 void      toolbar_destroy_items            (GSList             *t_item_list);
149 #endif /* __CUSTOM_TOOLBAR_H__ */