/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001 Hiroyuki Yamamoto
+ * Copyright (C) 2001-2003 Hiroyuki Yamamoto and the Sylpheed-Claws team
*
* 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
#include "defs.h"
#include <glib.h>
+#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <math.h>
#include <setjmp.h>
-#include "intl.h"
#include "mainwindow.h"
+#include "summaryview.h"
#include "compose.h"
#include "utils.h"
#include "xml.h"
#include "toolbar.h"
#include "menu.h"
#include "inc.h"
+#include "action.h"
#include "prefs_actions.h"
#include "prefs_common.h"
#include "prefs_toolbar.h"
guint action,
gpointer data);
-static GtkWidget *get_window_widget (ToolbarType type,
- gpointer data);
static MainWindow *get_mainwin (gpointer data);
static void activate_compose_button (Toolbar *toolbar,
ToolbarStyle style,
ComposeButtonType type);
/* toolbar callbacks */
+static void toolbar_reply (gpointer data,
+ guint action);
static void toolbar_delete_cb (GtkWidget *widget,
gpointer data);
static void toolbar_next_unread_cb (GtkWidget *widget,
gpointer data);
+static void toolbar_ignore_thread_cb (GtkWidget *widget,
+ gpointer data);
+
+static void toolbar_print_cb (GtkWidget *widget,
+ gpointer data);
+
static void toolbar_actions_execute_cb (GtkWidget *widget,
gpointer data);
gpointer data);
static void toolbar_ext_editor_cb (GtkWidget *widget,
gpointer data);
-static void toolbar_linewrap_cb (GtkWidget *widget,
+static void toolbar_linewrap_current_cb (GtkWidget *widget,
+ gpointer data);
+static void toolbar_linewrap_all_cb (GtkWidget *widget,
gpointer data);
static void toolbar_addrbook_cb (GtkWidget *widget,
gpointer data);
+#ifdef USE_ASPELL
+static void toolbar_check_spelling_cb (GtkWidget *widget,
+ gpointer data);
+#endif
-static void toolbar_popup_cb (gpointer data,
- guint action,
- GtkWidget *widget);
struct {
gchar *index_str;
const gchar *descr;
} toolbar_text [] = {
- { "A_RECEIVE_ALL", N_("Receive Mail on all Accounts") },
- { "A_RECEIVE_CUR", N_("Receive Mail on current Account") },
- { "A_SEND_QUEUED", N_("Send Queued Message(s)") },
- { "A_COMPOSE_EMAIL", N_("Compose Email") },
- { "A_COMPOSE_NEWS", N_("Compose News") },
- { "A_REPLY_MESSAGE", N_("Reply to Message") },
- { "A_REPLY_SENDER", N_("Reply to Sender") },
- { "A_REPLY_ALL", N_("Reply to All") },
- { "A_REPLY_ML", N_("Reply to Mailing-list") },
- { "A_FORWARD", N_("Forward Message") },
- { "A_DELETE", N_("Delete Message") },
- { "A_EXECUTE", N_("Execute") },
- { "A_GOTO_NEXT", N_("Goto Next Message") },
-
- { "A_SEND", N_("Send Message") },
- { "A_SENDL", N_("Put into queue folder and send later") },
- { "A_DRAFT", N_("Save to draft folder") },
- { "A_INSERT", N_("Insert file") },
- { "A_ATTACH", N_("Attach file") },
- { "A_SIG", N_("Insert signature") },
- { "A_EXTEDITOR", N_("Edit with external editor") },
- { "A_LINEWRAP", N_("Wrap all long lines") },
- { "A_ADDRBOOK", N_("Address book") },
-
- { "A_SYL_ACTIONS", N_("Sylpheed Actions Feature") },
- { "A_SEPARATOR", N_("Separator") }
+ { "A_RECEIVE_ALL", N_("Receive Mail on all Accounts") },
+ { "A_RECEIVE_CUR", N_("Receive Mail on current Account") },
+ { "A_SEND_QUEUED", N_("Send Queued Messages") },
+ { "A_COMPOSE_EMAIL", N_("Compose Email") },
+ { "A_COMPOSE_NEWS", N_("Compose News") },
+ { "A_REPLY_MESSAGE", N_("Reply to Message") },
+ { "A_REPLY_SENDER", N_("Reply to Sender") },
+ { "A_REPLY_ALL", N_("Reply to All") },
+ { "A_REPLY_ML", N_("Reply to Mailing-list") },
+ { "A_FORWARD", N_("Forward Message") },
+ { "A_DELETE", N_("Delete Message") },
+ { "A_EXECUTE", N_("Execute") },
+ { "A_GOTO_NEXT", N_("Goto Next Message") },
+ { "A_IGNORE_THREAD", N_("Ignore thread") },
+ { "A_PRINT", N_("Print") },
+
+ { "A_SEND", N_("Send Message") },
+ { "A_SENDL", N_("Put into queue folder and send later") },
+ { "A_DRAFT", N_("Save to draft folder") },
+ { "A_INSERT", N_("Insert file") },
+ { "A_ATTACH", N_("Attach file") },
+ { "A_SIG", N_("Insert signature") },
+ { "A_EXTEDITOR", N_("Edit with external editor") },
+ { "A_LINEWRAP_CURRENT", N_("Wrap long lines of current paragraph") },
+ { "A_LINEWRAP_ALL", N_("Wrap all long lines") },
+ { "A_ADDRBOOK", N_("Address book") },
+#ifdef USE_ASPELL
+ { "A_CHECK_SPELLING", N_("Check spelling") },
+#endif
+ { "A_SYL_ACTIONS", N_("Sylpheed Actions Feature") },
+ { "A_SEPARATOR", "Separator" }
};
/* struct holds configuration files and a list of
{ "toolbar_msgview.xml", NULL}
};
-static GtkItemFactoryEntry reply_popup_entries[] =
+static GtkItemFactoryEntry reply_entries[] =
{
- {N_("/Reply with _quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_WITH_QUOTE, NULL},
- {N_("/_Reply without quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
+ {N_("/Reply with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_WITH_QUOTE, NULL},
+ {N_("/_Reply without quote"), NULL, toolbar_reply, COMPOSE_REPLY_WITHOUT_QUOTE, NULL}
};
-static GtkItemFactoryEntry replyall_popup_entries[] =
+static GtkItemFactoryEntry replyall_entries[] =
{
- {N_("/Reply to all with _quote"), "<shift>A", toolbar_popup_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
- {N_("/_Reply to all without quote"), "a", toolbar_popup_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
+ {N_("/Reply to all with _quote"), "<shift>A", toolbar_reply, COMPOSE_REPLY_TO_ALL_WITH_QUOTE, NULL},
+ {N_("/_Reply to all without quote"), "a", toolbar_reply, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, NULL}
};
-static GtkItemFactoryEntry replylist_popup_entries[] =
+static GtkItemFactoryEntry replylist_entries[] =
{
- {N_("/Reply to list with _quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_TO_LIST_WITH_QUOTE, NULL},
- {N_("/_Reply to list without quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE, NULL}
+ {N_("/Reply to list with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_LIST_WITH_QUOTE, NULL},
+ {N_("/_Reply to list without quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE, NULL}
};
-static GtkItemFactoryEntry replysender_popup_entries[] =
+static GtkItemFactoryEntry replysender_entries[] =
{
- {N_("/Reply to sender with _quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
- {N_("/_Reply to sender without quote"), NULL, toolbar_popup_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
+ {N_("/Reply to sender with _quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, NULL},
+ {N_("/_Reply to sender without quote"), NULL, toolbar_reply, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, NULL}
};
-static GtkItemFactoryEntry fwd_popup_entries[] =
+static GtkItemFactoryEntry forward_entries[] =
{
- {N_("/_Forward message (inline style)"), "f", toolbar_popup_cb, COMPOSE_FORWARD_INLINE, NULL},
- {N_("/Forward message as _attachment"), "<shift>F", toolbar_popup_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}
+ {N_("/_Forward"), "f", toolbar_reply, COMPOSE_FORWARD_INLINE, NULL},
+ {N_("/For_ward as attachment"), "<shift>F", toolbar_reply, COMPOSE_FORWARD_AS_ATTACH, NULL},
+ {N_("/Redirec_t"), NULL, toolbar_reply, COMPOSE_REDIRECT, NULL}
};
gint i;
for (i = 0; i < N_ACTION_VAL; i++) {
- if (g_strcasecmp(gettext(toolbar_text[i].descr), descr) == 0)
+ if (g_utf8_collate(gettext(toolbar_text[i].descr), descr) == 0)
return i;
}
gint i;
for (i = 0; i < N_ACTION_VAL; i++) {
- if (g_strcasecmp(toolbar_text[i].index_str, text) == 0)
+ if (g_utf8_collate(toolbar_text[i].index_str, text) == 0)
return i;
}
return FALSE;
}
+/* depending on toolbar type this function
+ returns a list of available toolbar events being
+ displayed by prefs_toolbar
+*/
GList *toolbar_get_action_items(ToolbarType source)
{
GList *items = NULL;
gint i = 0;
if (source == TOOLBAR_MAIN) {
- gint main_items[13] = { A_RECEIVE_ALL, A_RECEIVE_CUR, A_SEND_QUEUED,
- A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
- A_REPLY_ALL, A_REPLY_ML, A_FORWARD,
- A_DELETE, A_EXECUTE, A_GOTO_NEXT,
- A_SYL_ACTIONS };
-
- for (i = 0; i < sizeof(main_items)/sizeof(main_items[0]); i++)
+ gint main_items[] = { A_RECEIVE_ALL, A_RECEIVE_CUR, A_SEND_QUEUED,
+ A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
+ A_REPLY_ALL, A_REPLY_ML, A_FORWARD,
+ A_DELETE, A_EXECUTE, A_GOTO_NEXT,
+ A_IGNORE_THREAD, A_PRINT,
+ A_ADDRBOOK, A_SYL_ACTIONS };
+
+ for (i = 0; i < sizeof main_items / sizeof main_items[0]; i++) {
items = g_list_append(items, gettext(toolbar_text[main_items[i]].descr));
+ if (main_items[i] == A_PRINT) {
+ g_print("$$$ descr %s, trans %s\n",
+ toolbar_text[main_items[i]].descr,
+ gettext(toolbar_text[main_items[i]].descr));
+ }
+ }
}
else if (source == TOOLBAR_COMPOSE) {
- gint comp_items[10] = { A_SEND, A_SENDL, A_DRAFT,
+ gint comp_items[] = { A_SEND, A_SENDL, A_DRAFT,
A_INSERT, A_ATTACH, A_SIG,
- A_EXTEDITOR, A_LINEWRAP, A_ADDRBOOK,
+ A_EXTEDITOR, A_LINEWRAP_CURRENT,
+ A_LINEWRAP_ALL, A_ADDRBOOK,
+#ifdef USE_ASPELL
+ A_CHECK_SPELLING,
+#endif
A_SYL_ACTIONS };
- for (i = 0; i < sizeof(comp_items)/sizeof(comp_items[0]); i++)
+ for (i = 0; i < sizeof comp_items / sizeof comp_items[0]; i++)
items = g_list_append(items, gettext(toolbar_text[comp_items[i]].descr));
}
else if (source == TOOLBAR_MSGVIEW) {
- gint msgv_items[8] = { A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
- A_REPLY_ALL, A_REPLY_ML, A_FORWARD,
- A_DELETE, A_GOTO_NEXT };
+ gint msgv_items[] = { A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
+ A_REPLY_ALL, A_REPLY_ML, A_FORWARD,
+ A_DELETE, A_GOTO_NEXT, A_ADDRBOOK,
+ A_SYL_ACTIONS };
- for (i = 0; i < sizeof(msgv_items)/sizeof(msgv_items[0]); i++)
+ for (i = 0; i < sizeof msgv_items / sizeof msgv_items[0]; i++)
items = g_list_append(items, gettext(toolbar_text[msgv_items[i]].descr));
}
name = ((XMLAttr *)attr->data)->name;
value = ((XMLAttr *)attr->data)->value;
- if (g_strcasecmp(name, TOOLBAR_ICON_FILE) == 0)
+ if (g_utf8_collate(name, TOOLBAR_ICON_FILE) == 0)
item->file = g_strdup (value);
- else if (g_strcasecmp(name, TOOLBAR_ICON_TEXT) == 0)
+ else if (g_utf8_collate(name, TOOLBAR_ICON_TEXT) == 0)
item->text = g_strdup (value);
- else if (g_strcasecmp(name, TOOLBAR_ICON_ACTION) == 0)
+ else if (g_utf8_collate(name, TOOLBAR_ICON_ACTION) == 0)
item->index = toolbar_ret_val_from_text(value);
attr = g_list_next(attr);
gint icon;
gchar *text;
} default_toolbar[] = {
- { A_SEND, STOCK_PIXMAP_MAIL_SEND, _("Send") },
- { A_SENDL, STOCK_PIXMAP_MAIL_SEND_QUEUE, _("Send later") },
- { A_DRAFT, STOCK_PIXMAP_MAIL, _("Draft") },
- { A_SEPARATOR, 0, ("") },
- { A_INSERT, STOCK_PIXMAP_INSERT_FILE, _("Insert") },
- { A_ATTACH, STOCK_PIXMAP_MAIL_ATTACH, _("Attach") },
- { A_SIG, STOCK_PIXMAP_MAIL_SIGN, _("Signature") },
- { A_SEPARATOR, 0, ("") },
- { A_EXTEDITOR, STOCK_PIXMAP_EDIT_EXTERN, _("Editor") },
- { A_LINEWRAP, STOCK_PIXMAP_LINEWRAP, _("Linewrap") },
- { A_SEPARATOR, 0, ("") },
- { A_ADDRBOOK, STOCK_PIXMAP_ADDRESS_BOOK, _("Address") }
+ { A_SEND, STOCK_PIXMAP_MAIL_SEND, _("Send") },
+ { A_SENDL, STOCK_PIXMAP_MAIL_SEND_QUEUE, _("Send later") },
+ { A_DRAFT, STOCK_PIXMAP_MAIL, _("Draft") },
+ { A_SEPARATOR, 0, ("") },
+ { A_INSERT, STOCK_PIXMAP_INSERT_FILE, _("Insert") },
+ { A_ATTACH, STOCK_PIXMAP_MAIL_ATTACH, _("Attach") },
+ { A_SIG, STOCK_PIXMAP_MAIL_SIGN, _("Signature") },
+ { A_SEPARATOR, 0, ("") },
+ { A_EXTEDITOR, STOCK_PIXMAP_EDIT_EXTERN, _("Editor") },
+ { A_LINEWRAP_CURRENT, STOCK_PIXMAP_LINEWRAP_CURRENT, _("Wrap paragraph") },
+ { A_LINEWRAP_ALL, STOCK_PIXMAP_LINEWRAP_ALL, _("Wrap all") },
+ { A_SEPARATOR, 0, ("") },
+ { A_ADDRBOOK, STOCK_PIXMAP_ADDRESS_BOOK, _("Address") }
};
gint i;
g_free( fileSpec );
if( pfile ) {
fp = pfile->fp;
- fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n",
- conv_get_current_charset_str());
+ fprintf(fp, "<?xml version=\"1.0\" encoding=\"%s\" ?>\n", CS_INTERNAL);
fprintf(fp, "<%s>\n", TOOLBAR_TAG_INDEX);
for (cur = toolbar_config[source].item_list; cur != NULL; cur = cur->next) {
ToolbarItem *toolbar_item = (ToolbarItem*) cur->data;
- if (toolbar_item->index != A_SEPARATOR)
- fprintf(fp, "\t<%s %s=\"%s\" %s=\"%s\" %s=\"%s\"/>\n",
+ if (toolbar_item->index != A_SEPARATOR) {
+ fprintf(fp, "\t<%s %s=\"%s\" %s=\"",
TOOLBAR_TAG_ITEM,
TOOLBAR_ICON_FILE, toolbar_item->file,
- TOOLBAR_ICON_TEXT, toolbar_item->text,
+ TOOLBAR_ICON_TEXT);
+ xml_file_put_escape_str(fp, toolbar_item->text);
+ fprintf(fp, "\" %s=\"%s\"/>\n",
TOOLBAR_ICON_ACTION,
toolbar_ret_text_from_val(toolbar_item->index));
- else
+ } else {
fprintf(fp, "\t<%s/>\n", TOOLBAR_TAG_SEPARATOR);
+ }
}
fprintf(fp, "</%s>\n", TOOLBAR_TAG_INDEX);
- if (prefs_write_close (pfile) < 0 )
+ if (prefs_file_close (pfile) < 0 )
g_warning("failed to write toolbar configuration to file\n");
} else
g_warning("failed to open toolbar configuration file for writing\n");
} else if (xml_compare_tag(file, TOOLBAR_TAG_SEPARATOR)) {
ToolbarItem *item = g_new0(ToolbarItem, 1);
- item->file = g_strdup(TOOLBAR_TAG_SEPARATOR);
+ item->file = g_strdup(toolbar_ret_descr_from_val(A_SEPARATOR));
item->index = A_SEPARATOR;
toolbar_config[source].item_list =
g_slist_append(toolbar_config[source].item_list, item);
action_p = strstr(action, ": ");
action_p[0] = 0x00;
- if (g_strcasecmp(act->name, action) == 0) {
+ if (g_utf8_collate(act->name, action) == 0) {
found = TRUE;
g_free(action);
break;
}
prefs_common.toolbar_style = (ToolbarStyle)action;
+ gtk_widget_set_size_request(handlebox_wid, 1, -1);
+
if (prefs_common.toolbar_style != TOOLBAR_NONE) {
gtk_widget_show(handlebox_wid);
gtk_widget_queue_resize(handlebox_wid);
summary_execute(mainwin->summaryview);
}
-
-
-/* popup callback functions */
-static void toolbar_reply_popup_cb(GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- Toolbar *toolbar_data = (Toolbar*)data;
-
- if (!event) return;
-
- if (event->button == 3) {
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- gtk_menu_popup(GTK_MENU(toolbar_data->reply_popup), NULL, NULL,
- menu_button_position, widget,
- event->button, event->time);
- }
-}
-
-static void toolbar_reply_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
-{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- GtkWidget *window;
- GtkWidget *reply_btn;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch(toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- reply_btn = mainwin->toolbar->reply_btn;
- window = mainwin->window;
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- reply_btn = msgview->toolbar->reply_btn;
- window = msgview->window;
- break;
- default:
- return;
- }
-
- gtk_button_set_relief(GTK_BUTTON(reply_btn), GTK_RELIEF_NONE);
- manage_window_focus_in(window, NULL, NULL);
-}
-
-static void toolbar_reply_to_all_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Toolbar *toolbar_data = (Toolbar*)data;
-
- if (!event) return;
-
- if (event->button == 3) {
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- gtk_menu_popup(GTK_MENU(toolbar_data->replyall_popup), NULL, NULL,
- menu_button_position, widget,
- event->button, event->time);
- }
-}
-
-static void toolbar_reply_to_all_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
-{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- GtkWidget *window;
- GtkWidget *replyall_btn;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch(toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- replyall_btn = mainwin->toolbar->replyall_btn;
- window = mainwin->window;
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- replyall_btn = msgview->toolbar->replyall_btn;
- window = msgview->window;
- break;
- default:
- return;
- }
-
- gtk_button_set_relief(GTK_BUTTON(replyall_btn), GTK_RELIEF_NONE);
- manage_window_focus_in(window, NULL, NULL);
-}
-
-static void toolbar_reply_to_list_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Toolbar *toolbar_data = (Toolbar*)data;
-
- if (event->button == 3) {
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- gtk_menu_popup(GTK_MENU(toolbar_data->replylist_popup), NULL, NULL,
- menu_button_position, widget,
- event->button, event->time);
- }
-}
-
-static void toolbar_reply_to_list_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
-{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- gpointer parent = toolbar_item->parent;
- GtkWidget *window;
- GtkWidget *replylist_btn;
-
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch(toolbar_item->type) {
- case TOOLBAR_MAIN:
- replylist_btn = ((MainWindow*)parent)->toolbar->replylist_btn;
- window = ((MainWindow*)parent)->window;
- break;
- case TOOLBAR_MSGVIEW:
- replylist_btn = ((MessageView*)parent)->toolbar->replylist_btn;
- window = ((MessageView*)parent)->window;
- break;
- default:
- return;
- }
-
- gtk_button_set_relief(GTK_BUTTON(replylist_btn), GTK_RELIEF_NONE);
- manage_window_focus_in(window, NULL, NULL);
-}
-
-static void toolbar_reply_to_sender_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Toolbar *toolbar_data = (Toolbar*)data;
-
- if (event->button == 3) {
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- gtk_menu_popup(GTK_MENU(toolbar_data->replysender_popup), NULL, NULL,
- menu_button_position, widget,
- event->button, event->time);
- }
-}
-
-static void toolbar_reply_to_sender_popup_closed_cb(GtkMenuShell *menu_shell, gpointer data)
-{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- gpointer parent = toolbar_item->parent;
- GtkWidget *window;
- GtkWidget *replysender_btn;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch(toolbar_item->type) {
- case TOOLBAR_MAIN:
- replysender_btn = ((MainWindow*)parent)->toolbar->replysender_btn;
- window = ((MainWindow*)parent)->window;
- break;
- case TOOLBAR_MSGVIEW:
- replysender_btn = ((MessageView*)parent)->toolbar->replysender_btn;
- window = ((MessageView*)parent)->window;
- break;
- default:
- return;
- }
-
- gtk_button_set_relief(GTK_BUTTON(replysender_btn), GTK_RELIEF_NONE);
- manage_window_focus_in(window, NULL, NULL);
-}
-
-static void toolbar_forward_popup_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Toolbar *toolbar_data = (Toolbar*)data;
-
- if (event->button == 3) {
- gtk_button_set_relief(GTK_BUTTON(widget), GTK_RELIEF_NORMAL);
- gtk_menu_popup(GTK_MENU(toolbar_data->fwd_popup), NULL, NULL,
- menu_button_position, widget,
- event->button, event->time);
- }
-}
-
-static void toolbar_forward_popup_closed_cb (GtkMenuShell *menu_shell,
- gpointer data)
-{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- gpointer parent = toolbar_item->parent;
- GtkWidget *window;
- GtkWidget *fwd_btn;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch(toolbar_item->type) {
- case TOOLBAR_MAIN:
- fwd_btn = ((MainWindow*)parent)->toolbar->fwd_btn;
- window = ((MainWindow*)parent)->window;
- break;
- case TOOLBAR_MSGVIEW:
- fwd_btn = ((MessageView*)parent)->toolbar->fwd_btn;
- window = ((MessageView*)parent)->window;
- break;
- default:
- return;
- }
-
- gtk_button_set_relief(GTK_BUTTON(fwd_btn), GTK_RELIEF_NONE);
- manage_window_focus_in(window, NULL, NULL);
-}
-
/*
* Delete current/selected(s) message(s)
*/
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- MessageView *msgview;
g_return_if_fail(toolbar_item != NULL);
+ g_return_if_fail(toolbar_item->parent);
switch (toolbar_item->type) {
case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- /* make sure the selected msg in summaryview is
- the one we are asked to delete */
- delete_msgview_cb(msgview, 0, widget);
+ messageview_delete((MessageView *)toolbar_item->parent);
break;
case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- summary_delete(mainwin->summaryview);
+ mainwin = (MainWindow *)toolbar_item->parent;
+ summary_delete_trash(mainwin->summaryview);
break;
default:
debug_print("toolbar event not supported\n");
}
}
-static void toolbar_popup_cb(gpointer data, guint action, GtkWidget *widget)
-{
- MainWindow *mainwin = get_mainwin(data);
-
- g_return_if_fail(mainwin != NULL);
- reply_cb(mainwin, action, widget);
-}
-
/*
* Reply Message
*/
static void toolbar_reply_cb(GtkWidget *widget, gpointer data)
{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch (toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- if (prefs_common.default_reply_list)
- reply_cb(mainwin,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
- : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
- NULL);
- else
- reply_cb(mainwin,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_WITH_QUOTE
- : COMPOSE_REPLY_WITHOUT_QUOTE,
- NULL);
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- compose_reply(msgview->msginfo,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_WITH_QUOTE
- : COMPOSE_REPLY_WITHOUT_QUOTE,
- FALSE, FALSE, FALSE, NULL);
- break;
- default:
- debug_print("toolbar event not supported\n");
- }
+ toolbar_reply(data, prefs_common.reply_with_quote ?
+ COMPOSE_REPLY_WITH_QUOTE : COMPOSE_REPLY_WITHOUT_QUOTE);
}
*/
static void toolbar_reply_to_all_cb(GtkWidget *widget, gpointer data)
{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch (toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- reply_cb(mainwin,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
- : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
- NULL);
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- compose_reply(msgview->msginfo,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
- : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
- TRUE, FALSE, FALSE, NULL);
- break;
- default:
- debug_print("toolbar event not supported\n");
- }
+ toolbar_reply(data,
+ prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
+ : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE);
}
*/
static void toolbar_reply_to_list_cb(GtkWidget *widget, gpointer data)
{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch (toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- reply_cb(mainwin,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
- : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
- NULL);
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- compose_reply(msgview->msginfo,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
- : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE,
- FALSE, TRUE, FALSE, NULL);
- break;
- default:
- debug_print("toolbar event not supported\n");
- }
+ toolbar_reply(data,
+ prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
+ : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE);
}
*/
static void toolbar_reply_to_sender_cb(GtkWidget *widget, gpointer data)
{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- MainWindow *mainwin;
- MessageView *msgview;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch (toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- reply_cb(mainwin,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
- : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
- NULL);
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)toolbar_item->parent;
- compose_reply(msgview->msginfo,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
- : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
- FALSE, FALSE, FALSE, NULL);
- break;
- default:
- debug_print("toolbar event not supported\n\n");
- }
+ toolbar_reply(data,
+ prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
+ : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE);
}
/*
g_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
+ case TOOLBAR_MAIN:
+ case TOOLBAR_MSGVIEW:
+ compose = NULL;
+ break;
case TOOLBAR_COMPOSE:
compose = (Compose *)toolbar_item->parent;
break;
default:
- compose = NULL;
+ return;
}
addressbook_open(compose);
}
*/
static void toolbar_forward_cb(GtkWidget *widget, gpointer data)
{
- ToolbarItem *toolbar_item = (ToolbarItem*)data;
- MainWindow *mainwin;
-
- g_return_if_fail(toolbar_item != NULL);
-
- switch (toolbar_item->type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
- if (prefs_common.forward_as_attachment)
- reply_cb(mainwin, COMPOSE_FORWARD_AS_ATTACH, NULL);
- else
- reply_cb(mainwin, COMPOSE_FORWARD, NULL);
- break;
-
- default:
- debug_print("toolbar event not supported\n");
- }
+ toolbar_reply(data, COMPOSE_FORWARD);
}
case TOOLBAR_MSGVIEW:
msgview = (MessageView*)toolbar_item->parent;
-/*
- * TODO: Check if summaryview stay in the same place when this message view was created
- * if summary have other message select the next will be based on message selected in summaryview
- */
summary_select_next_unread(msgview->mainwin->summaryview);
- /** Now we need to update the messageview window */
+ /* Now we need to update the messageview window */
if (msgview->mainwin->summaryview->selected) {
GtkCTree *ctree = GTK_CTREE(msgview->mainwin->summaryview->ctree);
}
}
+static void toolbar_ignore_thread_cb(GtkWidget *widget, gpointer data)
+{
+ ToolbarItem *toolbar_item = (ToolbarItem*)data;
+ MainWindow *mainwin;
+
+ g_return_if_fail(toolbar_item != NULL);
+
+ switch (toolbar_item->type) {
+ case TOOLBAR_MAIN:
+ mainwin = (MainWindow *) toolbar_item->parent;
+ summary_toggle_ignore_thread(mainwin->summaryview);
+ break;
+ case TOOLBAR_MSGVIEW:
+ /* TODO: see toolbar_next_unread_cb() if you need
+ * this in the message view */
+ break;
+ default:
+ debug_print("toolbar event not supported\n");
+ break;
+ }
+}
+
+static void toolbar_print_cb(GtkWidget *widget, gpointer data)
+{
+ ToolbarItem *toolbar_item = (ToolbarItem*)data;
+ MainWindow *mainwin;
+
+ g_return_if_fail(toolbar_item != NULL);
+
+ switch (toolbar_item->type) {
+ case TOOLBAR_MAIN:
+ mainwin = (MainWindow *) toolbar_item->parent;
+ summary_print(mainwin->summaryview);
+ break;
+ case TOOLBAR_MSGVIEW:
+ /* TODO: see toolbar_next_unread_cb() if you need
+ * this in the message view */
+ break;
+ default:
+ debug_print("toolbar event not supported\n");
+ break;
+ }
+}
+
static void toolbar_send_cb(GtkWidget *widget, gpointer data)
{
compose_toolbar_cb(A_SEND, data);
compose_toolbar_cb(A_EXTEDITOR, data);
}
-static void toolbar_linewrap_cb(GtkWidget *widget, gpointer data)
+static void toolbar_linewrap_current_cb(GtkWidget *widget, gpointer data)
{
- compose_toolbar_cb(A_LINEWRAP, data);
+ compose_toolbar_cb(A_LINEWRAP_CURRENT, data);
}
+static void toolbar_linewrap_all_cb(GtkWidget *widget, gpointer data)
+{
+ compose_toolbar_cb(A_LINEWRAP_ALL, data);
+}
+
+#ifdef USE_ASPELL
+static void toolbar_check_spelling_cb(GtkWidget *widget, gpointer data)
+{
+ compose_toolbar_cb(A_CHECK_SPELLING, data);
+}
+#endif
/*
* Execute actions from toolbar
*/
GSList *action_list;
MainWindow *mainwin;
Compose *compose;
+ MessageView *msgview;
+ gpointer parent = toolbar_item->parent;
g_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
- mainwin = (MainWindow*)toolbar_item->parent;
+ mainwin = (MainWindow*)parent;
action_list = mainwin->toolbar->action_list;
break;
case TOOLBAR_COMPOSE:
- compose = (Compose*)toolbar_item->parent;
+ compose = (Compose*)parent;
action_list = compose->toolbar->action_list;
break;
- /* case TOOLBAR_MSGVIEW: not supported yet */
+ case TOOLBAR_MSGVIEW:
+ msgview = (MessageView*)parent;
+ action_list = msgview->toolbar->action_list;
+ break;
default:
debug_print("toolbar event not supported\n");
return;
}
-
- toolbar_action_execute(widget, action_list, toolbar_item->parent, toolbar_item->type);
+ toolbar_action_execute(widget, action_list, parent, toolbar_item->type);
}
static MainWindow *get_mainwin(gpointer data)
return mainwin;
}
-static GtkWidget *get_window_widget(ToolbarType type, gpointer data)
-{
- MainWindow *mainwin;
- MessageView *msgview;
-
- switch (type) {
- case TOOLBAR_MAIN:
- mainwin = (MainWindow*)data;
- return mainwin->window;
- break;
- case TOOLBAR_MSGVIEW:
- msgview = (MessageView*)data;
- return msgview->vbox;
- break;
- default:
- break;
- }
- return NULL;
-}
-
static void toolbar_buttons_cb(GtkWidget *widget,
- ToolbarItem *item)
+ ToolbarItem *item)
{
gint num_items;
gint i;
{ A_DELETE, toolbar_delete_cb },
{ A_EXECUTE, toolbar_exec_cb },
{ A_GOTO_NEXT, toolbar_next_unread_cb },
+ { A_IGNORE_THREAD, toolbar_ignore_thread_cb },
+ { A_PRINT, toolbar_print_cb },
{ A_SEND, toolbar_send_cb },
{ A_SENDL, toolbar_send_later_cb },
{ A_ATTACH, toolbar_attach_cb },
{ A_SIG, toolbar_sig_cb },
{ A_EXTEDITOR, toolbar_ext_editor_cb },
- { A_LINEWRAP, toolbar_linewrap_cb },
+ { A_LINEWRAP_CURRENT, toolbar_linewrap_current_cb },
+ { A_LINEWRAP_ALL, toolbar_linewrap_all_cb },
{ A_ADDRBOOK, toolbar_addrbook_cb },
-
+#ifdef USE_ASPELL
+ { A_CHECK_SPELLING, toolbar_check_spelling_cb },
+#endif
{ A_SYL_ACTIONS, toolbar_actions_execute_cb }
};
GtkWidget *icon_news;
GtkWidget *item;
GtkWidget *item_news;
- GtkWidget *window_wid;
guint n_menu_entries;
- GtkWidget *reply_popup;
- GtkWidget *replyall_popup;
- GtkWidget *replylist_popup;
- GtkWidget *replysender_popup;
- GtkWidget *fwd_popup;
+ ComboButton *reply_combo;
+ ComboButton *replyall_combo;
+ ComboButton *replylist_combo;
+ ComboButton *replysender_combo;
+ ComboButton *fwd_combo;
GtkTooltips *toolbar_tips;
ToolbarSylpheedActions *action_item;
toolbar_data = g_new0(Toolbar, 1);
- toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
- GTK_TOOLBAR_BOTH);
+ toolbar = gtk_toolbar_new();
gtk_container_add(GTK_CONTAINER(container), toolbar);
gtk_container_set_border_width(GTK_CONTAINER(container), 2);
- gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolbar), GTK_RELIEF_NONE);
- gtk_toolbar_set_space_style(GTK_TOOLBAR(toolbar),
- GTK_TOOLBAR_SPACE_LINE);
+ gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL);
+ gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH);
for (cur = toolbar_list; cur != NULL; cur = cur->next) {
- if (g_strcasecmp(((ToolbarItem*)cur->data)->file, TOOLBAR_TAG_SEPARATOR) == 0) {
+ if (g_ascii_strcasecmp(((ToolbarItem*)cur->data)->file, TOOLBAR_TAG_SEPARATOR) == 0) {
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
continue;
}
toolbar_item->text,
(""),
(""),
- icon_wid, toolbar_buttons_cb,
+ icon_wid, G_CALLBACK(toolbar_buttons_cb),
toolbar_item);
switch (toolbar_item->index) {
toolbar_data->send_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->send_btn,
- _("Send Queued Message(s)"), NULL);
+ _("Send Queued Messages"), NULL);
break;
case A_COMPOSE_EMAIL:
icon_news = stock_pixmap_widget(container, STOCK_PIXMAP_NEWS_COMPOSE);
_("News"),
(""),
(""),
- icon_news, toolbar_buttons_cb,
+ icon_news, G_CALLBACK(toolbar_buttons_cb),
toolbar_item);
toolbar_data->compose_mail_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->reply_btn,
_("Reply to Message"), NULL);
- gtk_signal_connect(GTK_OBJECT(toolbar_data->reply_btn),
- "button_press_event",
- GTK_SIGNAL_FUNC(toolbar_reply_popup_cb),
- toolbar_data);
- n_menu_entries = sizeof(reply_popup_entries) /
- sizeof(reply_popup_entries[0]);
-
- window_wid = get_window_widget(type, data);
- reply_popup = popupmenu_create(window_wid,
- reply_popup_entries, n_menu_entries,
- "<ReplyPopup>", (gpointer)toolbar_item);
-
- gtk_signal_connect(GTK_OBJECT(reply_popup), "selection_done",
- GTK_SIGNAL_FUNC(toolbar_reply_popup_closed_cb), toolbar_item);
- toolbar_data->reply_popup = reply_popup;
+ n_menu_entries = sizeof(reply_entries) /
+ sizeof(reply_entries[0]);
+ reply_combo = gtkut_combo_button_create(toolbar_data->reply_btn,
+ reply_entries, n_menu_entries,
+ "<Reply>", (gpointer)toolbar_item);
+ gtk_button_set_relief(GTK_BUTTON(reply_combo->arrow),
+ GTK_RELIEF_NONE);
+ gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+ GTK_WIDGET_PTR(reply_combo),
+ _("Reply to Message"), "Reply");
+ toolbar_data->reply_combo = reply_combo;
break;
case A_REPLY_SENDER:
toolbar_data->replysender_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->replysender_btn,
_("Reply to Sender"), NULL);
- gtk_signal_connect(GTK_OBJECT(toolbar_data->replysender_btn),
- "button_press_event",
- GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_cb),
- toolbar_data);
- n_menu_entries = sizeof(replysender_popup_entries) /
- sizeof(replysender_popup_entries[0]);
-
- window_wid = get_window_widget(type, data);
- replysender_popup = popupmenu_create(window_wid,
- replysender_popup_entries, n_menu_entries,
- "<ReplySenderPopup>", (gpointer)toolbar_item);
-
- gtk_signal_connect(GTK_OBJECT(replysender_popup), "selection_done",
- GTK_SIGNAL_FUNC(toolbar_reply_to_sender_popup_closed_cb), toolbar_item);
- toolbar_data->replysender_popup = replysender_popup;
+ n_menu_entries = sizeof(replysender_entries) /
+ sizeof(replysender_entries[0]);
+ replysender_combo = gtkut_combo_button_create(toolbar_data->replysender_btn,
+ replysender_entries, n_menu_entries,
+ "<ReplySender>", (gpointer)toolbar_item);
+ gtk_button_set_relief(GTK_BUTTON(replysender_combo->arrow),
+ GTK_RELIEF_NONE);
+ gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+ GTK_WIDGET_PTR(replysender_combo),
+ _("Reply to Sender"), "ReplySender");
+ toolbar_data->replysender_combo = replysender_combo;
break;
case A_REPLY_ALL:
toolbar_data->replyall_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->replyall_btn,
_("Reply to All"), NULL);
- gtk_signal_connect(GTK_OBJECT(toolbar_data->replyall_btn),
- "button_press_event",
- GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_cb),
- toolbar_data);
- n_menu_entries = sizeof(replyall_popup_entries) /
- sizeof(replyall_popup_entries[0]);
-
- window_wid = get_window_widget(type, data);
- replyall_popup = popupmenu_create(window_wid,
- replyall_popup_entries, n_menu_entries,
- "<ReplyAllPopup>", (gpointer)toolbar_item);
-
- gtk_signal_connect(GTK_OBJECT(replyall_popup), "selection_done",
- GTK_SIGNAL_FUNC(toolbar_reply_to_all_popup_closed_cb), toolbar_item);
- toolbar_data->replyall_popup = replyall_popup;
+ n_menu_entries = sizeof(replyall_entries) /
+ sizeof(replyall_entries[0]);
+ replyall_combo = gtkut_combo_button_create(toolbar_data->replyall_btn,
+ replyall_entries, n_menu_entries,
+ "<ReplyAll>", (gpointer)toolbar_item);
+ gtk_button_set_relief(GTK_BUTTON(replyall_combo->arrow),
+ GTK_RELIEF_NONE);
+ gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+ GTK_WIDGET_PTR(replyall_combo),
+ _("Reply to All"), "ReplyAll");
+ toolbar_data->replyall_combo = replyall_combo;
break;
case A_REPLY_ML:
toolbar_data->replylist_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->replylist_btn,
_("Reply to Mailing-list"), NULL);
- gtk_signal_connect(GTK_OBJECT(toolbar_data->replylist_btn),
- "button_press_event",
- GTK_SIGNAL_FUNC(toolbar_reply_to_list_popup_cb),
- toolbar_data);
- n_menu_entries = sizeof(replylist_popup_entries) /
- sizeof(replylist_popup_entries[0]);
-
- window_wid = get_window_widget(type, data);
- replylist_popup = popupmenu_create(window_wid,
- replylist_popup_entries, n_menu_entries,
- "<ReplyMlPopup>", (gpointer)toolbar_item);
-
- gtk_signal_connect(GTK_OBJECT(replylist_popup), "selection_done",
- GTK_SIGNAL_FUNC(toolbar_reply_to_list_popup_closed_cb), toolbar_item);
- toolbar_data->replylist_popup = replylist_popup;
+ n_menu_entries = sizeof(replylist_entries) /
+ sizeof(replylist_entries[0]);
+ replylist_combo = gtkut_combo_button_create(toolbar_data->replylist_btn,
+ replylist_entries, n_menu_entries,
+ "<ReplyList>", (gpointer)toolbar_item);
+ gtk_button_set_relief(GTK_BUTTON(replylist_combo->arrow),
+ GTK_RELIEF_NONE);
+ gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+ GTK_WIDGET_PTR(replylist_combo),
+ _("Reply to Mailing-list"), "ReplyList");
+ toolbar_data->replylist_combo = replylist_combo;
break;
case A_FORWARD:
toolbar_data->fwd_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
toolbar_data->fwd_btn,
_("Forward Message"), NULL);
- gtk_signal_connect(GTK_OBJECT(toolbar_data->fwd_btn),
- "button_press_event",
- GTK_SIGNAL_FUNC(toolbar_forward_popup_cb),
- toolbar_data);
- n_menu_entries = sizeof(fwd_popup_entries) /
- sizeof(fwd_popup_entries[0]);
-
- window_wid = get_window_widget(type, data);
- fwd_popup = popupmenu_create(window_wid,
- fwd_popup_entries, n_menu_entries,
- "<ForwardPopup>", (gpointer)toolbar_item);
-
- gtk_signal_connect(GTK_OBJECT(fwd_popup), "selection_done",
- GTK_SIGNAL_FUNC(toolbar_forward_popup_closed_cb), toolbar_item);
- toolbar_data->fwd_popup = fwd_popup;
+ n_menu_entries = sizeof(forward_entries) /
+ sizeof(forward_entries[0]);
+ fwd_combo = gtkut_combo_button_create(toolbar_data->fwd_btn,
+ forward_entries, n_menu_entries,
+ "<Forward>", (gpointer)toolbar_item);
+ gtk_button_set_relief(GTK_BUTTON(fwd_combo->arrow),
+ GTK_RELIEF_NONE);
+ gtk_toolbar_append_widget(GTK_TOOLBAR(toolbar),
+ GTK_WIDGET_PTR(fwd_combo),
+ _("Forward Message"), "Fwd");
+ toolbar_data->fwd_combo = fwd_combo;
break;
case A_DELETE:
toolbar_data->delete_btn = item;
toolbar_data->exteditor_btn,
_("Edit with external editor"), NULL);
break;
- case A_LINEWRAP:
- toolbar_data->linewrap_btn = item;
+ case A_LINEWRAP_CURRENT:
+ toolbar_data->linewrap_current_btn = item;
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
+ toolbar_data->linewrap_current_btn,
+ _("Wrap long lines of current paragraph"), NULL);
+ break;
+ case A_LINEWRAP_ALL:
+ toolbar_data->linewrap_all_btn = item;
gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
- toolbar_data->linewrap_btn,
+ toolbar_data->linewrap_all_btn,
_("Wrap all long lines"), NULL);
break;
case A_ADDRBOOK:
toolbar_data->addrbook_btn,
_("Address book"), NULL);
break;
+#ifdef USE_ASPELL
+ case A_CHECK_SPELLING:
+ toolbar_data->spellcheck_btn = item;
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
+ toolbar_data->spellcheck_btn,
+ _("Check spelling"), NULL);
+ break;
+#endif
case A_SYL_ACTIONS:
action_item = g_new0(ToolbarSylpheedActions, 1);
gtk_widget_show(item);
break;
default:
+ /* find and set the tool tip text */
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(toolbar_tips),
+ item,
+ toolbar_ret_descr_from_val
+ (toolbar_item->index),
+ NULL);
break;
}
SET_WIDGET_COND(toolbar->compose_news_btn, M_HAVE_ACCOUNT);
SET_WIDGET_COND(toolbar->reply_btn,
M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
+ if (toolbar->reply_btn)
+ SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->reply_combo),
+ M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
SET_WIDGET_COND(toolbar->replyall_btn,
M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
+ if (toolbar->replyall_btn)
+ SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->replyall_combo),
+ M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
SET_WIDGET_COND(toolbar->replylist_btn,
M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
+ if (toolbar->replylist_btn)
+ SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->replylist_combo),
+ M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
SET_WIDGET_COND(toolbar->replysender_btn,
M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
+ if (toolbar->replysender_btn)
+ SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->replysender_combo),
+ M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
SET_WIDGET_COND(toolbar->fwd_btn, M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ if (toolbar->fwd_btn)
+ SET_WIDGET_COND(GTK_WIDGET_PTR(toolbar->fwd_combo),
+ M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ if (toolbar->fwd_combo) {
+ GtkWidget *submenu = gtk_item_factory_get_widget(toolbar->fwd_combo->factory, "/Redirect");
+ SET_WIDGET_COND(submenu, M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST);
+ }
+
+ if (prefs_common.next_unread_msg_dialog == NEXTUNREADMSGDIALOG_ASSUME_NO) {
+ SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST);
+ } else {
+ SET_WIDGET_COND(toolbar->next_btn, 0);
+ }
- SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST);
SET_WIDGET_COND(toolbar->delete_btn,
M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED);
SET_WIDGET_COND(toolbar->exec_btn, M_DELAY_EXEC);
gtk_widget_set_sensitive(compose->toolbar->sig_btn, sensitive);
if (compose->toolbar->exteditor_btn)
gtk_widget_set_sensitive(compose->toolbar->exteditor_btn, sensitive);
- if (compose->toolbar->linewrap_btn)
- gtk_widget_set_sensitive(compose->toolbar->linewrap_btn, sensitive);
+ if (compose->toolbar->linewrap_current_btn)
+ gtk_widget_set_sensitive(compose->toolbar->linewrap_current_btn, sensitive);
+ if (compose->toolbar->linewrap_all_btn)
+ gtk_widget_set_sensitive(compose->toolbar->linewrap_all_btn, sensitive);
if (compose->toolbar->addrbook_btn)
gtk_widget_set_sensitive(compose->toolbar->addrbook_btn, sensitive);
+#ifdef USE_ASPELL
+ if (compose->toolbar->spellcheck_btn)
+ gtk_widget_set_sensitive(compose->toolbar->spellcheck_btn, sensitive);
+#endif
for (; items != NULL; items = g_slist_next(items)) {
ToolbarSylpheedActions *item = (ToolbarSylpheedActions *)items->data;
gtk_widget_set_sensitive(item->widget, sensitive);
**/
void toolbar_init(Toolbar * toolbar) {
- toolbar->toolbar = NULL;
- toolbar->get_btn = NULL;
- toolbar->getall_btn = NULL;
- toolbar->send_btn = NULL;
- toolbar->compose_mail_btn = NULL;
- toolbar->compose_news_btn = NULL;
- toolbar->reply_btn = NULL;
- toolbar->replysender_btn = NULL;
- toolbar->replyall_btn = NULL;
- toolbar->replylist_btn = NULL;
- toolbar->fwd_btn = NULL;
- toolbar->delete_btn = NULL;
- toolbar->next_btn = NULL;
- toolbar->exec_btn = NULL;
+ toolbar->toolbar = NULL;
+ toolbar->get_btn = NULL;
+ toolbar->getall_btn = NULL;
+ toolbar->send_btn = NULL;
+ toolbar->compose_mail_btn = NULL;
+ toolbar->compose_news_btn = NULL;
+ toolbar->reply_btn = NULL;
+ toolbar->replysender_btn = NULL;
+ toolbar->replyall_btn = NULL;
+ toolbar->replylist_btn = NULL;
+ toolbar->fwd_btn = NULL;
+ toolbar->delete_btn = NULL;
+ toolbar->next_btn = NULL;
+ toolbar->exec_btn = NULL;
/* compose buttons */
- toolbar->sendl_btn = NULL;
- toolbar->draft_btn = NULL;
- toolbar->insert_btn = NULL;
- toolbar->attach_btn = NULL;
- toolbar->sig_btn = NULL;
- toolbar->exteditor_btn = NULL;
- toolbar->linewrap_btn = NULL;
- toolbar->addrbook_btn = NULL;
+ toolbar->sendl_btn = NULL;
+ toolbar->draft_btn = NULL;
+ toolbar->insert_btn = NULL;
+ toolbar->attach_btn = NULL;
+ toolbar->sig_btn = NULL;
+ toolbar->exteditor_btn = NULL;
+ toolbar->linewrap_current_btn = NULL;
+ toolbar->linewrap_all_btn = NULL;
+ toolbar->addrbook_btn = NULL;
+#ifdef USE_ASPELL
+ toolbar->spellcheck_btn = NULL;
+#endif
toolbar_destroy(toolbar);
}
-/* exported functions */
-
-void delete_msgview_cb(gpointer data, guint action, GtkWidget *widget)
+/*
+ */
+static void toolbar_reply(gpointer data, guint action)
{
- MessageView *msgview = (MessageView*)data;
+ ToolbarItem *toolbar_item = (ToolbarItem*)data;
+ MainWindow *mainwin;
+ MessageView *msgview;
+ GSList *msginfo_list = NULL;
- if (msgview->mainwin->summaryview->selected) {
- SummaryView *summaryview = msgview->mainwin->summaryview;
- GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
- MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree,
- summaryview->selected);
- if (msginfo->msgnum != msgview->msginfo->msgnum) {
- alertpanel_error(_("Message already removed from folder."));
- return;
- }
- }
-
- summary_delete(msgview->mainwin->summaryview);
-
- if (msgview->mainwin->summaryview->selected) {
- SummaryView *summaryview = msgview->mainwin->summaryview;
- GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
- MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree,
- summaryview->selected);
- messageview_show(msgview, msginfo,
- msgview->all_headers);
- } else {
- toolbar_clear_list(TOOLBAR_MSGVIEW);
- toolbar_destroy(msgview->toolbar);
- gtk_widget_destroy(msgview->window);
- }
-}
+ g_return_if_fail(toolbar_item != NULL);
-void reply_cb(gpointer data, guint action, GtkWidget *widget)
-{
- MainWindow *mainwin = (MainWindow*)data;
+ switch (toolbar_item->type) {
+ case TOOLBAR_MAIN:
+ mainwin = (MainWindow*)toolbar_item->parent;
+ msginfo_list = summary_get_selection(mainwin->summaryview);
+ msgview = (MessageView*)mainwin->messageview;
+ break;
+ case TOOLBAR_MSGVIEW:
+ msgview = (MessageView*)toolbar_item->parent;
+ g_return_if_fail(msgview != NULL);
+ msginfo_list = g_slist_append(msginfo_list, msgview->msginfo);
+ break;
+ default:
+ return;
+ }
- g_return_if_fail(mainwin != NULL);
+ g_return_if_fail(msgview != NULL);
+ g_return_if_fail(msginfo_list != NULL);
+ compose_reply_from_messageview(msgview, msginfo_list, action);
+ g_slist_free(msginfo_list);
- summary_reply(mainwin->summaryview, (ComposeMode)action);
+ /* TODO: update reply state ion summaryview */
}
+
+/* exported functions */
+
void inc_mail_cb(gpointer data, guint action, GtkWidget *widget)
{
MainWindow *mainwin = (MainWindow*)data;
{
MainWindow *mainwin = (MainWindow*)data;
- inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
+ inc_all_account_mail(mainwin, FALSE, prefs_common.newmail_notify_manu);
}
void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
Folder *folder = list->data;
if (folder->queue) {
- if (procmsg_send_queue
- (folder->queue, prefs_common.savemsg) < 0)
- alertpanel_error(_("Some errors occurred while sending queued messages."));
+ if (procmsg_send_queue(folder->queue,
+ prefs_common.savemsg) < 0)
+ alertpanel_error(_("Some errors occurred while "
+ "sending queued messages."));
folder_item_scan(folder->queue);
- folder_update_item(folder->queue, TRUE);
}
}
}