claws-mail/src/toolbar.h

239 lines
5.5 KiB
C
Raw Normal View History

2002-08-06 16:06:40 +02:00
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
* Copyright (C) 1999-2002 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CUSTOM_TOOLBAR_H__
#define __CUSTOM_TOOLBAR_H__
2002-09-22 16:34:20 +02:00
#define SEPARATOR "separator"
#define SEPARATOR_PIXMAP "---"
typedef struct _ToolbarSylpheedActions ToolbarSylpheedActions;
typedef struct _ToolbarConfig ToolbarConfig;
typedef struct _ToolbarItem ToolbarItem;
typedef struct _ToolbarParent ToolbarParent;
typedef struct _Toolbar Toolbar;
2002-09-22 16:34:20 +02:00
typedef enum {
TOOLBAR_MAIN = 0,
2002-09-22 16:34:20 +02:00
TOOLBAR_COMPOSE,
TOOLBAR_MSGVIEW
} ToolbarType;
typedef enum
{
COMPOSEBUTTON_MAIL,
COMPOSEBUTTON_NEWS
} ComposeButtonType;
struct _Toolbar {
GtkWidget *toolbar;
GtkWidget *get_btn;
GtkWidget *getall_btn;
GtkWidget *send_btn;
GtkWidget *compose_mail_btn;
GtkWidget *compose_news_btn;
2002-09-22 16:34:20 +02:00
GtkWidget *reply_btn;
GtkWidget *replysender_btn;
GtkWidget *replyall_btn;
GtkWidget *replylist_btn;
GtkWidget *fwd_btn;
GtkWidget *delete_btn;
GtkWidget *next_btn;
GtkWidget *exec_btn;
GtkWidget *separator;
/* for the reply buttons */
GtkWidget *reply_popup;
GtkWidget *replyall_popup;
GtkWidget *replylist_popup;
GtkWidget *replysender_popup;
/* the forward button similar to the reply buttons*/
GtkWidget *fwd_popup;
ComposeButtonType compose_btn_type;
/* compose buttons */
GtkWidget *sendl_btn;
GtkWidget *draft_btn;
GtkWidget *insert_btn;
GtkWidget *attach_btn;
GtkWidget *sig_btn;
GtkWidget *exteditor_btn;
GtkWidget *linewrap_btn;
GtkWidget *addrbook_btn;
GSList *action_list;
GSList *item_list;
};
struct _ToolbarParent {
ToolbarType type;
gpointer data;
};
#define TOOLBAR_DESTROY_ITEMS(item_list) \
2002-09-22 16:34:20 +02:00
{ \
ToolbarItem *item; \
while (item_list != NULL) { \
item = (ToolbarItem*)item_list->data; \
item_list = g_slist_remove(item_list, item); \
if (item->file) \
g_free(item->file); \
if (item->text) \
g_free(item->text); \
if (item->parent) \
g_free(item->parent); \
g_free(item);\
2002-09-22 16:34:20 +02:00
}\
g_slist_free(item_list);\
2002-09-22 16:34:20 +02:00
}
#define TOOLBAR_DESTROY_ACTIONS(action_list) \
2002-09-22 16:34:20 +02:00
{ \
ToolbarSylpheedActions *action; \
while (action_list != NULL) { \
action = (ToolbarSylpheedActions*)action_list->data;\
action_list = \
g_slist_remove(action_list, action);\
if (action->name) \
g_free(action->name); \
g_free(action); \
2002-09-22 16:34:20 +02:00
} \
g_slist_free(action_list); \
2002-09-22 16:34:20 +02:00
}
struct _ToolbarConfig {
const gchar *conf_file;
GSList *item_list;
};
2002-08-06 16:06:40 +02:00
2002-09-22 16:34:20 +02:00
/* enum holds available actions for both
Compose Toolbar and Main Toolbar
*/
enum {
/* main toolbar */
2002-08-06 16:06:40 +02:00
A_RECEIVE_ALL = 0,
A_RECEIVE_CUR,
A_SEND_QUEUED,
2002-08-06 16:06:40 +02:00
A_COMPOSE_EMAIL,
2002-09-22 16:34:20 +02:00
A_COMPOSE_NEWS,
2002-08-06 16:06:40 +02:00
A_REPLY_MESSAGE,
A_REPLY_SENDER,
A_REPLY_ALL,
2002-09-26 23:46:12 +02:00
A_REPLY_ML,
2002-08-06 16:06:40 +02:00
A_FORWARD,
A_DELETE,
A_EXECUTE,
A_GOTO_NEXT,
2002-09-22 16:34:20 +02:00
/* compose toolbar */
A_SEND,
A_SENDL,
A_DRAFT,
A_INSERT,
A_ATTACH,
A_SIG,
A_EXTEDITOR,
A_LINEWRAP,
A_ADDRBOOK,
/* common items */
A_SYL_ACTIONS,
2002-09-22 16:34:20 +02:00
A_SEPARATOR,
2002-08-06 16:06:40 +02:00
2002-09-22 16:34:20 +02:00
N_ACTION_VAL
};
2002-08-06 16:06:40 +02:00
struct _ToolbarItem
{
2002-09-22 16:34:20 +02:00
gint index;
gchar *file;
gchar *text;
ToolbarParent *parent;
2002-08-06 16:06:40 +02:00
};
2002-08-06 16:06:40 +02:00
struct _ToolbarSylpheedActions
{
GtkWidget *widget;
gchar *name;
};
2002-09-22 16:34:20 +02:00
void toolbar_action_execute (GtkWidget *widget,
GSList *action_list,
gpointer data,
gint source);
2002-08-06 16:06:40 +02:00
GList *toolbar_get_action_items (ToolbarType source);
2002-08-06 16:06:40 +02:00
void toolbar_save_config_file (ToolbarType source);
void toolbar_read_config_file (ToolbarType source);
2002-08-06 16:06:40 +02:00
void toolbar_set_default (ToolbarType source);
void toolbar_clear_list (ToolbarType source);
2002-08-06 16:06:40 +02:00
GSList *toolbar_get_list (ToolbarType source);
2002-09-22 16:34:20 +02:00
void toolbar_set_list_item (ToolbarItem *t_item,
ToolbarType source);
2002-08-06 16:06:40 +02:00
2002-09-22 16:34:20 +02:00
gint toolbar_ret_val_from_descr (const gchar *descr);
gchar *toolbar_ret_descr_from_val (gint val);
2002-08-06 16:06:40 +02:00
void common_toolbar_delete_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_compose_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_reply_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_reply_to_all_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_reply_to_list_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_reply_to_sender_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_forward_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_next_unread_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_actions_execute_cb (GtkWidget *widget,
gpointer data);
void common_toolbar_set_style (gpointer data,
ToolbarType type);
2002-08-06 16:06:40 +02:00
#endif /* __CUSTOM_TOOLBAR_H__ */