Bug Fix #596834 and #596832
[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 TOOLBAR_FILE     "toolbar.xml"
25
26 #define SEPARATOR_PIXMAP "---"
27
28 typedef enum 
29 {
30         A_RECEIVE_ALL = 0,
31         A_RECEIVE_CUR,
32         A_SEND_QUEUED,
33         A_COMPOSE_EMAIL,
34         A_REPLY_MESSAGE,
35         A_REPLY_SENDER,
36         A_REPLY_ALL,
37         A_FORWARD,
38         A_DELETE,
39         A_EXECUTE,
40         A_GOTO_NEXT,
41         A_SYL_ACTIONS,
42         
43         N_ACTION_VAL
44 } CTActionVal;
45
46 #define A_COMPOSE_NEWS N_ACTION_VAL + 1
47 #define A_SEPARATOR    N_ACTION_VAL + 2
48
49 typedef struct _ToolbarAction ToolbarAction;
50 struct _ToolbarAction
51 {
52         gchar *action_text;
53         gchar *descr;
54         void (*func)(GtkWidget *widget, gpointer data);
55 };
56
57 typedef struct _ToolbarItem ToolbarItem;
58 struct _ToolbarItem 
59 {
60         gchar *file;
61         gchar *text;
62         gint  action;
63 };
64
65 typedef struct _ToolbarSylpheedActions ToolbarSylpheedActions;
66 struct _ToolbarSylpheedActions
67 {
68         GtkWidget *widget;
69         gchar     *name;
70 };
71
72 typedef enum 
73 {
74         COMPOSEBUTTON_MAIL,
75         COMPOSEBUTTON_NEWS
76 } ComposeButtonType;
77
78 typedef struct _MainToolbar MainToolbar;
79
80 struct _MainToolbar {
81
82         GtkWidget *toolbar;
83
84         GtkWidget *get_btn;
85         GtkWidget *getall_btn;
86         GtkWidget *sel_down;
87         GtkWidget *sel_down_all;
88         GtkWidget *sel_down_cur;
89         GtkWidget *send_btn;
90
91         GtkWidget *compose_mail_btn;
92         GtkWidget *compose_news_btn;
93
94         GtkWidget *reply_btn;
95         GtkWidget *replysender_btn;
96         GtkWidget *replyall_btn;
97
98         GtkWidget *fwd_btn;
99
100         GtkWidget *delete_btn;
101         GtkWidget *next_btn;
102         GtkWidget *exec_btn;
103
104         GSList    *syl_action;
105         GtkWidget *separator;
106
107         /* for the reply buttons */
108         GtkWidget *reply_popup;
109         GtkWidget *replyall_popup;
110         GtkWidget *replysender_popup;
111         
112         /* the forward button similar to the reply buttons*/
113         GtkWidget *fwd_popup;
114
115         ComposeButtonType compose_btn_type;
116 };
117
118 extern GSList *toolbar_list;
119
120 void      toolbar_actions_cb               (GtkWidget          *widget, 
121                                             ToolbarItem        *toolbar_item);
122
123 GList    *toolbar_get_action_items         (void);
124 void      toolbar_save_config_file         (void);
125 void      toolbar_read_config_file         (void);
126 void      toolbar_set_default_toolbar      (void);
127 void      toolbar_clear_list               (void);
128 void      toolbar_update                   (void);
129 void      toolbar_destroy                  (MainWindow         *mainwin);
130
131 gint      toolbar_ret_val_from_descr       (gchar              *descr);
132 gchar    *toolbar_ret_descr_from_val       (gint               val);
133 gchar    *toolbar_ret_text_from_val        (gint               val);
134 void      toolbar_create                   (MainWindow         *mainwin,
135                                             GtkWidget          *container);
136
137 void      toolbar_set_sensitive            (MainWindow         *mainwin);
138 void      toolbar_set_compose_button       (MainToolbar        *toolbar, 
139                                             ComposeButtonType  compose_btn_type);
140 #endif /* __CUSTOM_TOOLBAR_H__ */