aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.ja10
-rw-r--r--src/compose.c281
-rw-r--r--src/mainwindow.c6
-rw-r--r--src/prefs_display_items.c53
-rw-r--r--src/prefs_display_items.h9
-rw-r--r--src/prefs_summary_column.c3
-rw-r--r--src/prefs_toolbar.c134
-rw-r--r--src/prefs_toolbar.h29
9 files changed, 386 insertions, 149 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ce19185..9d020ca7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-01-26
+
+ * src/compose.c
+ src/prefs_toolbar.[ch]
+ src/mainwindow.c
+ src/prefs_display_items.[ch]: implemented the toolbar customization
+ of the composition window.
+ * src/prefs_summary_column.c: prefs_summary_column_add(): add items
+ before focused row.
+
2007-01-25
* src/prefs_display_items.[ch]
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 4d402516..ae4e4d28 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,13 @@
+2007-01-26
+
+ * src/compose.c
+ src/prefs_toolbar.[ch]
+ src/mainwindow.c
+ src/prefs_display_items.[ch]: メッセージ作成ウィンドウのツールバー
+ のカスタマイズを実装。
+ * src/prefs_summary_column.c: prefs_summary_column_add(): フォーカス
+ 行の前に項目を追加するようにした。
+
2007-01-25
* src/prefs_display_items.[ch]
diff --git a/src/compose.c b/src/compose.c
index ce419b2e..10563f1c 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * 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
@@ -99,6 +99,7 @@
#include "customheader.h"
#include "prefs_common.h"
#include "prefs_account.h"
+#include "prefs_toolbar.h"
#include "action.h"
#include "account.h"
#include "filesel.h"
@@ -170,6 +171,9 @@ static gboolean compose_window_exist (gint x,
gint y);
static void compose_connect_changed_callbacks (Compose *compose);
static GtkWidget *compose_toolbar_create (Compose *compose);
+static GtkWidget *compose_toolbar_create_from_list
+ (Compose *compose,
+ GList *item_list);
static GtkWidget *compose_account_option_menu_create
(Compose *compose,
GtkWidget *hbox);
@@ -335,6 +339,10 @@ static void toolbar_linewrap_cb (GtkWidget *widget,
static void toolbar_address_cb (GtkWidget *widget,
gpointer data);
+static gboolean toolbar_button_pressed (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer data);
+
static void account_activated (GtkMenuItem *menuitem,
gpointer data);
@@ -441,12 +449,16 @@ static void compose_toggle_replyto_cb (gpointer data,
static void compose_toggle_followupto_cb(gpointer data,
guint action,
GtkWidget *widget);
+static void compose_toggle_ruler_cb (gpointer data,
+ guint action,
+ GtkWidget *widget);
static void compose_toggle_attach_cb (gpointer data,
guint action,
GtkWidget *widget);
-static void compose_toggle_ruler_cb (gpointer data,
+static void compose_customize_toolbar_cb(gpointer data,
guint action,
GtkWidget *widget);
+
#if USE_GPGME
static void compose_toggle_sign_cb (gpointer data,
guint action,
@@ -563,6 +575,9 @@ static GtkItemFactoryEntry compose_entries[] =
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_View/_Attachment"), NULL, compose_toggle_attach_cb, 0, "<ToggleItem>"},
{N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
+ {N_("/_View/Cu_stomize toolbar..."),
+ NULL, compose_customize_toolbar_cb, 0, "<ToggleItem>"},
+ {N_("/_View/---"), NULL, NULL, 0, "<Separator>"},
#define ENC_ACTION(action) \
NULL, compose_set_encoding_cb, action, \
@@ -4838,19 +4853,57 @@ static void compose_connect_changed_callbacks(Compose *compose)
G_CALLBACK(compose_changed_cb), compose);
}
+static PrefsToolbarItem items[] =
+{
+ {T_SEND, N_("Send message"),
+ STOCK_PIXMAP_MAIL_SEND, toolbar_send_cb},
+ {T_SEND_LATER, N_("Put into queue folder and send later"),
+ STOCK_PIXMAP_MAIL_SEND_QUEUE, toolbar_send_later_cb},
+ {T_DRAFT, N_("Save to draft folder"),
+ STOCK_PIXMAP_MAIL, toolbar_draft_cb},
+ {T_INSERT_FILE, N_("Insert file"),
+ STOCK_PIXMAP_INSERT_FILE, toolbar_insert_cb},
+ {T_ATTACH_FILE, N_("Attach file"),
+ STOCK_PIXMAP_MAIL_ATTACH, toolbar_attach_cb},
+ {T_SIGNATURE, N_("Append signature"),
+ STOCK_PIXMAP_SIGN, toolbar_sig_cb},
+ {T_EDITOR, N_("Edit with external editor"),
+ STOCK_PIXMAP_MAIL_COMPOSE, toolbar_ext_editor_cb},
+ {T_LINEWRAP, N_("Wrap all long lines"),
+ STOCK_PIXMAP_LINEWRAP, toolbar_linewrap_cb},
+ {T_ADDRESS_BOOK, N_("Address book"),
+ STOCK_PIXMAP_ADDRESS_BOOK, toolbar_address_cb},
+
+ {-1, NULL, -1, NULL}
+};
+
static GtkWidget *compose_toolbar_create(Compose *compose)
{
GtkWidget *toolbar;
+ const gchar *setting;
+ GList *item_list;
+
+ if (prefs_common.compose_toolbar_setting &&
+ *prefs_common.compose_toolbar_setting != '\0')
+ setting = prefs_common.compose_toolbar_setting;
+ else
+ setting = prefs_toolbar_get_default_compose_setting_name_list();
+
+ item_list = prefs_toolbar_get_item_list_from_name_list(setting);
+ toolbar = compose_toolbar_create_from_list(compose, item_list);
+ g_list_free(item_list);
+
+ return toolbar;
+}
+
+static GtkWidget *compose_toolbar_create_from_list(Compose *compose,
+ GList *item_list)
+{
+ GtkWidget *toolbar;
GtkWidget *icon_wid;
- GtkWidget *send_btn;
- GtkWidget *sendl_btn;
- GtkWidget *draft_btn;
- GtkWidget *insert_btn;
- GtkWidget *attach_btn;
- GtkWidget *sig_btn;
- GtkWidget *exteditor_btn;
- GtkWidget *linewrap_btn;
- GtkWidget *addrbook_btn;
+ GtkWidget *button;
+ gint i;
+ GList *cur;
toolbar = gtk_toolbar_new();
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar),
@@ -4858,104 +4911,51 @@ static GtkWidget *compose_toolbar_create(Compose *compose)
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), compose);
+
+ items[0].data = &compose->send_btn;
+ items[1].data = &compose->sendl_btn;
+ items[2].data = &compose->draft_btn;
+ items[3].data = &compose->insert_btn;
+ items[4].data = &compose->attach_btn;
+ items[5].data = &compose->sig_btn;
+ items[6].data = &compose->exteditor_btn;
+ items[7].data = &compose->linewrap_btn;
+ items[8].data = &compose->addrbook_btn;
+ for (i = 0; i <= 8; i++)
+ *(GtkWidget **)items[i].data = NULL;
+
+ for (cur = item_list; cur != NULL; cur = cur->next) {
+ const PrefsDisplayItem *ditem = cur->data;
+ PrefsToolbarItem *item;
+
+ if (ditem->id == T_SEPARATOR) {
+ gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
+ continue;
+ }
+
+ for (item = items; item->id != -1; item++) {
+ if (ditem->id == item->id)
+ break;
+ }
+ if (item->id == -1)
+ continue;
+
+ icon_wid = stock_pixbuf_widget(NULL, item->icon);
+
+ button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
+ gettext(ditem->label),
+ gettext(item->tooltip),
+ ditem->name, icon_wid,
+ G_CALLBACK(item->callback),
+ compose);
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_MAIL_SEND);
- send_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Send"),
- _("Send message"),
- "Send",
- icon_wid,
- G_CALLBACK(toolbar_send_cb),
- compose);
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_MAIL_SEND_QUEUE);
- sendl_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Send later"),
- _("Put into queue folder and send later"),
- "Send later",
- icon_wid,
- G_CALLBACK(toolbar_send_later_cb),
- compose);
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_MAIL);
- draft_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Draft"),
- _("Save to draft folder"),
- "Draft",
- icon_wid,
- G_CALLBACK(toolbar_draft_cb),
- compose);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_INSERT_FILE);
- insert_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Insert"),
- _("Insert file"),
- "Insert",
- icon_wid,
- G_CALLBACK(toolbar_insert_cb),
- compose);
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_MAIL_ATTACH);
- attach_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Attach"),
- _("Attach file"),
- "Attach",
- icon_wid,
- G_CALLBACK(toolbar_attach_cb),
- compose);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_SIGN);
- sig_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Signature"),
- _("Append signature"),
- "Signature",
- icon_wid,
- G_CALLBACK(toolbar_sig_cb), compose);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_MAIL_COMPOSE);
- exteditor_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Editor"),
- _("Edit with external editor"),
- "Editor",
- icon_wid,
- G_CALLBACK(toolbar_ext_editor_cb),
- compose);
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_LINEWRAP);
- linewrap_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Linewrap"),
- _("Wrap all long lines"),
- "Linewrap",
- icon_wid,
- G_CALLBACK(toolbar_linewrap_cb),
- compose);
-
- gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
-
- icon_wid = stock_pixbuf_widget(NULL, STOCK_PIXMAP_ADDRESS_BOOK);
- addrbook_btn = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
- _("Address"),
- _("Address book"),
- "Address",
- icon_wid,
- G_CALLBACK(toolbar_address_cb),
- compose);
-
- compose->send_btn = send_btn;
- compose->sendl_btn = sendl_btn;
- compose->draft_btn = draft_btn;
- compose->insert_btn = insert_btn;
- compose->attach_btn = attach_btn;
- compose->sig_btn = sig_btn;
- compose->exteditor_btn = exteditor_btn;
- compose->linewrap_btn = linewrap_btn;
- compose->addrbook_btn = addrbook_btn;
+ g_signal_connect(G_OBJECT(button), "button_press_event",
+ G_CALLBACK(toolbar_button_pressed), compose);
+
+ *(GtkWidget **)item->data = button;
+ }
gtk_widget_show_all(toolbar);
@@ -5951,6 +5951,65 @@ static void toolbar_address_cb(GtkWidget *widget, gpointer data)
compose_address_cb(data, 0, NULL);
}
+static void toolbar_customize(GtkWidget *widget, gpointer data)
+{
+ Compose *compose = (Compose *)data;
+ gint *visible_items;
+ GList *item_list = NULL;
+ GtkWidget *toolbar;
+ gint ret;
+ const gchar *setting;
+
+ if (prefs_common.compose_toolbar_setting &&
+ *prefs_common.compose_toolbar_setting != '\0')
+ setting = prefs_common.compose_toolbar_setting;
+ else
+ setting = prefs_toolbar_get_default_compose_setting_name_list();
+ visible_items = prefs_toolbar_get_id_list_from_name_list(setting);
+ ret = prefs_toolbar_open(TOOLBAR_COMPOSE, visible_items, &item_list);
+ g_free(visible_items);
+
+ if (ret == 0) {
+ gtk_widget_destroy(compose->toolbar);
+ toolbar = compose_toolbar_create_from_list(compose, item_list);
+ gtk_widget_set_size_request(toolbar, 300, -1);
+ gtk_box_pack_start(GTK_BOX(compose->vbox), toolbar,
+ FALSE, FALSE, 0);
+ gtk_box_reorder_child(GTK_BOX(compose->vbox), toolbar, 1);
+ compose->toolbar = toolbar;
+ g_free(prefs_common.compose_toolbar_setting);
+ prefs_common.compose_toolbar_setting =
+ prefs_toolbar_get_name_list_from_item_list(item_list);
+ g_list_free(item_list);
+ }
+}
+
+static gboolean toolbar_button_pressed(GtkWidget *widget, GdkEventButton *event,
+ gpointer data)
+{
+ Compose *compose = (Compose *)data;
+ GtkWidget *menu;
+ GtkWidget *menuitem;
+
+ if (!event) return FALSE;
+ if (event->button != 3) return FALSE;
+
+ menu = gtk_menu_new();
+ gtk_widget_show(menu);
+
+ MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, _("_Customize toolbar..."),
+ 0);
+ g_signal_connect(G_OBJECT(menuitem), "activate",
+ G_CALLBACK(toolbar_customize), compose);
+ 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;
+}
+
static void account_activated(GtkMenuItem *menuitem, gpointer data)
{
Compose *compose = (Compose *)data;
@@ -6646,6 +6705,12 @@ static void compose_toggle_attach_cb(gpointer data, guint action,
#endif
}
+static void compose_customize_toolbar_cb(gpointer data, guint action,
+ GtkWidget *widget)
+{
+ toolbar_customize(widget, data);
+}
+
#if USE_GPGME
static void compose_toggle_sign_cb(gpointer data, guint action,
GtkWidget *widget)
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 3542dd9f..92ac3054 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -2371,7 +2371,7 @@ static GtkWidget *main_window_toolbar_create(MainWindow *mainwin)
*prefs_common.main_toolbar_setting != '\0')
setting = prefs_common.main_toolbar_setting;
else
- setting = prefs_toolbar_get_default_setting_name_list();
+ setting = prefs_toolbar_get_default_main_setting_name_list();
item_list = prefs_toolbar_get_item_list_from_name_list(setting);
toolbar = main_window_toolbar_create_from_list(mainwin, item_list);
@@ -2595,9 +2595,9 @@ static void toolbar_customize(GtkWidget *widget, gpointer data)
*prefs_common.main_toolbar_setting != '\0')
setting = prefs_common.main_toolbar_setting;
else
- setting = prefs_toolbar_get_default_setting_name_list();
+ setting = prefs_toolbar_get_default_main_setting_name_list();
visible_items = prefs_toolbar_get_id_list_from_name_list(setting);
- ret = prefs_toolbar_open(visible_items, &item_list);
+ ret = prefs_toolbar_open(TOOLBAR_MAIN, visible_items, &item_list);
g_free(visible_items);
if (ret == 0) {
diff --git a/src/prefs_display_items.c b/src/prefs_display_items.c
index 00295279..39a056b7 100644
--- a/src/prefs_display_items.c
+++ b/src/prefs_display_items.c
@@ -281,6 +281,8 @@ void prefs_display_items_dialog_destroy(PrefsDisplayItemsDialog *dialog)
if (!dialog)
return;
+ if (dialog->available_items)
+ g_list_free(dialog->available_items);
if (dialog->visible_items)
g_list_free(dialog->visible_items);
gtk_widget_destroy(dialog->window);
@@ -291,32 +293,54 @@ static void prefs_display_items_update_available
(PrefsDisplayItemsDialog *dialog)
{
GtkCList *stock_clist = GTK_CLIST(dialog->stock_clist);
- gint i;
+ GList *cur;
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;
+ for (cur = dialog->available_items; cur != NULL; cur = cur->next) {
+ PrefsDisplayItem *item = cur->data;
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);
}
}
+}
+
+static PrefsDisplayItem *prefs_display_items_get_item_from_id
+ (PrefsDisplayItemsDialog *dialog, gint id)
+{
+ gint i;
+
+ for (i = 0; dialog->all_items[i].id != -1; i++) {
+ if (id == dialog->all_items[i].id)
+ return (PrefsDisplayItem *)&dialog->all_items[i];
+ }
+ return NULL;
}
void prefs_display_items_dialog_set_available(PrefsDisplayItemsDialog *dialog,
- PrefsDisplayItem *items)
+ PrefsDisplayItem *all_items,
+ const gint *ids)
{
- dialog->available_items = items;
+ gint i;
+ GList *list = NULL;
+
+ dialog->all_items = all_items;
+ for (i = 0; ids[i] != -1; i++) {
+ PrefsDisplayItem *item;
+
+ item = prefs_display_items_get_item_from_id(dialog, ids[i]);
+ if (item)
+ list = g_list_append(list, item);
+ }
+ dialog->available_items = list;
prefs_display_items_update_available(dialog);
}
@@ -331,6 +355,8 @@ void prefs_display_items_dialog_set_visible(PrefsDisplayItemsDialog *dialog,
const gint *ids)
{
GtkCList *shown_clist = GTK_CLIST(dialog->shown_clist);
+ GList *cur;
+ PrefsDisplayItem *item;
gint i;
g_return_if_fail(dialog->available_items != NULL);
@@ -346,19 +372,19 @@ void prefs_display_items_dialog_set_visible(PrefsDisplayItemsDialog *dialog,
dialog->visible_items = NULL;
}
- for (i = 0; dialog->available_items[i].name != NULL; i++) {
- dialog->available_items[i].in_use = FALSE;
+ for (cur = dialog->available_items; cur != NULL; cur = cur->next) {
+ item = cur->data;
+ item->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];
+ item = prefs_display_items_get_item_from_id(dialog, id);
- g_return_if_fail(id == item->id);
+ g_return_if_fail(item != NULL);
g_return_if_fail(item->allow_multiple || item->in_use == FALSE);
item->in_use = TRUE;
@@ -393,14 +419,13 @@ static void prefs_display_items_add(GtkWidget *widget, gpointer data)
if (!shown_clist->selection)
row = 0;
else
- row = GPOINTER_TO_INT(shown_clist->selection->data) + 1;
+ row = GPOINTER_TO_INT(shown_clist->selection->data);
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)
diff --git a/src/prefs_display_items.h b/src/prefs_display_items.h
index 6e239f1a..352df414 100644
--- a/src/prefs_display_items.h
+++ b/src/prefs_display_items.h
@@ -53,7 +53,8 @@ struct _PrefsDisplayItemsDialog
GtkWidget *ok_btn;
GtkWidget *cancel_btn;
- PrefsDisplayItem *available_items;
+ const PrefsDisplayItem *all_items;
+ GList *available_items;
const gint *default_visible_ids;
GList *visible_items;
@@ -63,8 +64,10 @@ struct _PrefsDisplayItemsDialog
PrefsDisplayItemsDialog *prefs_display_items_dialog_create (void);
-void prefs_display_items_dialog_set_available (PrefsDisplayItemsDialog *dialog,
- PrefsDisplayItem *items);
+void prefs_display_items_dialog_set_available
+ (PrefsDisplayItemsDialog *dialog,
+ PrefsDisplayItem *all_items,
+ const gint *ids);
void prefs_display_items_dialog_set_default_visible
(PrefsDisplayItemsDialog *dialog,
const gint *ids);
diff --git a/src/prefs_summary_column.c b/src/prefs_summary_column.c
index 46ae20c8..080cae36 100644
--- a/src/prefs_summary_column.c
+++ b/src/prefs_summary_column.c
@@ -450,12 +450,11 @@ static void prefs_summary_column_add(void)
if (!shown_clist->selection)
row = 0;
else
- row = GPOINTER_TO_INT(shown_clist->selection->data) + 1;
+ row = GPOINTER_TO_INT(shown_clist->selection->data);
name = gettext(col_name[type]);
row = gtk_clist_insert(shown_clist, row, (gchar **)&name);
gtk_clist_set_row_data(shown_clist, row, GINT_TO_POINTER(type));
- gtk_clist_select_row(shown_clist, row, -1);
}
static void prefs_summary_column_remove(void)
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
index d3431eb6..cb8c16b6 100644
--- a/src/prefs_toolbar.c
+++ b/src/prefs_toolbar.c
@@ -29,7 +29,7 @@
#include "prefs_toolbar.h"
#include "prefs_display_items.h"
-static PrefsDisplayItem available_items[] =
+static PrefsDisplayItem all_items[] =
{
{T_SEPARATOR, "separator", N_("Separator"), TRUE, FALSE},
{T_GET, "get", N_("Get"), FALSE, FALSE},
@@ -43,10 +43,53 @@ static PrefsDisplayItem available_items[] =
{T_JUNK, "junk", N_("Junk"), FALSE, FALSE},
{T_EXECUTE, "execute", N_("Execute"), FALSE, FALSE},
{T_NEXT, "next", N_("Next"), FALSE, FALSE},
+
+ {T_SEND, "send", N_("Send"), FALSE, FALSE},
+ {T_SEND_LATER, "send-later", N_("Send later"), FALSE, FALSE},
+ {T_DRAFT, "draft", N_("Draft"), FALSE, FALSE},
+ {T_INSERT_FILE, "insert-file", N_("Insert"), FALSE, FALSE},
+ {T_ATTACH_FILE, "attach-file", N_("Attach"), FALSE, FALSE},
+ {T_SIGNATURE, "signature", N_("Signature"), FALSE, FALSE},
+ {T_EDITOR, "editor", N_("Editor"), FALSE, FALSE},
+ {T_LINEWRAP, "linewrap", N_("Linewrap"), FALSE, FALSE},
+ {T_ADDRESS_BOOK,"address-book", N_("Address"), FALSE, FALSE},
+
{-1, NULL, NULL, FALSE, FALSE}
};
-static gint default_items[] =
+static gint main_available_items[] =
+{
+ 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,
+ -1
+};
+
+static gint compose_available_items[] =
+{
+ T_SEPARATOR,
+ T_SEND,
+ T_SEND_LATER,
+ T_DRAFT,
+ T_INSERT_FILE,
+ T_ATTACH_FILE,
+ T_SIGNATURE,
+ T_EDITOR,
+ T_LINEWRAP,
+ T_ADDRESS_BOOK,
+ -1
+};
+
+static gint default_main_items[] =
{
T_GET,
T_GET_ALL,
@@ -65,15 +108,49 @@ static gint default_items[] =
-1
};
-gint prefs_toolbar_open(gint *visible_items, GList **item_list)
+static gint default_compose_items[] =
+{
+ T_SEND,
+ T_SEND_LATER,
+ T_DRAFT,
+ T_SEPARATOR,
+ T_INSERT_FILE,
+ T_ATTACH_FILE,
+ T_SEPARATOR,
+ T_SIGNATURE,
+ T_SEPARATOR,
+ T_EDITOR,
+ T_LINEWRAP,
+ T_SEPARATOR,
+ T_ADDRESS_BOOK,
+ -1
+};
+
+gint prefs_toolbar_open(ToolbarType type, 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);
+
+ switch (type) {
+ case TOOLBAR_MAIN:
+ prefs_display_items_dialog_set_available
+ (dialog, all_items, main_available_items);
+ prefs_display_items_dialog_set_default_visible
+ (dialog, default_main_items);
+ break;
+ case TOOLBAR_COMPOSE:
+ default:
+ prefs_display_items_dialog_set_available
+ (dialog, all_items, compose_available_items);
+ prefs_display_items_dialog_set_default_visible
+ (dialog, default_compose_items);
+ break;
+ }
+
prefs_display_items_dialog_set_visible(dialog, visible_items);
while (dialog->finished == FALSE)
@@ -97,9 +174,9 @@ 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];
+ for (i = 0; all_items[i].id != -1; i++) {
+ if (!strcmp(name, all_items[i].name))
+ return &all_items[i];
}
return NULL;
@@ -109,9 +186,9 @@ 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];
+ for (i = 0; all_items[i].id != -1; i++) {
+ if (id == all_items[i].id)
+ return &all_items[i];
}
return NULL;
@@ -185,7 +262,34 @@ gchar *prefs_toolbar_get_name_list_from_item_list(GList *item_list)
return g_string_free(str, FALSE);
}
-const gchar *prefs_toolbar_get_default_setting_name_list(void)
+const gchar *prefs_toolbar_get_default_main_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_main_items[i] != -1; i++) {
+ const PrefsDisplayItem *item;
+
+ item = prefs_toolbar_get_item_from_id(default_main_items[i]);
+ if (item) {
+ g_string_append(str, item->name);
+ if (default_main_items[i + 1] != -1)
+ g_string_append_c(str, ',');
+ }
+ }
+
+ default_name_list = g_string_free(str, FALSE);
+
+ return default_name_list;
+}
+
+const gchar *prefs_toolbar_get_default_compose_setting_name_list(void)
{
GString *str;
gint i;
@@ -196,13 +300,13 @@ const gchar *prefs_toolbar_get_default_setting_name_list(void)
str = g_string_new(NULL);
- for (i = 0; default_items[i] != -1; i++) {
+ for (i = 0; default_compose_items[i] != -1; i++) {
const PrefsDisplayItem *item;
- item = prefs_toolbar_get_item_from_id(default_items[i]);
+ item = prefs_toolbar_get_item_from_id(default_compose_items[i]);
if (item) {
g_string_append(str, item->name);
- if (default_items[i + 1] != -1)
+ if (default_compose_items[i + 1] != -1)
g_string_append_c(str, ',');
}
}
diff --git a/src/prefs_toolbar.h b/src/prefs_toolbar.h
index adf6416d..e89bb497 100644
--- a/src/prefs_toolbar.h
+++ b/src/prefs_toolbar.h
@@ -30,7 +30,15 @@ typedef struct _PrefsToolbarItem PrefsToolbarItem;
typedef enum
{
+ TOOLBAR_MAIN,
+ TOOLBAR_COMPOSE
+} ToolbarType;
+
+typedef enum
+{
T_SEPARATOR,
+
+ /* Main */
T_GET,
T_GET_ALL,
T_SEND_QUEUE,
@@ -41,7 +49,18 @@ typedef enum
T_DELETE,
T_JUNK,
T_EXECUTE,
- T_NEXT
+ T_NEXT,
+
+ /* Compose */
+ T_SEND,
+ T_SEND_LATER,
+ T_DRAFT,
+ T_INSERT_FILE,
+ T_ATTACH_FILE,
+ T_SIGNATURE,
+ T_EDITOR,
+ T_LINEWRAP,
+ T_ADDRESS_BOOK
} ToolbarItems;
struct _PrefsToolbarItem
@@ -53,8 +72,9 @@ struct _PrefsToolbarItem
gpointer data;
};
-gint prefs_toolbar_open (gint *visible_items,
- GList **item_list);
+gint prefs_toolbar_open (ToolbarType type,
+ gint *visible_items,
+ GList **item_list);
const PrefsDisplayItem *prefs_toolbar_get_item_from_name
(const gchar *name);
@@ -67,6 +87,7 @@ gint *prefs_toolbar_get_id_list_from_name_list
gchar *prefs_toolbar_get_name_list_from_item_list (GList *item_list);
-const gchar *prefs_toolbar_get_default_setting_name_list(void);
+const gchar *prefs_toolbar_get_default_main_setting_name_list (void);
+const gchar *prefs_toolbar_get_default_compose_setting_name_list(void);
#endif /* __PREFS_TOOLBAR_H__ */