aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/mainwindow.c223
-rw-r--r--src/prefs_display_items.c509
-rw-r--r--src/prefs_display_items.h77
-rw-r--r--src/prefs_toolbar.c213
-rw-r--r--src/prefs_toolbar.h72
6 files changed, 1010 insertions, 86 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index df0c26e9..474ebea5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,12 +27,14 @@ sylpheed_SOURCES = \
prefs_filter_edit.c prefs_filter_edit.h \
prefs_account_dialog.c prefs_account_dialog.h \
prefs_folder_item.c prefs_folder_item.h \
+ prefs_display_items.c prefs_display_items.h \
prefs_display_header.c prefs_display_header.h \
prefs_customheader.c prefs_customheader.h \
prefs_summary_column.c prefs_summary_column.h \
prefs_template.c prefs_template.h \
prefs_actions.c prefs_actions.h \
prefs_search_folder.c prefs_search_folder.h \
+ prefs_toolbar.c prefs_toolbar.h \
account_dialog.c account_dialog.h \
template.c template.h \
addressbook.c addressbook.h \
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 8a227dc2..3542dd9f 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -73,6 +73,7 @@
#include "prefs_summary_column.h"
#include "prefs_template.h"
#include "prefs_search_folder.h"
+#include "prefs_toolbar.h"
#include "action.h"
#include "account.h"
#include "account_dialog.h"
@@ -119,6 +120,9 @@ static void main_window_show_cur_account (MainWindow *mainwin);
static void main_window_set_widgets (MainWindow *mainwin,
SeparateType type);
static GtkWidget *main_window_toolbar_create (MainWindow *mainwin);
+static GtkWidget *main_window_toolbar_create_from_list
+ (MainWindow *mainwin,
+ GList *item_list);
/* callback functions */
static void toolbar_inc_cb (GtkWidget *widget,
@@ -147,20 +151,13 @@ static void toolbar_exec_cb (GtkWidget *widget,
static void toolbar_next_unread_cb (GtkWidget *widget,
gpointer data);
-#if 0
-static void toolbar_prefs_cb (GtkWidget *widget,
- gpointer data);
-static void toolbar_account_cb (GtkWidget *widget,
+static gboolean toolbar_button_pressed (GtkWidget *widget,
+ GdkEventButton *event,
gpointer data);
-static void toolbar_account_button_pressed (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data);
-#endif
-
static void online_switch_clicked (GtkWidget *widget,
gpointer data);
-static void ac_label_button_pressed (GtkWidget *widget,
+static gboolean ac_label_button_pressed (GtkWidget *widget,
GdkEventButton *event,
gpointer data);
static void ac_menu_popup_closed (GtkMenuShell *menu_shell,
@@ -270,6 +267,9 @@ static void toggle_searchbar_cb (MainWindow *mainwin,
static void toggle_statusbar_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
+static void toolbar_customize_cb (MainWindow *mainwin,
+ guint action,
+ GtkWidget *widget);
static void separate_widget_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
@@ -557,6 +557,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
NULL, toggle_searchbar_cb, 0, "<ToggleItem>"},
{N_("/_View/Show or hi_de/Status _bar"),
NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
+ {N_("/_View/_Customize toolbar..."), NULL, toolbar_customize_cb, 0, NULL},
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View/Separate f_older tree"), NULL, separate_widget_cb, SEPARATE_FOLDER, "<ToggleItem>"},
{N_("/_View/Separate _message view"), NULL, separate_widget_cb, SEPARATE_MESSAGE, "<ToggleItem>"},
@@ -2332,46 +2333,63 @@ static GtkItemFactoryEntry forward_entries[] =
{N_("/Redirec_t"), NULL, reply_cb, COMPOSE_REDIRECT, NULL}
};
-typedef struct _ToolbarItem ToolbarItem;
+static PrefsToolbarItem items[] =
+{
+ {T_GET, N_("Incorporate new mail"),
+ STOCK_PIXMAP_MAIL_RECEIVE, toolbar_inc_cb},
+ {T_GET_ALL, N_("Incorporate new mail of all accounts"),
+ STOCK_PIXMAP_MAIL_RECEIVE_ALL, toolbar_inc_all_cb},
+ {T_SEND_QUEUE, N_("Send queued message(s)"),
+ STOCK_PIXMAP_MAIL_SEND, toolbar_send_cb},
+ {T_COMPOSE, N_("Compose new message"),
+ STOCK_PIXMAP_MAIL_COMPOSE, toolbar_compose_cb},
+ {T_REPLY, N_("Reply to the message"),
+ STOCK_PIXMAP_MAIL_REPLY, toolbar_reply_cb},
+ {T_REPLY_ALL, N_("Reply to all"),
+ STOCK_PIXMAP_MAIL_REPLY_TO_ALL, toolbar_reply_to_all_cb},
+ {T_FORWARD, N_("Forward the message"),
+ STOCK_PIXMAP_MAIL_FORWARD, toolbar_forward_cb},
+ {T_DELETE, N_("Delete the message"),
+ STOCK_PIXMAP_DELETE, toolbar_delete_cb},
+ {T_JUNK, N_("Set as junk mail"),
+ STOCK_PIXMAP_SPAM, toolbar_junk_cb},
+ {T_EXECUTE, N_("Execute marked process"),
+ -1, toolbar_exec_cb},
+ {T_NEXT, N_("Next unread message"),
+ -1, toolbar_next_unread_cb},
+
+ {-1, NULL, -1, NULL}
+};
-struct _ToolbarItem
+static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
{
- gchar *id;
- gchar *label;
- gchar *tooltip;
- StockPixmap icon;
- void (*callback) (GtkWidget *widget, gpointer data);
- gpointer data;
-};
+ GtkWidget *toolbar;
+ const gchar *setting;
+ GList *item_list;
-static ToolbarItem items[] =
-{
- {"get", N_("Get"), N_("Incorporate new mail"), STOCK_PIXMAP_MAIL_RECEIVE, toolbar_inc_cb},
- {"get-all", N_("Get all"), N_("Incorporate new mail of all accounts"), STOCK_PIXMAP_MAIL_RECEIVE_ALL, toolbar_inc_all_cb},
- {"send-queue", N_("Send"), N_("Send queued message(s)"), STOCK_PIXMAP_MAIL_SEND, toolbar_send_cb},
- {"compose", N_("Compose"), N_("Compose new message"), STOCK_PIXMAP_MAIL_COMPOSE, toolbar_compose_cb},
- {"reply", N_("Reply"), N_("Reply to the message"), STOCK_PIXMAP_MAIL_REPLY, toolbar_reply_cb},
- {"reply-all", N_("Reply all"), N_("Reply to all"), STOCK_PIXMAP_MAIL_REPLY_TO_ALL, toolbar_reply_to_all_cb},
- {"forward", N_("Forward"), N_("Forward the message"), STOCK_PIXMAP_MAIL_FORWARD, toolbar_forward_cb},
- {"delete", N_("Delete"), N_("Delete the message"), STOCK_PIXMAP_DELETE, toolbar_delete_cb},
- {"junk", N_("Junk"), N_("Set as junk mail"), STOCK_PIXMAP_SPAM, toolbar_junk_cb},
- {"execute", N_("Execute"), N_("Execute marked process"), -1, toolbar_exec_cb},
- {"next", N_("Next"), N_("Next unread message"), -1, toolbar_next_unread_cb},
-
- {NULL, NULL, NULL, -1, NULL}
-};
+ if (prefs_common.main_toolbar_setting &&
+ *prefs_common.main_toolbar_setting != '\0')
+ setting = prefs_common.main_toolbar_setting;
+ else
+ setting = prefs_toolbar_get_default_setting_name_list();
-static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
+ item_list = prefs_toolbar_get_item_list_from_name_list(setting);
+ toolbar = main_window_toolbar_create_from_list(mainwin, item_list);
+ g_list_free(item_list);
+
+ return toolbar;
+}
+
+static GtkWidget *main_window_toolbar_create_from_list(MainWindow *mainwin,
+ GList *item_list)
{
GtkWidget *toolbar;
GtkWidget *icon_wid;
GtkWidget *button;
ComboButton *combo;
gint n_entries;
- const gchar *setting = "get,get-all,separator,send-queue,separator,compose,reply,reply-all,forward,separator,delete,junk,separator,execute,next";
- gchar **array;
gint i;
- ToolbarItem *item;
+ GList *cur;
toolbar = gtk_toolbar_new();
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
@@ -2379,6 +2397,8 @@ static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH);
gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar),
GTK_ICON_SIZE_LARGE_TOOLBAR);
+ g_signal_connect(G_OBJECT(toolbar), "button_press_event",
+ G_CALLBACK(toolbar_button_pressed), mainwin);
items[0].data = &mainwin->get_btn;
items[1].data = &mainwin->getall_btn;
@@ -2396,47 +2416,44 @@ static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
mainwin->reply_combo = NULL;
mainwin->fwd_combo = NULL;
- if (prefs_common.main_toolbar_setting &&
- *prefs_common.main_toolbar_setting != '\0')
- setting = prefs_common.main_toolbar_setting;
- array = g_strsplit(setting, ",", 0);
-
- for (i = 0; array[i] != NULL; i++) {
- gchar *id = array[i];
+ for (cur = item_list; cur != NULL; cur = cur->next) {
+ const PrefsDisplayItem *ditem = cur->data;
+ PrefsToolbarItem *item;
- g_strstrip(id);
- g_print("id: %s\n", id);
-
- if (!strcmp(id, "separator")) {
+ if (ditem->id == T_SEPARATOR) {
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
continue;
}
- for (item = items; item->id != NULL; item++) {
- if (!strcmp(id, item->id))
+ for (item = items; item->id != -1; item++) {
+ if (ditem->id == item->id)
break;
}
- if (!item->id)
+ if (item->id == -1)
continue;
- if (!strcmp(id, "execute")) {
+ if (ditem->id == T_EXECUTE) {
icon_wid = gtk_image_new_from_stock
(GTK_STOCK_EXECUTE,
GTK_ICON_SIZE_LARGE_TOOLBAR);
- } else if (!strcmp(id, "next")) {
+ } else if (ditem->id == T_NEXT) {
icon_wid = gtk_image_new_from_stock
(GTK_STOCK_GO_DOWN,
GTK_ICON_SIZE_LARGE_TOOLBAR);
} else
icon_wid = stock_pixbuf_widget(NULL, item->icon);
+
button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- gettext(item->label),
+ gettext(ditem->label),
gettext(item->tooltip),
- item->id, icon_wid,
+ ditem->name, icon_wid,
G_CALLBACK(item->callback),
mainwin);
- if (!strcmp(id, "reply")) {
+ g_signal_connect(G_OBJECT(button), "button_press_event",
+ G_CALLBACK(toolbar_button_pressed), mainwin);
+
+ if (ditem->id == T_REPLY) {
n_entries = sizeof(reply_entries) /
sizeof(reply_entries[0]);
combo = gtkut_combo_button_create
@@ -2447,9 +2464,9 @@ static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
GTK_WIDGET_PTR(combo),
gettext(item->tooltip),
- item->id);
+ ditem->name);
mainwin->reply_combo = combo;
- } else if (!strcmp(id, "forward")) {
+ } else if (ditem->id == T_FORWARD) {
n_entries = sizeof(forward_entries) /
sizeof(forward_entries[0]);
combo = gtkut_combo_button_create
@@ -2460,15 +2477,13 @@ static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
GTK_WIDGET_PTR(combo),
gettext(item->tooltip),
- item->id);
+ ditem->name);
mainwin->fwd_combo = combo;
}
*(GtkWidget **)item->data = button;
}
- g_strfreev(array);
-
gtk_widget_show_all(toolbar);
return toolbar;
@@ -2567,38 +2582,66 @@ static void toolbar_next_unread_cb (GtkWidget *widget,
next_unread_cb(mainwin, 0, NULL);
}
-#if 0
-static void toolbar_prefs_cb (GtkWidget *widget,
- gpointer data)
-{
- prefs_common_open();
-}
-
-static void toolbar_account_cb (GtkWidget *widget,
- gpointer data)
+static void toolbar_customize(GtkWidget *widget, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+ gint *visible_items;
+ GList *item_list = NULL;
+ GtkWidget *toolbar;
+ gint ret;
+ const gchar *setting;
- prefs_account_open_cb(mainwin, 0, NULL);
+ if (prefs_common.main_toolbar_setting &&
+ *prefs_common.main_toolbar_setting != '\0')
+ setting = prefs_common.main_toolbar_setting;
+ else
+ setting = prefs_toolbar_get_default_setting_name_list();
+ visible_items = prefs_toolbar_get_id_list_from_name_list(setting);
+ ret = prefs_toolbar_open(visible_items, &item_list);
+ g_free(visible_items);
+
+ if (ret == 0) {
+ gtk_widget_destroy(mainwin->toolbar);
+ toolbar = main_window_toolbar_create_from_list(mainwin,
+ item_list);
+ gtk_widget_set_size_request(toolbar, 300, -1);
+ gtk_box_pack_start(GTK_BOX(mainwin->vbox), toolbar,
+ FALSE, FALSE, 0);
+ gtk_box_reorder_child(GTK_BOX(mainwin->vbox), toolbar, 1);
+ mainwin->toolbar = toolbar;
+ main_window_set_toolbar_sensitive(mainwin);
+ g_free(prefs_common.main_toolbar_setting);
+ prefs_common.main_toolbar_setting =
+ prefs_toolbar_get_name_list_from_item_list(item_list);
+ g_list_free(item_list);
+ }
}
-static void toolbar_account_button_pressed(GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
+static gboolean toolbar_button_pressed(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+ GtkWidget *menu;
+ GtkWidget *menuitem;
- if (!event) return;
- if (event->button != 3) return;
+ if (!event) return FALSE;
+ if (event->button != 3) return FALSE;
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- g_object_set_data(G_OBJECT(mainwin->ac_menu), "menu_button", widget);
+ menu = gtk_menu_new();
+ gtk_widget_show(menu);
- gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
- menu_button_position, widget,
+ MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, _("_Customize toolbar..."),
+ 0);
+ g_signal_connect(G_OBJECT(menuitem), "activate",
+ G_CALLBACK(toolbar_customize), mainwin);
+ g_signal_connect(G_OBJECT(menu), "selection_done",
+ G_CALLBACK(gtk_widget_destroy), NULL);
+
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event->button, event->time);
+
+ return TRUE;
}
-#endif
static void online_switch_clicked(GtkWidget *widget, gpointer data)
{
@@ -2633,12 +2676,12 @@ static void online_switch_clicked(GtkWidget *widget, gpointer data)
}
}
-static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
- gpointer data)
+static gboolean ac_label_button_pressed(GtkWidget *widget,
+ GdkEventButton *event, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
- if (!event) return;
+ if (!event) return FALSE;
gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
g_object_set_data(G_OBJECT(mainwin->ac_menu), "menu_button", widget);
@@ -2646,6 +2689,8 @@ static void ac_label_button_pressed(GtkWidget *widget, GdkEventButton *event,
gtk_menu_popup(GTK_MENU(mainwin->ac_menu), NULL, NULL,
menu_button_position, widget,
event->button, event->time);
+
+ return TRUE;
}
static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
@@ -3018,6 +3063,12 @@ static void toggle_statusbar_cb(MainWindow *mainwin, guint action,
}
}
+static void toolbar_customize_cb(MainWindow *mainwin, guint action,
+ GtkWidget *widget)
+{
+ toolbar_customize(widget, mainwin);
+}
+
static void separate_widget_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
diff --git a/src/prefs_display_items.c b/src/prefs_display_items.c
new file mode 100644
index 00000000..00295279
--- /dev/null
+++ b/src/prefs_display_items.c
@@ -0,0 +1,509 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2007 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkclist.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkstock.h>
+
+#include "prefs.h"
+#include "prefs_ui.h"
+#include "prefs_common.h"
+#include "prefs_display_items.h"
+#include "manage_window.h"
+#include "mainwindow.h"
+#include "gtkutils.h"
+#include "utils.h"
+
+/* callback functions */
+static void prefs_display_items_add (GtkWidget *widget,
+ gpointer data);
+static void prefs_display_items_remove (GtkWidget *widget,
+ gpointer data);
+
+static void prefs_display_items_up (GtkWidget *widget,
+ gpointer data);
+static void prefs_display_items_down (GtkWidget *widget,
+ gpointer data);
+
+static void prefs_display_items_default (GtkWidget *widget,
+ gpointer data);
+
+static void prefs_display_items_ok (GtkWidget *widget,
+ gpointer data);
+static void prefs_display_items_cancel (GtkWidget *widget,
+ gpointer data);
+
+static gint prefs_display_items_delete_event (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
+static gboolean prefs_display_items_key_pressed (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
+
+PrefsDisplayItemsDialog *prefs_display_items_dialog_create(void)
+{
+ PrefsDisplayItemsDialog *dialog;
+
+ GtkWidget *window;
+ GtkWidget *vbox;
+
+ GtkWidget *label_hbox;
+ GtkWidget *label;
+
+ GtkWidget *vbox1;
+
+ GtkWidget *hbox1;
+ GtkWidget *clist_hbox;
+ GtkWidget *scrolledwin;
+ GtkWidget *stock_clist;
+ GtkWidget *shown_clist;
+
+ GtkWidget *btn_vbox;
+ GtkWidget *btn_vbox1;
+ GtkWidget *add_btn;
+ GtkWidget *remove_btn;
+ GtkWidget *up_btn;
+ GtkWidget *down_btn;
+
+ GtkWidget *btn_hbox;
+ GtkWidget *default_btn;
+ GtkWidget *confirm_area;
+ GtkWidget *ok_btn;
+ GtkWidget *cancel_btn;
+
+ gchar *title[1];
+
+ dialog = g_new0(PrefsDisplayItemsDialog, 1);
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_container_set_border_width(GTK_CONTAINER(window), 8);
+ gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+ gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+ gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
+ gtk_window_set_title(GTK_WINDOW(window), _("Display items setting"));
+ g_signal_connect(G_OBJECT(window), "delete_event",
+ G_CALLBACK(prefs_display_items_delete_event), dialog);
+ g_signal_connect(G_OBJECT(window), "key_press_event",
+ G_CALLBACK(prefs_display_items_key_pressed), dialog);
+
+ vbox = gtk_vbox_new(FALSE, 6);
+ gtk_widget_show(vbox);
+ gtk_container_add(GTK_CONTAINER(window), vbox);
+
+ label_hbox = gtk_hbox_new(FALSE, 0);
+ gtk_widget_show(label_hbox);
+ gtk_box_pack_start(GTK_BOX(vbox), label_hbox, FALSE, FALSE, 4);
+
+ label = gtk_label_new("");
+ gtk_widget_show(label);
+ gtk_box_pack_start(GTK_BOX(label_hbox), label, FALSE, FALSE, 4);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+
+ vbox1 = gtk_vbox_new(FALSE, VSPACING);
+ gtk_widget_show(vbox1);
+ gtk_box_pack_start(GTK_BOX(vbox), vbox1, TRUE, TRUE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox1), 2);
+
+ hbox1 = gtk_hbox_new(FALSE, 8);
+ gtk_widget_show(hbox1);
+ gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, TRUE, 0);
+
+ clist_hbox = gtk_hbox_new(FALSE, 8);
+ gtk_widget_show(clist_hbox);
+ gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0);
+
+ scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_set_size_request(scrolledwin, 180, 210);
+ gtk_widget_show(scrolledwin);
+ gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ title[0] = _("Available items");
+ stock_clist = gtk_clist_new_with_titles(1, title);
+ gtk_widget_show(stock_clist);
+ gtk_container_add(GTK_CONTAINER(scrolledwin), stock_clist);
+ gtk_clist_set_selection_mode(GTK_CLIST(stock_clist),
+ GTK_SELECTION_BROWSE);
+ GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(stock_clist)->column[0].button,
+ GTK_CAN_FOCUS);
+
+ /* add/remove button */
+ btn_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_widget_show(btn_vbox);
+ gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0);
+
+ btn_vbox1 = gtk_vbox_new(FALSE, 8);
+ gtk_widget_show(btn_vbox1);
+ gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0);
+
+ add_btn = gtk_button_new_with_label(_(" -> "));
+ gtk_widget_show(add_btn);
+ gtk_box_pack_start(GTK_BOX(btn_vbox1), add_btn, FALSE, FALSE, 0);
+
+ remove_btn = gtk_button_new_with_label(_(" <- "));
+ gtk_widget_show(remove_btn);
+ gtk_box_pack_start(GTK_BOX(btn_vbox1), remove_btn, FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(add_btn), "clicked",
+ G_CALLBACK(prefs_display_items_add), dialog);
+ g_signal_connect(G_OBJECT(remove_btn), "clicked",
+ G_CALLBACK(prefs_display_items_remove), dialog);
+
+ clist_hbox = gtk_hbox_new(FALSE, 8);
+ gtk_widget_show(clist_hbox);
+ gtk_box_pack_start(GTK_BOX(hbox1), clist_hbox, TRUE, TRUE, 0);
+
+ scrolledwin = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_set_size_request(scrolledwin, 180, 210);
+ gtk_widget_show(scrolledwin);
+ gtk_box_pack_start(GTK_BOX(clist_hbox), scrolledwin, TRUE, TRUE, 0);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ title[0] = _("Displayed items");
+ shown_clist = gtk_clist_new_with_titles(1, title);
+ gtk_widget_show(shown_clist);
+ gtk_container_add(GTK_CONTAINER(scrolledwin), shown_clist);
+ gtk_clist_set_selection_mode(GTK_CLIST(shown_clist),
+ GTK_SELECTION_BROWSE);
+ gtk_clist_set_reorderable(GTK_CLIST(shown_clist), TRUE);
+ gtk_clist_set_use_drag_icons(GTK_CLIST(shown_clist), FALSE);
+ GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(shown_clist)->column[0].button,
+ GTK_CAN_FOCUS);
+
+ /* up/down button */
+ btn_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_widget_show(btn_vbox);
+ gtk_box_pack_start(GTK_BOX(hbox1), btn_vbox, FALSE, FALSE, 0);
+
+ btn_vbox1 = gtk_vbox_new(FALSE, 8);
+ gtk_widget_show(btn_vbox1);
+ gtk_box_pack_start(GTK_BOX(btn_vbox), btn_vbox1, TRUE, FALSE, 0);
+
+ up_btn = gtk_button_new_with_label(_("Up"));
+ gtk_widget_show(up_btn);
+ gtk_box_pack_start(GTK_BOX(btn_vbox1), up_btn, FALSE, FALSE, 0);
+
+ down_btn = gtk_button_new_with_label(_("Down"));
+ gtk_widget_show(down_btn);
+ gtk_box_pack_start(GTK_BOX(btn_vbox1), down_btn, FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(up_btn), "clicked",
+ G_CALLBACK(prefs_display_items_up), dialog);
+ g_signal_connect(G_OBJECT(down_btn), "clicked",
+ G_CALLBACK(prefs_display_items_down), dialog);
+
+ btn_hbox = gtk_hbox_new(FALSE, 8);
+ gtk_widget_show(btn_hbox);
+ gtk_box_pack_end(GTK_BOX(vbox), btn_hbox, FALSE, FALSE, 0);
+
+ btn_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_widget_show(btn_vbox);
+ gtk_box_pack_start(GTK_BOX(btn_hbox), btn_vbox, FALSE, FALSE, 0);
+
+ default_btn = gtk_button_new_with_label(_(" Revert to default "));
+ gtk_widget_show(default_btn);
+ gtk_box_pack_start(GTK_BOX(btn_vbox), default_btn, TRUE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(default_btn), "clicked",
+ G_CALLBACK(prefs_display_items_default), dialog);
+
+ gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK,
+ &cancel_btn, GTK_STOCK_CANCEL,
+ NULL, NULL);
+ gtk_widget_show(confirm_area);
+ gtk_box_pack_end(GTK_BOX(btn_hbox), confirm_area, FALSE, FALSE, 0);
+ gtk_widget_grab_default(ok_btn);
+
+ g_signal_connect(G_OBJECT(ok_btn), "clicked",
+ G_CALLBACK(prefs_display_items_ok), dialog);
+ g_signal_connect(G_OBJECT(cancel_btn), "clicked",
+ G_CALLBACK(prefs_display_items_cancel), dialog);
+
+ dialog->window = window;
+ dialog->stock_clist = stock_clist;
+ dialog->shown_clist = shown_clist;
+ dialog->add_btn = add_btn;
+ dialog->remove_btn = remove_btn;
+ dialog->up_btn = up_btn;
+ dialog->down_btn = down_btn;
+ dialog->confirm_area = confirm_area;
+ dialog->ok_btn = ok_btn;
+ dialog->cancel_btn = cancel_btn;
+
+ gtkut_box_set_reverse_order(GTK_BOX(dialog->confirm_area),
+ !prefs_common.comply_gnome_hig);
+ manage_window_set_transient(GTK_WINDOW(dialog->window));
+ gtk_widget_grab_focus(dialog->ok_btn);
+
+ gtk_widget_show(dialog->window);
+
+ dialog->finished = FALSE;
+ dialog->cancelled = FALSE;
+
+ return dialog;
+}
+
+void prefs_display_items_dialog_destroy(PrefsDisplayItemsDialog *dialog)
+{
+ if (!dialog)
+ return;
+
+ if (dialog->visible_items)
+ g_list_free(dialog->visible_items);
+ gtk_widget_destroy(dialog->window);
+ g_free(dialog);
+}
+
+static void prefs_display_items_update_available
+ (PrefsDisplayItemsDialog *dialog)
+{
+ GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist);
+ gint i;
+
+ g_return_if_fail(dialog->available_items != NULL);
+
+ gtk_clist_clear(stock_clist);
+
+ for (i = 0; dialog->available_items[i].name != NULL; i++) {
+ PrefsDisplayItem *item;
+ gint row;
+ gchar *name;
+
+ item = &dialog->available_items[i];
+
+ if (item->allow_multiple || item->in_use == FALSE) {
+ name = gettext(item->label);
+ row = gtk_clist_append(stock_clist, (gchar **)&name);
+ gtk_clist_set_row_data(stock_clist, row, item);
+ }
+ }
+
+}
+
+void prefs_display_items_dialog_set_available(PrefsDisplayItemsDialog *dialog,
+ PrefsDisplayItem *items)
+{
+ dialog->available_items = items;
+ prefs_display_items_update_available(dialog);
+}
+
+void prefs_display_items_dialog_set_default_visible
+ (PrefsDisplayItemsDialog *dialog,
+ const gint *ids)
+{
+ dialog->default_visible_ids = ids;
+}
+
+void prefs_display_items_dialog_set_visible(PrefsDisplayItemsDialog *dialog,
+ const gint *ids)
+{
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ gint i;
+
+ g_return_if_fail(dialog->available_items != NULL);
+
+ if (!ids)
+ ids = dialog->default_visible_ids;
+ g_return_if_fail(ids != NULL);
+
+ gtk_clist_clear(shown_clist);
+
+ if (dialog->visible_items) {
+ g_list_free(dialog->visible_items);
+ dialog->visible_items = NULL;
+ }
+
+ for (i = 0; dialog->available_items[i].name != NULL; i++) {
+ dialog->available_items[i].in_use = FALSE;
+ }
+
+ for (i = 0; ids[i] != -1; i++) {
+ PrefsDisplayItem *item;
+ gint row;
+ gint id = ids[i];
+ gchar *name;
+
+ item = &dialog->available_items[id];
+
+ g_return_if_fail(id == item->id);
+ g_return_if_fail(item->allow_multiple || item->in_use == FALSE);
+
+ item->in_use = TRUE;
+
+ name = gettext(item->label);
+ row = gtk_clist_append(shown_clist, (gchar **)&name);
+ gtk_clist_set_row_data(shown_clist, row, item);
+ }
+
+ prefs_display_items_update_available(dialog);
+}
+
+static void prefs_display_items_add(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+ GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist);
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ PrefsDisplayItem *item;
+ gint row;
+ gchar *name;
+
+ if (!stock_clist->selection) return;
+
+ row = GPOINTER_TO_INT(stock_clist->selection->data);
+ item = (PrefsDisplayItem *)gtk_clist_get_row_data(stock_clist, row);
+ if (!item->allow_multiple) {
+ gtk_clist_remove(stock_clist, row);
+ if (stock_clist->rows == row)
+ gtk_clist_select_row(stock_clist, row - 1, -1);
+ }
+
+ if (!shown_clist->selection)
+ row = 0;
+ else
+ row = GPOINTER_TO_INT(shown_clist->selection->data) + 1;
+
+ item->in_use = TRUE;
+
+ name = gettext(item->label);
+ row = gtk_clist_insert(shown_clist, row, (gchar **)&name);
+ gtk_clist_set_row_data(shown_clist, row, item);
+ gtk_clist_select_row(shown_clist, row, -1);
+}
+
+static void prefs_display_items_remove(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+ GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist);
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ PrefsDisplayItem *item;
+ gint row;
+ gchar *name;
+
+ if (!shown_clist->selection) return;
+
+ row = GPOINTER_TO_INT(shown_clist->selection->data);
+ item = (PrefsDisplayItem *)gtk_clist_get_row_data(shown_clist, row);
+ gtk_clist_remove(shown_clist, row);
+ if (shown_clist->rows == row)
+ gtk_clist_select_row(shown_clist, row - 1, -1);
+
+ if (!item->allow_multiple) {
+ item->in_use = FALSE;
+ prefs_display_items_update_available(dialog);
+ }
+}
+
+static void prefs_display_items_up(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ gint row;
+
+ if (!shown_clist->selection) return;
+
+ row = GPOINTER_TO_INT(shown_clist->selection->data);
+ if (row > 0)
+ gtk_clist_row_move(shown_clist, row, row - 1);
+}
+
+static void prefs_display_items_down(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ gint row;
+
+ if (!shown_clist->selection) return;
+
+ row = GPOINTER_TO_INT(shown_clist->selection->data);
+ if (row >= 0 && row < shown_clist->rows - 1)
+ gtk_clist_row_move(shown_clist, row, row + 1);
+}
+
+static void prefs_display_items_default(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+
+ prefs_display_items_dialog_set_visible(dialog, NULL);
+}
+
+static void prefs_display_items_ok(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+ GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ GList *list = NULL;
+ PrefsDisplayItem *item;
+ gint row;
+
+ for (row = 0; row < shown_clist->rows; row++) {
+ item = gtk_clist_get_row_data(shown_clist, row);
+ list = g_list_append(list, item);
+ }
+
+ dialog->visible_items = list;
+ dialog->finished = TRUE;
+}
+
+static void prefs_display_items_cancel(GtkWidget *widget, gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+
+ dialog->finished = TRUE;
+ dialog->cancelled = TRUE;
+}
+
+static gint prefs_display_items_delete_event(GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+
+ dialog->finished = TRUE;
+ dialog->cancelled = TRUE;
+ return TRUE;
+}
+
+static gboolean prefs_display_items_key_pressed(GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ PrefsDisplayItemsDialog *dialog = data;
+
+ if (event && event->keyval == GDK_Escape) {
+ dialog->finished = TRUE;
+ dialog->cancelled = TRUE;
+ }
+ return FALSE;
+}
diff --git a/src/prefs_display_items.h b/src/prefs_display_items.h
new file mode 100644
index 00000000..6e239f1a
--- /dev/null
+++ b/src/prefs_display_items.h
@@ -0,0 +1,77 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2007 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 __PREFS_DISPLAY_ITEMS_H__
+#define __PREFS_DISPLAY_ITEMS_H__
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+typedef struct _PrefsDisplayItem PrefsDisplayItem;
+typedef struct _PrefsDisplayItemsDialog PrefsDisplayItemsDialog;
+
+struct _PrefsDisplayItem
+{
+ gint id;
+ gchar *name;
+ gchar *label;
+ gboolean allow_multiple;
+ gboolean in_use;
+};
+
+struct _PrefsDisplayItemsDialog
+{
+ GtkWidget *window;
+
+ GtkWidget *stock_clist;
+ GtkWidget *shown_clist;
+
+ GtkWidget *add_btn;
+ GtkWidget *remove_btn;
+ GtkWidget *up_btn;
+ GtkWidget *down_btn;
+
+ GtkWidget *default_btn;
+
+ GtkWidget *confirm_area;
+ GtkWidget *ok_btn;
+ GtkWidget *cancel_btn;
+
+ PrefsDisplayItem *available_items;
+ const gint *default_visible_ids;
+ GList *visible_items;
+
+ gboolean finished;
+ gboolean cancelled;
+};
+
+PrefsDisplayItemsDialog *prefs_display_items_dialog_create (void);
+
+void prefs_display_items_dialog_set_available (PrefsDisplayItemsDialog *dialog,
+ PrefsDisplayItem *items);
+void prefs_display_items_dialog_set_default_visible
+ (PrefsDisplayItemsDialog *dialog,
+ const gint *ids);
+void prefs_display_items_dialog_set_visible
+ (PrefsDisplayItemsDialog *dialog,
+ const gint *ids);
+
+void prefs_display_items_dialog_destroy (PrefsDisplayItemsDialog *dialog);
+
+#endif /* __PREFS_DISPLAY_ITEMS_H__ */
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
new file mode 100644
index 00000000..d3431eb6
--- /dev/null
+++ b/src/prefs_toolbar.c
@@ -0,0 +1,213 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2007 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "prefs_toolbar.h"
+#include "prefs_display_items.h"
+
+static PrefsDisplayItem available_items[] =
+{
+ {T_SEPARATOR, "separator", N_("Separator"), TRUE, FALSE},
+ {T_GET, "get", N_("Get"), FALSE, FALSE},
+ {T_GET_ALL, "get-all", N_("Get all"), FALSE, FALSE},
+ {T_SEND_QUEUE, "send-queue", N_("Send"), FALSE, FALSE},
+ {T_COMPOSE, "compose", N_("Compose"), FALSE, FALSE},
+ {T_REPLY, "reply", N_("Reply"), FALSE, FALSE},
+ {T_REPLY_ALL, "reply-all", N_("Reply all"), FALSE, FALSE},
+ {T_FORWARD, "forward", N_("Forward"), FALSE, FALSE},
+ {T_DELETE, "delete", N_("Delete"), FALSE, FALSE},
+ {T_JUNK, "junk", N_("Junk"), FALSE, FALSE},
+ {T_EXECUTE, "execute", N_("Execute"), FALSE, FALSE},
+ {T_NEXT, "next", N_("Next"), FALSE, FALSE},
+ {-1, NULL, NULL, FALSE, FALSE}
+};
+
+static gint default_items[] =
+{
+ T_GET,
+ T_GET_ALL,
+ T_SEPARATOR,
+ T_SEND_QUEUE,
+ T_SEPARATOR,
+ T_COMPOSE,
+ T_REPLY,
+ T_REPLY_ALL,
+ T_FORWARD,
+ T_SEPARATOR,
+ T_DELETE,
+ T_JUNK,
+ T_SEPARATOR,
+ T_NEXT,
+ -1
+};
+
+gint prefs_toolbar_open(gint *visible_items, GList **item_list)
+{
+ PrefsDisplayItemsDialog *dialog;
+ GList *list;
+ gint ret = 0;
+
+ dialog = prefs_display_items_dialog_create();
+ prefs_display_items_dialog_set_available(dialog, available_items);
+ prefs_display_items_dialog_set_default_visible(dialog, default_items);
+ prefs_display_items_dialog_set_visible(dialog, visible_items);
+
+ while (dialog->finished == FALSE)
+ gtk_main_iteration();
+
+ if (dialog->cancelled) {
+ ret = -1;
+ *item_list = NULL;
+ } else {
+ list = dialog->visible_items;
+ dialog->visible_items = NULL;
+ *item_list = list;
+ }
+
+ prefs_display_items_dialog_destroy(dialog);
+
+ return ret;
+}
+
+const PrefsDisplayItem *prefs_toolbar_get_item_from_name(const gchar *name)
+{
+ gint i;
+
+ for (i = 0; available_items[i].id != -1; i++) {
+ if (!strcmp(name, available_items[i].name))
+ return &available_items[i];
+ }
+
+ return NULL;
+}
+
+const PrefsDisplayItem *prefs_toolbar_get_item_from_id(gint id)
+{
+ gint i;
+
+ for (i = 0; available_items[i].id != -1; i++) {
+ if (id == available_items[i].id)
+ return &available_items[i];
+ }
+
+ return NULL;
+}
+
+GList *prefs_toolbar_get_item_list_from_name_list(const gchar *name_list)
+{
+ gint i;
+ gchar **array;
+ GList *list = NULL;
+
+ array = g_strsplit(name_list, ",", 0);
+
+ for (i = 0; array[i] != NULL; i++) {
+ gchar *name = array[i];
+ const PrefsDisplayItem *item;
+
+ g_strstrip(name);
+ item = prefs_toolbar_get_item_from_name(name);
+ if (item)
+ list = g_list_append(list, (gpointer)item);
+ }
+
+ g_strfreev(array);
+
+ return list;
+}
+
+gint *prefs_toolbar_get_id_list_from_name_list(const gchar *name_list)
+{
+ gint i;
+ gchar **array;
+ GArray *iarray;
+
+ iarray = g_array_new(FALSE, FALSE, sizeof(gint));
+ array = g_strsplit(name_list, ",", 0);
+
+ for (i = 0; array[i] != NULL; i++) {
+ gchar *name = array[i];
+ const PrefsDisplayItem *item;
+
+ g_strstrip(name);
+ item = prefs_toolbar_get_item_from_name(name);
+ if (item)
+ g_array_append_val(iarray, item->id);
+ }
+
+ i = -1;
+ g_array_append_val(iarray, i);
+
+ g_strfreev(array);
+
+ return (gint *)g_array_free(iarray, FALSE);
+}
+
+gchar *prefs_toolbar_get_name_list_from_item_list(GList *item_list)
+{
+ GString *str;
+ GList *cur;
+
+ str = g_string_new(NULL);
+
+ for (cur = item_list; cur != NULL; cur = cur->next) {
+ const PrefsDisplayItem *item = cur->data;
+
+ g_string_append(str, item->name);
+ if (cur->next)
+ g_string_append_c(str, ',');
+ }
+
+ return g_string_free(str, FALSE);
+}
+
+const gchar *prefs_toolbar_get_default_setting_name_list(void)
+{
+ GString *str;
+ gint i;
+ static gchar *default_name_list = NULL;
+
+ if (default_name_list)
+ return default_name_list;
+
+ str = g_string_new(NULL);
+
+ for (i = 0; default_items[i] != -1; i++) {
+ const PrefsDisplayItem *item;
+
+ item = prefs_toolbar_get_item_from_id(default_items[i]);
+ if (item) {
+ g_string_append(str, item->name);
+ if (default_items[i + 1] != -1)
+ g_string_append_c(str, ',');
+ }
+ }
+
+ default_name_list = g_string_free(str, FALSE);
+
+ return default_name_list;
+}
diff --git a/src/prefs_toolbar.h b/src/prefs_toolbar.h
new file mode 100644
index 00000000..adf6416d
--- /dev/null
+++ b/src/prefs_toolbar.h
@@ -0,0 +1,72 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2007 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 __PREFS_TOOLBAR_H__
+#define __PREFS_TOOLBAR_H__
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+typedef struct _PrefsToolbarItem PrefsToolbarItem;
+
+#include "prefs_display_items.h"
+#include "stock_pixmap.h"
+
+typedef enum
+{
+ T_SEPARATOR,
+ T_GET,
+ T_GET_ALL,
+ T_SEND_QUEUE,
+ T_COMPOSE,
+ T_REPLY,
+ T_REPLY_ALL,
+ T_FORWARD,
+ T_DELETE,
+ T_JUNK,
+ T_EXECUTE,
+ T_NEXT
+} ToolbarItems;
+
+struct _PrefsToolbarItem
+{
+ gint id;
+ gchar *tooltip;
+ StockPixmap icon;
+ void (*callback) (GtkWidget *widget, gpointer data);
+ gpointer data;
+};
+
+gint prefs_toolbar_open (gint *visible_items,
+ GList **item_list);
+
+const PrefsDisplayItem *prefs_toolbar_get_item_from_name
+ (const gchar *name);
+const PrefsDisplayItem *prefs_toolbar_get_item_from_id (gint id);
+
+GList *prefs_toolbar_get_item_list_from_name_list
+ (const gchar *name_list);
+gint *prefs_toolbar_get_id_list_from_name_list
+ (const gchar *name_list);
+
+gchar *prefs_toolbar_get_name_list_from_item_list (GList *item_list);
+
+const gchar *prefs_toolbar_get_default_setting_name_list(void);
+
+#endif /* __PREFS_TOOLBAR_H__ */