Add "reply to ml" to the toolbar
[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 GSList *toolbar_list;
32
33 #define TOOLBAR_DESTROY_ITEMS(t_item_list) \
34 { \
35         ToolbarItem *t_item; \
36         while (t_item_list != NULL) { \
37                 t_item = (ToolbarItem*)t_item_list->data; \
38                 t_item_list = g_slist_remove(t_item_list, t_item); \
39                 if (t_item->file) \
40                         g_free(t_item->file); \
41                 if (t_item->text) \
42                         g_free(t_item->text);\
43                 g_free(t_item);\
44         }\
45         g_slist_free(t_item_list);\
46 }
47
48 #define TOOLBAR_DESTROY_ACTIONS(t_action_list) \
49 { \
50         ToolbarSylpheedActions *t_action; \
51         while (t_action_list != NULL) { \
52                 t_action = (ToolbarSylpheedActions*)t_action_list->data;\
53                 t_action_list = \
54                         g_slist_remove(t_action_list, t_action);\
55                 if (t_action->name) \
56                         g_free(t_action->name); \
57                 g_free(t_action); \
58         } \
59         g_slist_free(t_action_list); \
60 }
61
62 typedef struct _ToolbarConfig ToolbarConfig;
63 struct _ToolbarConfig {
64         const gchar  *conf_file;
65         GSList       *item_list;
66 };
67
68
69 /* enum holds available actions for both 
70    Compose Toolbar and Main Toolbar 
71 */
72 enum {
73         /* main toolbar */
74         A_RECEIVE_ALL = 0,
75         A_RECEIVE_CUR,
76         A_SEND_QUEUED,
77         A_COMPOSE_EMAIL,
78         A_COMPOSE_NEWS,
79         A_REPLY_MESSAGE,
80         A_REPLY_SENDER,
81         A_REPLY_ALL,
82         A_REPLY_ML,
83         A_FORWARD,
84         A_DELETE,
85         A_EXECUTE,
86         A_GOTO_NEXT,
87
88         /* compose toolbar */
89         A_SEND,
90         A_SENDL,
91         A_DRAFT,
92         A_INSERT,
93         A_ATTACH,
94         A_SIG,
95         A_EXTEDITOR,
96         A_LINEWRAP,
97         A_ADDRBOOK,
98
99         /* common items */
100         A_SYL_ACTIONS,
101         A_SEPARATOR,
102
103         N_ACTION_VAL
104 };
105
106 typedef struct _ToolbarText ToolbarText;
107 struct _ToolbarText 
108 {
109         gchar *index_str;
110         gchar *descr;
111 };
112
113 typedef struct _ToolbarItem ToolbarItem;
114 struct _ToolbarItem 
115 {
116         gint      index;
117         gchar    *file;
118         gchar    *text;
119         gpointer  parent;
120 };
121
122 typedef struct _ToolbarSylpheedActions ToolbarSylpheedActions;
123 struct _ToolbarSylpheedActions
124 {
125         GtkWidget *widget;
126         gchar     *name;
127 };
128
129
130 void      toolbar_action_execute           (GtkWidget           *widget,
131                                             GSList              *action_list, 
132                                             gpointer            data,
133                                             gint                source);
134
135 GList    *toolbar_get_action_items         (Toolbar            source);
136
137 void      toolbar_save_config_file         (Toolbar            source);
138 void      toolbar_read_config_file         (Toolbar            source);
139
140 void      toolbar_set_default              (Toolbar            source);
141 void      toolbar_clear_list               (Toolbar            source);
142
143 GSList   *toolbar_get_list                 (Toolbar            source);
144 void      toolbar_set_list_item            (ToolbarItem        *t_item, 
145                                             Toolbar            source);
146
147 gint      toolbar_ret_val_from_descr       (const gchar        *descr);
148 gchar    *toolbar_ret_descr_from_val       (gint                val);
149
150 void      toolbar_destroy_items            (GSList             *t_item_list);
151 #endif /* __CUSTOM_TOOLBAR_H__ */