/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001-2007 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 2001-2011 Hiroyuki Yamamoto and the Claws Mail 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
#define TOOLBAR_ICON_TEXT "text"
#define TOOLBAR_ICON_ACTION "action"
+static void toolbar_init(Toolbar * toolbar);
static gboolean toolbar_is_duplicate (gint action,
ToolbarType source);
static void toolbar_parse_item (XMLFile *file,
/* toolbar callbacks */
static void toolbar_reply (gpointer data,
- guint action);
+ guint action);
static void toolbar_learn (gpointer data,
- guint action);
+ guint action);
static void toolbar_delete_cb (GtkWidget *widget,
gpointer data);
static void toolbar_trash_cb (GtkWidget *widget,
static void toolbar_actions_execute_cb (GtkWidget *widget,
gpointer data);
+static void toolbar_plugins_execute_cb (GtkWidget *widget,
+ gpointer data);
static void toolbar_send_cb (GtkWidget *widget,
gpointer data);
static void toolbar_close_cb (GtkWidget *widget,
gpointer data);
+static void toolbar_preferences_cb (GtkWidget *widget,
+ gpointer data);
static void toolbar_open_mail_cb (GtkWidget *widget,
gpointer data);
static void toolbar_insert_cb (GtkWidget *widget,
gpointer data);
static void toolbar_addrbook_cb (GtkWidget *widget,
gpointer data);
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
static void toolbar_check_spelling_cb (GtkWidget *widget,
gpointer data);
#endif
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_RECEIVE_ALL", N_("Receive Mail from all Accounts") },
+ { "A_RECEIVE_CUR", N_("Receive Mail from current Account") },
{ "A_SEND_QUEUED", N_("Send Queued Messages") },
{ "A_COMPOSE_EMAIL", N_("Compose Email") },
{ "A_COMPOSE_NEWS", N_("Compose News") },
{ "A_PRINT", N_("Print") },
{ "A_LEARN_SPAM", N_("Learn Spam or Ham") },
{ "A_GO_FOLDERS", N_("Open folder/Go to folder list") },
+ { "A_PREFERENCES", N_("Preferences") },
{ "A_SEND", N_("Send Message") },
{ "A_SENDL", N_("Put into queue folder and send later") },
{ "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
+#ifdef USE_ENCHANT
{ "A_CHECK_SPELLING", N_("Check spelling") },
#endif
- { "A_SYL_ACTIONS", N_("Claws Mail Actions Feature") },
+ { "A_CLAWS_ACTIONS", N_("Claws Mail Actions Feature") },
{ "A_CANCEL_INC", N_("Cancel receiving") },
{ "A_CLOSE", N_("Close window") },
- { "A_SEPARATOR", "Separator" }
+ { "A_SEPARATOR", N_("Separator") },
+ { "A_CLAWS_PLUGINS", N_("Claws Mail Plugins") },
};
/* struct holds configuration files and a list of
{ "toolbar_msgview.xml", NULL}
};
-static GtkItemFactoryEntry reply_entries[] =
-{
- {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_entries[] =
-{
- {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_entries[] =
-{
- {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_entries[] =
-{
- {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 forward_entries[] =
-{
- {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}
-};
-static GtkItemFactoryEntry learn_entries[] =
-{
- {N_("/Learn as _Spam"), NULL, toolbar_learn, TRUE, NULL},
- {N_("/Learn as _Ham"), NULL, toolbar_learn, FALSE, NULL}
-};
-
-
gint toolbar_ret_val_from_descr(const gchar *descr)
{
gint i;
gchar *toolbar_ret_descr_from_val(gint val)
{
- g_return_val_if_fail(val >=0 && val < N_ACTION_VAL, NULL);
+ cm_return_val_if_fail(val >=0 && val < N_ACTION_VAL, NULL);
return gettext(toolbar_text[val].descr);
}
static gchar *toolbar_ret_text_from_val(gint val)
{
- g_return_val_if_fail(val >=0 && val < N_ACTION_VAL, NULL);
+ cm_return_val_if_fail(val >=0 && val < N_ACTION_VAL, NULL);
return toolbar_text[val].index_str;
}
{
GSList *cur;
- if ((action == A_SEPARATOR) || (action == A_SYL_ACTIONS))
+ if ((action == A_SEPARATOR) || (action == A_CLAWS_ACTIONS) || (action == A_CLAWS_PLUGINS))
return FALSE;
for (cur = toolbar_config[source].item_list; cur != NULL; cur = cur->next) {
A_TRASH , A_DELETE_REAL, A_EXECUTE, A_GOTO_PREV,
A_GOTO_NEXT, A_IGNORE_THREAD, A_WATCH_THREAD, A_PRINT,
A_ADDRBOOK, A_LEARN_SPAM, A_GO_FOLDERS,
- A_CANCEL_INC };
+ A_CANCEL_INC, A_PREFERENCES };
for (i = 0; i < sizeof main_items / sizeof main_items[0]; i++) {
items = g_list_append(items, gettext(toolbar_text[main_items[i]].descr));
A_INSERT, A_ATTACH, A_SIG,
A_EXTEDITOR, A_LINEWRAP_CURRENT,
A_LINEWRAP_ALL, A_ADDRBOOK,
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
A_CHECK_SPELLING,
#endif
A_CLOSE };
if (g_utf8_collate(name, TOOLBAR_ICON_FILE) == 0)
item->file = g_strdup (value);
else if (g_utf8_collate(name, TOOLBAR_ICON_TEXT) == 0)
- item->text = g_strdup (gettext(value));
+ item->text = g_strdup (*value ? gettext(value):"");
else if (g_utf8_collate(name, TOOLBAR_ICON_ACTION) == 0)
item->index = toolbar_ret_val_from_text(value);
if (item->index == -1 && !strcmp(value, "A_DELETE")) {
g_free(item->file);
item->file = g_strdup("trash_btn");
g_free(item->text);
- item->text = g_strdup(_("Trash"));
+ item->text = g_strdup(Q_("Toolbar|Trash"));
+ rewrite = TRUE;
+ }
+ if (item->index == -1 && !strcmp(value, "A_SYL_ACTIONS")) {
+ /* switch button */
+ item->index = A_CLAWS_ACTIONS;
rewrite = TRUE;
}
attr = g_list_next(attr);
case A_COMPOSE_NEWS: return Q_("Toolbar|Compose");
case A_REPLY_MESSAGE: return _("Reply");
case A_REPLY_ALL: return _("All");
- case A_REPLY_SENDER: return _("Sender");
+ case A_REPLY_SENDER: return Q_("Toolbar|Sender");
case A_REPLY_ML: return _("List");
case A_FORWARD: return _("Forward");
- case A_TRASH: return _("Trash");
+ case A_TRASH: return Q_("Toolbar|Trash");
case A_DELETE_REAL: return _("Delete");
case A_LEARN_SPAM: return _("Spam");
case A_GOTO_PREV: return _("Prev");
case A_WATCH_THREAD: return _("Watch thread");
case A_PRINT: return _("Print");
case A_CLOSE: return _("Close");
+ case A_PREFERENCES: return _("Preferences");
case A_SEND: return _("Send");
case A_SENDL: return _("Send later");
case A_DRAFT: return _("Draft");
case A_ADDRBOOK: return _("Address");
case A_CANCEL_INC: return _("Stop");
case A_EXECUTE: return _("Execute");
- #ifdef USE_ASPELL
+ #ifdef USE_ENCHANT
case A_CHECK_SPELLING: return _("Check spelling");
#endif
default: return "";
case A_REPLY_MESSAGE: return STOCK_PIXMAP_MAIL_REPLY;
case A_REPLY_ALL: return STOCK_PIXMAP_MAIL_REPLY_TO_ALL;
case A_REPLY_SENDER: return STOCK_PIXMAP_MAIL_REPLY_TO_AUTHOR;
- case A_REPLY_ML: return STOCK_PIXMAP_MAIL_REPLY;
+ case A_REPLY_ML: return STOCK_PIXMAP_MAIL_REPLY_TO_LIST;
case A_FORWARD: return STOCK_PIXMAP_MAIL_FORWARD;
case A_TRASH: return STOCK_PIXMAP_TRASH;
- case A_DELETE_REAL: return STOCK_PIXMAP_DELETED;
+ case A_DELETE_REAL: return STOCK_PIXMAP_DELETE;
case A_LEARN_SPAM: return STOCK_PIXMAP_SPAM_BTN;
case A_GOTO_PREV: return STOCK_PIXMAP_UP_ARROW;
case A_GOTO_NEXT: return STOCK_PIXMAP_DOWN_ARROW;
case A_WATCH_THREAD: return STOCK_PIXMAP_WATCHTHREAD;
case A_PRINT: return STOCK_PIXMAP_PRINTER;
case A_CLOSE: return STOCK_PIXMAP_CLOSE;
+ case A_PREFERENCES: return STOCK_PIXMAP_PREFERENCES;
case A_SEND: return STOCK_PIXMAP_MAIL_SEND;
case A_SENDL: return STOCK_PIXMAP_MAIL_SEND_QUEUE;
case A_DRAFT: return STOCK_PIXMAP_MAIL;
case A_LINEWRAP_CURRENT:return STOCK_PIXMAP_LINEWRAP_CURRENT;
case A_LINEWRAP_ALL: return STOCK_PIXMAP_LINEWRAP_ALL;
case A_ADDRBOOK: return STOCK_PIXMAP_ADDRESS_BOOK;
- case A_CANCEL_INC: return STOCK_PIXMAP_NOTICE_ERROR;
+ case A_CANCEL_INC: return STOCK_PIXMAP_CANCEL;
case A_EXECUTE: return STOCK_PIXMAP_EXEC;
- #ifdef USE_ASPELL
+ #ifdef USE_ENCHANT
case A_CHECK_SPELLING: return STOCK_PIXMAP_CHECK_SPELLING;
#endif
default: return -1;
struct {
gint action;
} default_toolbar[] = {
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
{ A_GO_FOLDERS},
{ A_OPEN_MAIL},
{ A_SEPARATOR},
{ A_COMPOSE_EMAIL},
{ A_SEPARATOR},
{ A_REPLY_MESSAGE},
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
{ A_REPLY_ALL},
{ A_REPLY_SENDER},
#endif
{ A_FORWARD},
{ A_SEPARATOR},
{ A_TRASH},
-#ifndef MAEMO
-#if (defined(USE_SPAMASSASSIN_PLUGIN) || defined(USE_BOGOFILTER_PLUGIN))
+#ifndef GENERIC_UMPC
{ A_LEARN_SPAM},
-#endif
#endif
{ A_SEPARATOR},
{ A_GOTO_NEXT}
if (default_toolbar[i].action != A_SEPARATOR) {
- gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
+ gchar *file = NULL;
+ if (toolbar_get_icon(default_toolbar[i].action) > -1) {
+ file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
+ }
toolbar_item->file = g_strdup(file);
toolbar_item->index = default_toolbar[i].action;
struct {
gint action;
} default_toolbar[] = {
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
{ A_CLOSE},
{ A_SEPARATOR},
#endif
{ A_SENDL},
{ A_DRAFT},
{ A_SEPARATOR},
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
{ A_INSERT},
#endif
{ A_ATTACH},
if (default_toolbar[i].action != A_SEPARATOR) {
- gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
-
+ gchar *file = NULL;
+ if (toolbar_get_icon(default_toolbar[i].action) > -1) {
+ file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
+ }
toolbar_item->file = g_strdup(file);
toolbar_item->index = default_toolbar[i].action;
toolbar_item->text = g_strdup(toolbar_get_short_text(default_toolbar[i].action));
struct {
gint action;
} default_toolbar[] = {
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
{ A_CLOSE},
{ A_SEPARATOR},
#endif
{ A_FORWARD},
{ A_SEPARATOR},
{ A_TRASH},
-#ifndef MAEMO
-#if (defined(USE_SPAMASSASSIN_PLUGIN) || defined(USE_BOGOFILTER_PLUGIN))
+#ifndef GENERIC_UMPC
{ A_LEARN_SPAM},
-#endif
#endif
{ A_GOTO_NEXT}
};
ToolbarItem *toolbar_item = g_new0(ToolbarItem, 1);
if (default_toolbar[i].action != A_SEPARATOR) {
-
- gchar *file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
+ gchar *file = NULL;
+ if (toolbar_get_icon(default_toolbar[i].action) > -1) {
+ file = stock_pixmap_get_name((StockPixmap)toolbar_get_icon(default_toolbar[i].action));
+ }
toolbar_item->file = g_strdup(file);
toolbar_item->index = default_toolbar[i].action;
} else if (xml_compare_tag(file, TOOLBAR_TAG_SEPARATOR)) {
ToolbarItem *item = g_new0(ToolbarItem, 1);
- item->file = g_strdup(toolbar_ret_descr_from_val(A_SEPARATOR));
+ item->file = g_strdup(TOOLBAR_TAG_SEPARATOR);
item->index = A_SEPARATOR;
toolbar_config[source].item_list =
g_slist_append(toolbar_config[source].item_list, item);
toolbar_item);
}
-void toolbar_action_execute(GtkWidget *widget,
+static void toolbar_action_execute(GtkWidget *widget,
GSList *action_list,
gpointer data,
gint source)
{
- GSList *cur, *lop;
- gchar *action, *action_p;
- gboolean found = FALSE;
+ GSList *cur;
gint i = 0;
for (cur = action_list; cur != NULL; cur = cur->next) {
- ToolbarSylpheedActions *act = (ToolbarSylpheedActions*)cur->data;
+ ToolbarClawsActions *act = (ToolbarClawsActions*)cur->data;
if (widget == act->widget) {
-
- for (lop = prefs_common.actions_list; lop != NULL; lop = lop->next) {
- action = g_strdup((gchar*)lop->data);
-
- action_p = strstr(action, ": ");
- action_p[0] = 0x00;
- if (g_utf8_collate(act->name, action) == 0) {
- found = TRUE;
- g_free(action);
- break;
- } else
- i++;
- g_free(action);
- }
- if (found)
+ i = prefs_actions_find_by_name(act->name);
+
+ if (i != -1)
break;
}
}
- if (found)
+ if (i != -1)
actions_execute(data, i, widget, source);
else
g_warning ("Error: did not find Claws Action to execute");
}
+gboolean toolbar_check_action_btns(ToolbarType type)
+{
+ GSList *temp, *curr, *list = toolbar_config[type].item_list;
+ gboolean modified = FALSE;
+
+ curr = list;
+ while (curr != NULL) {
+ ToolbarItem *toolbar_item = (ToolbarItem *) curr->data;
+ temp = curr;
+ curr = curr->next;
+
+ if (toolbar_item->index != A_CLAWS_ACTIONS)
+ continue;
+
+ if (prefs_actions_find_by_name(toolbar_item->text) == -1) {
+ list = g_slist_delete_link(list, temp);
+ g_free(toolbar_item->file);
+ g_free(toolbar_item->text);
+ g_free(toolbar_item);
+ modified = TRUE;
+ }
+ }
+
+ return modified;
+}
+
+#if !(GTK_CHECK_VERSION(2,12,0))
+#define CLAWS_SET_TOOL_ITEM_TIP(widget,tip) { \
+ gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(widget), GTK_TOOLTIPS(toolbar_tips), \
+ tip, NULL); \
+}
+#else
+#define CLAWS_SET_TOOL_ITEM_TIP(widget,tip) { \
+ gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), tip); \
+}
+#endif
+
+#if !(GTK_CHECK_VERSION(2,12,0))
+#define CLAWS_SET_ARROW_TIP(widget,tip) { \
+ gtk_menu_tool_button_set_arrow_tooltip(GTK_MENU_TOOL_BUTTON(widget), GTK_TOOLTIPS(toolbar_tips), \
+ tip, NULL); \
+}
+#else
+#define CLAWS_SET_ARROW_TIP(widget,tip) { \
+ gtk_menu_tool_button_set_arrow_tooltip_text(GTK_MENU_TOOL_BUTTON(widget), tip); \
+}
+#endif
+
static void activate_compose_button (Toolbar *toolbar,
ToolbarStyle style,
ComposeButtonType type)
{
+#if !(GTK_CHECK_VERSION(2,12,0))
+ GtkTooltips *toolbar_tips = toolbar->tooltips;
+#endif
if ((!toolbar->compose_mail_btn))
return;
gtk_tool_button_set_icon_widget(
GTK_TOOL_BUTTON(toolbar->compose_mail_btn),
toolbar->compose_news_icon);
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolbar->compose_mail_btn), GTK_TOOLTIPS(toolbar->tooltips),
- _("Compose News message"), NULL);
+#ifndef GENERIC_UMPC
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(toolbar->compose_mail_btn), _("Compose News message"));
+#endif
gtk_widget_show(toolbar->compose_news_icon);
} else {
gtk_tool_button_set_icon_widget(
GTK_TOOL_BUTTON(toolbar->compose_mail_btn),
toolbar->compose_mail_icon);
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolbar->compose_mail_btn), GTK_TOOLTIPS(toolbar->tooltips),
- _("Compose Email"), NULL);
+#ifndef GENERIC_UMPC
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(toolbar->compose_mail_btn), _("Compose Email"));
+#endif
gtk_widget_show(toolbar->compose_mail_icon);
}
toolbar->compose_btn_type = type;
ToolbarStyle style,
LearnButtonType type)
{
+#if !(GTK_CHECK_VERSION(2,12,0))
+ GtkTooltips *toolbar_tips = toolbar->tooltips;
+#endif
if ((!toolbar->learn_spam_btn))
return;
gtk_tool_button_set_label(
GTK_TOOL_BUTTON(toolbar->learn_spam_btn),
_("Spam"));
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolbar->learn_spam_btn), GTK_TOOLTIPS(toolbar->tooltips),
- _("Learn spam"), NULL);
+#ifndef GENERIC_UMPC
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(toolbar->learn_spam_btn), _("Learn spam"));
+#endif
gtk_widget_show(toolbar->learn_spam_icon);
} else {
gtk_tool_button_set_icon_widget(
gtk_tool_button_set_label(
GTK_TOOL_BUTTON(toolbar->learn_spam_btn),
_("Ham"));
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolbar->learn_spam_btn), GTK_TOOLTIPS(toolbar->tooltips),
- _("Learn ham"), NULL);
+#ifndef GENERIC_UMPC
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(toolbar->learn_spam_btn), _("Learn ham"));
+#endif
gtk_widget_show(toolbar->learn_ham_icon);
}
toolbar->learn_btn_type = type;
GList *list;
GList *cur;
- g_return_if_fail(mainwin != NULL);
+ cm_return_if_fail(mainwin != NULL);
toolbar_style(TOOLBAR_MAIN, action, mainwin);
Compose *compose = (Compose*)data;
MessageView *msgview = (MessageView*)data;
- g_return_if_fail(data != NULL);
+ cm_return_if_fail(data != NULL);
switch (type) {
case TOOLBAR_MAIN:
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
{
MainWindow *mainwin = get_mainwin(data);
- g_return_if_fail(mainwin != NULL);
+ cm_return_if_fail(mainwin != NULL);
summary_execute(mainwin->summaryview);
}
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
- g_return_if_fail(toolbar_item->parent);
+ cm_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item->parent);
switch (toolbar_item->type) {
case TOOLBAR_MSGVIEW:
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
- g_return_if_fail(toolbar_item->parent);
+ cm_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item->parent);
switch (toolbar_item->type) {
case TOOLBAR_MSGVIEW:
MainWindow *mainwin;
MessageView *msgview;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
MainWindow *mainwin;
MessageView *msgview;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
MainWindow *mainwin;
MessageView *msgview;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
*/
static void toolbar_reply_cb(GtkWidget *widget, gpointer data)
{
- toolbar_reply(data, prefs_common.reply_with_quote ?
- COMPOSE_REPLY_WITH_QUOTE : COMPOSE_REPLY_WITHOUT_QUOTE);
+ 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)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_ALL_WITH_QUOTE
- : COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE);
+ (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)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_LIST_WITH_QUOTE
- : COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE);
+ (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)
{
toolbar_reply(data,
- prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
- : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE);
+ (prefs_common.reply_with_quote ? COMPOSE_REPLY_TO_SENDER_WITH_QUOTE
+ : COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE));
}
/*
ToolbarItem *toolbar_item = (ToolbarItem*)data;
Compose *compose;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
*/
static void toolbar_forward_cb(GtkWidget *widget, gpointer data)
{
- toolbar_reply(data, COMPOSE_FORWARD);
+ toolbar_reply(data, (COMPOSE_FORWARD));
}
/*
MainWindow *mainwin;
MessageView *msgview;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
/* Now we need to update the messageview window */
if (msgview->mainwin->summaryview->selected) {
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
MsgInfo * msginfo = summary_get_selected_msg(msgview->mainwin->summaryview);
if (msginfo)
MainWindow *mainwin;
MessageView *msgview;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
/* Now we need to update the messageview window */
if (msgview->mainwin->summaryview->selected) {
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
MsgInfo * msginfo = summary_get_selected_msg(msgview->mainwin->summaryview);
if (msginfo)
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
inc_cancel_all();
imap_cancel_all();
}
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
MessageView *messageview;
Compose *compose;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
}
}
+static void toolbar_preferences_cb(GtkWidget *widget, gpointer data)
+{
+ prefs_gtk_open();
+}
+
static void toolbar_open_mail_cb(GtkWidget *widget, gpointer data)
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
compose_toolbar_cb(A_LINEWRAP_ALL, data);
}
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
static void toolbar_check_spelling_cb(GtkWidget *widget, gpointer data)
{
compose_toolbar_cb(A_CHECK_SPELLING, data);
MessageView *msgview;
gpointer parent = toolbar_item->parent;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
toolbar_action_execute(widget, action_list, parent, toolbar_item->type);
}
+static void toolbar_plugins_execute_cb(GtkWidget *widget, gpointer data)
+{
+ ToolbarItem *toolbar_item = data;
+ prefs_toolbar_execute_plugin_item(toolbar_item->parent, toolbar_item->type, toolbar_item->text);
+}
+
static MainWindow *get_mainwin(gpointer data)
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
MainWindow *mainwin = NULL;
MessageView *msgview;
- g_return_val_if_fail(toolbar_item != NULL, NULL);
+ cm_return_val_if_fail(toolbar_item != NULL, NULL);
switch(toolbar_item->type) {
case TOOLBAR_MAIN:
{ A_DRAFT, toolbar_draft_cb },
{ A_OPEN_MAIL, toolbar_open_mail_cb },
{ A_CLOSE, toolbar_close_cb },
+ { A_PREFERENCES, toolbar_preferences_cb },
{ A_INSERT, toolbar_insert_cb },
{ A_ATTACH, toolbar_attach_cb },
{ A_SIG, toolbar_sig_cb },
{ A_LINEWRAP_CURRENT, toolbar_linewrap_current_cb },
{ A_LINEWRAP_ALL, toolbar_linewrap_all_cb },
{ A_ADDRBOOK, toolbar_addrbook_cb },
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
{ A_CHECK_SPELLING, toolbar_check_spelling_cb },
#endif
- { A_SYL_ACTIONS, toolbar_actions_execute_cb },
- { A_CANCEL_INC, toolbar_cancel_inc_cb }
+ { A_CLAWS_ACTIONS, toolbar_actions_execute_cb },
+ { A_CANCEL_INC, toolbar_cancel_inc_cb },
+ { A_CLAWS_PLUGINS, toolbar_plugins_execute_cb },
};
num_items = sizeof(callbacks)/sizeof(callbacks[0]);
}
}
}
+#ifndef GENERIC_UMPC
+#define TOOLBAR_ITEM(item,icon,text,tooltip) { \
+ item = GTK_WIDGET(gtk_tool_button_new(icon, text)); \
+ gtkut_widget_set_can_focus(gtk_bin_get_child(GTK_BIN(item)), FALSE); \
+ gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(item), FALSE); \
+ gtk_tool_item_set_is_important(GTK_TOOL_ITEM(item), TRUE); \
+ g_signal_connect (G_OBJECT(item), "clicked", G_CALLBACK(toolbar_buttons_cb), toolbar_item); \
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); \
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(item), \
+ tooltip); \
+}
+#define TOOLBAR_MENUITEM(item,icon,text,tooltip,menutip) { \
+ GtkWidget *child = NULL, *btn = NULL, *arr = NULL; \
+ GList *gchild = NULL; \
+ item = GTK_WIDGET(gtk_menu_tool_button_new(icon, text)); \
+ gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(item), FALSE); \
+ gtk_tool_item_set_is_important(GTK_TOOL_ITEM(item), TRUE); \
+ g_signal_connect (G_OBJECT(item), "clicked", G_CALLBACK(toolbar_buttons_cb), toolbar_item); \
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); \
+ CLAWS_SET_TOOL_ITEM_TIP(GTK_TOOL_ITEM(item), \
+ tooltip); \
+ CLAWS_SET_ARROW_TIP(GTK_MENU_TOOL_BUTTON(item), menutip); \
+ child = gtk_bin_get_child(GTK_BIN(item)); \
+ gchild = gtk_container_get_children( \
+ GTK_CONTAINER(child)); \
+ btn = (GtkWidget *)gchild->data; \
+ gtkut_widget_set_can_focus(btn, FALSE); \
+ arr = (GtkWidget *)(gchild->next?gchild->next->data:NULL); \
+ gtkut_widget_set_can_focus(arr, FALSE); \
+ g_list_free(gchild); \
+ gchild = gtk_container_get_children(GTK_CONTAINER(arr)); \
+ gtk_widget_set_size_request(GTK_WIDGET(gchild->data), 9, -1); \
+ g_list_free(gchild); \
+}
+#else
#define TOOLBAR_ITEM(item,icon,text,tooltip) { \
item = GTK_WIDGET(gtk_tool_button_new(icon, text)); \
+ gtkut_widget_set_can_focus(gtk_bin_get_child(GTK_BIN(item)), FALSE); \
gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(item), FALSE); \
gtk_tool_item_set_is_important(GTK_TOOL_ITEM(item), TRUE); \
g_signal_connect (G_OBJECT(item), "clicked", G_CALLBACK(toolbar_buttons_cb), toolbar_item); \
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); \
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(item), GTK_TOOLTIPS(toolbar_tips), \
- tooltip, NULL); \
}
#define TOOLBAR_MENUITEM(item,icon,text,tooltip,menutip) { \
gtk_tool_item_set_is_important(GTK_TOOL_ITEM(item), TRUE); \
g_signal_connect (G_OBJECT(item), "clicked", G_CALLBACK(toolbar_buttons_cb), toolbar_item); \
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); \
- gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(item), GTK_TOOLTIPS(toolbar_tips), \
- tooltip, NULL); \
- gtk_menu_tool_button_set_arrow_tooltip(GTK_MENU_TOOL_BUTTON(item), \
- GTK_TOOLTIPS(toolbar_tips), menutip, NULL); \
child = gtk_bin_get_child(GTK_BIN(item)); \
gchild = gtk_container_get_children( \
GTK_CONTAINER(child)); \
btn = (GtkWidget *)gchild->data; \
+ gtkut_widget_set_can_focus(btn, FALSE); \
arr = (GtkWidget *)(gchild->next?gchild->next->data:NULL); \
+ gtkut_widget_set_can_focus(arr, FALSE); \
g_list_free(gchild); \
gchild = gtk_container_get_children(GTK_CONTAINER(arr)); \
gtk_widget_set_size_request(GTK_WIDGET(gchild->data), 9, -1); \
g_list_free(gchild); \
}
+#endif
+
+#define ADD_MENU_ITEM(name,cb,data) { \
+ item = gtk_menu_item_new_with_mnemonic(name); \
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); \
+ g_signal_connect(G_OBJECT(item), "activate", \
+ G_CALLBACK(cb), \
+ toolbar_item); \
+ g_object_set_data(G_OBJECT(item), "int-value", GINT_TO_POINTER(data)); \
+ gtk_widget_show(item); \
+}
+
+static void toolbar_reply_menu_cb(GtkWidget *widget, gpointer data)
+{
+ gpointer int_value = g_object_get_data(G_OBJECT(widget), "int-value");
+ ToolbarItem *toolbar_item = (ToolbarItem *)data;
+
+ toolbar_reply(toolbar_item, GPOINTER_TO_INT(int_value));
+}
-#define MAKE_MENU(entries,path,btn) { \
- n_menu_entries = sizeof(entries) / \
- sizeof(entries[0]); \
- menu = menu_create_items(entries, n_menu_entries, path, &factory, toolbar_item); \
- gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(btn), menu); \
+static void toolbar_learn_menu_cb(GtkWidget *widget, gpointer data)
+{
+ gpointer int_value = g_object_get_data(G_OBJECT(widget), "int-value");
+ ToolbarItem *toolbar_item = (ToolbarItem *)data;
+
+ toolbar_learn(toolbar_item, GPOINTER_TO_INT(int_value));
}
/**
GtkWidget *icon_news;
GtkWidget *icon_ham;
GtkWidget *item;
- GtkWidget *menu;
- guint n_menu_entries;
- GtkItemFactory *factory;
- GtkTooltips *toolbar_tips;
- ToolbarSylpheedActions *action_item;
+ ToolbarClawsActions *action_item;
GSList *cur;
GSList *toolbar_list;
Toolbar *toolbar_data;
-
-
- toolbar_tips = gtk_tooltips_new();
-
+ GtkWidget *menu;
+#ifndef GENERIC_UMPC
+#if !(GTK_CHECK_VERSION(2,12,0))
+ GtkTooltips *toolbar_tips = gtk_tooltips_new();
+#endif
+#endif
toolbar_read_config_file(type);
toolbar_list = toolbar_get_list(type);
toolbar = gtk_toolbar_new();
+#if (GTK_CHECK_VERSION(2,16,0))
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), GTK_ORIENTATION_HORIZONTAL);
+#else
gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL);
+#endif
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_BOTH);
gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE);
break;
case A_RECEIVE_ALL:
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
- _("Receive Mail on all Accounts"),
- _("Receive Mail on selected Account"));
+ _("Receive Mail from all Accounts"),
+ _("Receive Mail from selected Account"));
toolbar_data->getall_btn = item;
break;
case A_RECEIVE_CUR:
- TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, _("Receive Mail on current Account"));
+ TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, _("Receive Mail from current Account"));
toolbar_data->get_btn = item;
break;
case A_SEND_QUEUED:
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Close window"));
toolbar_data->close_window_btn = item;
break;
+ case A_PREFERENCES:
+ TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Open preferences"));
+ toolbar_data->preferences_btn = item;
+ break;
case A_OPEN_MAIL:
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Open email"));
toolbar_data->open_mail_btn = item;
break;
case A_COMPOSE_EMAIL:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Compose Email"),
_("Compose with selected Account"));
toolbar_data->learn_ham_icon = icon_ham;
g_object_ref(toolbar_data->learn_ham_icon);
- MAKE_MENU(learn_entries,"<LearnSpam>",toolbar_data->learn_spam_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("Learn as _Spam"), toolbar_learn_menu_cb, TRUE);
+ ADD_MENU_ITEM(_("Learn as _Ham"), toolbar_learn_menu_cb, FALSE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->learn_spam_btn), menu);
break;
case A_REPLY_MESSAGE:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Reply to Message"),
_("Reply to Message options"));
toolbar_data->reply_btn = item;
- MAKE_MENU(reply_entries,"<Reply>",toolbar_data->reply_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->reply_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Message"));
#endif
break;
case A_REPLY_SENDER:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Reply to Sender"),
_("Reply to Sender options"));
toolbar_data->replysender_btn = item;
- MAKE_MENU(replysender_entries,"<ReplySender>",toolbar_data->replysender_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_SENDER_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replysender_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Sender"));
#endif
break;
case A_REPLY_ALL:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Reply to All"),
_("Reply to All options"));
toolbar_data->replyall_btn = item;
- MAKE_MENU(replyall_entries,"<ReplyAll>",toolbar_data->replyall_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_ALL_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replyall_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to All"));
#endif
break;
case A_REPLY_ML:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Reply to Mailing-list"),
_("Reply to Mailing-list options"));
toolbar_data->replylist_btn = item;
- MAKE_MENU(replylist_entries,"<ReplyList>",toolbar_data->replylist_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Reply with quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_LIST_WITH_QUOTE);
+ ADD_MENU_ITEM(_("Reply without _quote"), toolbar_reply_menu_cb, COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->replylist_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Reply to Mailing-list"));
#endif
break;
case A_FORWARD:
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
_("Forward Message"),
_("Forward Message options"));
toolbar_data->fwd_btn = item;
- MAKE_MENU(forward_entries,"<Forward>",toolbar_data->fwd_btn);
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("_Forward"), toolbar_reply_menu_cb, COMPOSE_FORWARD_INLINE);
+ ADD_MENU_ITEM(_("For_ward as attachment"), toolbar_reply_menu_cb, COMPOSE_FORWARD_AS_ATTACH);
+ ADD_MENU_ITEM(_("Redirec_t"), toolbar_reply_menu_cb, COMPOSE_REDIRECT);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->fwd_btn), menu);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Forward Message"));
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Address book"));
toolbar_data->addrbook_btn = item;
break;
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
case A_CHECK_SPELLING:
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Check spelling"));
toolbar_data->spellcheck_btn = item;
break;
#endif
- case A_SYL_ACTIONS:
+ case A_CLAWS_ACTIONS:
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,toolbar_item->text);
- action_item = g_new0(ToolbarSylpheedActions, 1);
+ action_item = g_new0(ToolbarClawsActions, 1);
action_item->widget = item;
action_item->name = g_strdup(toolbar_item->text);
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Cancel receiving"));
toolbar_data->cancel_inc_btn = item;
break;
+ case A_CLAWS_PLUGINS:
+ TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, toolbar_item->text);
+ break;
default:
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
toolbar_ret_descr_from_val(toolbar_item->index));
}
toolbar_data->toolbar = toolbar;
+#ifndef GENERIC_UMPC
+#if !(GTK_CHECK_VERSION(2,12,0))
toolbar_data->tooltips = toolbar_tips;
+#endif
+#endif
gtk_widget_show_all(toolbar);
if (type == TOOLBAR_MAIN) {
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
MainWindow *mainwin = mainwindow_get_mainwindow();
GtkWidget *progressbar = gtk_progress_bar_new();
- item = gtk_tool_item_new();
+ item = GTK_WIDGET(gtk_tool_item_new());
gtk_container_add (GTK_CONTAINER (item), progressbar);
gtk_widget_show(item);
- gtk_widget_show(progressbar);
- gtk_widget_set_size_request(progressbar, 70, -1);
- gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1); \
+ gtk_widget_set_size_request(progressbar, 84, -1);
+ gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1);
mainwin->progressbar = progressbar;
#endif
activate_compose_button(toolbar_data,
#ifndef MAEMO
gtk_container_add(GTK_CONTAINER(container), toolbar);
- gtk_container_set_border_width(GTK_CONTAINER(container), 2);
+ gtk_container_set_border_width(GTK_CONTAINER(container), 0);
#else
if ( GTK_IS_WINDOW(container) ) {
hildon_window_add_toolbar (HILDON_WINDOW(container), GTK_TOOLBAR(toolbar));
Compose *compose = (Compose*)data;
MessageView *msgview = (MessageView*)data;
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
switch(type) {
case TOOLBAR_MAIN:
toolbar_data = mainwin->toolbar;
default:
return;
}
-
- hildon_window_remove_toolbar(HILDON_WINDOW(handlebox), GTK_WIDGET(toolbar_data->toolbar));
-
+#ifdef MAEMO
+ hildon_window_remove_toolbar(HILDON_WINDOW(handlebox), GTK_TOOLBAR(toolbar_data->toolbar));
+#endif
toolbar_init(toolbar_data);
toolbar_data = toolbar_create(type, handlebox, data);
#endif
}
}
+#if !GTK_CHECK_VERSION(2,14,0)
+/* Work around http://bugzilla.gnome.org/show_bug.cgi?id=56070 */
#define GTK_BUTTON_SET_SENSITIVE(widget,sensitive) { \
gboolean in_btn1 = FALSE, in_btn2 = FALSE; \
if (GTK_IS_BUTTON(widget)) \
GTK_BUTTON(child)->in_button = in_btn1; \
} \
}
+#else
+#define GTK_BUTTON_SET_SENSITIVE(widget,sensitive) { \
+ gtk_widget_set_sensitive(widget, sensitive); \
+}
+#endif
void toolbar_main_set_sensitive(gpointer data)
{
if (toolbar->get_btn)
SET_WIDGET_COND(toolbar->get_btn,
- M_HAVE_ACCOUNT|M_UNLOCKED);
+ M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT);
if (toolbar->getall_btn) {
SET_WIDGET_COND(toolbar->getall_btn,
- M_HAVE_ACCOUNT|M_UNLOCKED);
+ M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
}
if (toolbar->send_btn) {
SET_WIDGET_COND(toolbar->send_btn,
}
if (toolbar->open_mail_btn) {
SET_WIDGET_COND(toolbar->open_mail_btn,
- M_TARGET_EXIST);
+ M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (toolbar->reply_btn) {
SET_WIDGET_COND(toolbar->reply_btn,
- M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (toolbar->replyall_btn) {
SET_WIDGET_COND(toolbar->replyall_btn,
- M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (toolbar->replylist_btn) {
SET_WIDGET_COND(toolbar->replylist_btn,
- M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (toolbar->replysender_btn) {
SET_WIDGET_COND(toolbar->replysender_btn,
- M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (toolbar->fwd_btn) {
SET_WIDGET_COND(toolbar->fwd_btn,
- M_HAVE_ACCOUNT|M_TARGET_EXIST);
+ M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST);
}
if (prefs_common.next_unread_msg_dialog == NEXTUNREADMSGDIALOG_ASSUME_NO) {
- SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST);
+ SET_WIDGET_COND(toolbar->next_btn, M_MSG_EXIST|M_SUMMARY_ISLIST);
} else {
SET_WIDGET_COND(toolbar->next_btn, 0);
}
if (toolbar->trash_btn)
SET_WIDGET_COND(toolbar->trash_btn,
- M_TARGET_EXIST|M_ALLOW_DELETE);
+ M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS);
if (toolbar->delete_btn)
SET_WIDGET_COND(toolbar->delete_btn,
SET_WIDGET_COND(toolbar->exec_btn,
M_DELAY_EXEC);
-/* if (toolbar->learn_ham_btn)
- SET_WIDGET_COND(toolbar->learn_ham_btn,
- M_TARGET_EXIST|M_CAN_LEARN_SPAM);
-*/
if (toolbar->learn_spam_btn)
SET_WIDGET_COND(toolbar->learn_spam_btn,
- M_TARGET_EXIST|M_CAN_LEARN_SPAM);
+ M_TARGET_EXIST|M_CAN_LEARN_SPAM|M_SUMMARY_ISLIST);
if (toolbar->cancel_inc_btn)
SET_WIDGET_COND(toolbar->cancel_inc_btn,
M_INC_ACTIVE);
for (cur = toolbar->action_list; cur != NULL; cur = cur->next) {
- ToolbarSylpheedActions *act = (ToolbarSylpheedActions*)cur->data;
+ ToolbarClawsActions *act = (ToolbarClawsActions*)cur->data;
SET_WIDGET_COND(act->widget, M_TARGET_EXIST|M_UNLOCKED);
}
GTK_BUTTON_SET_SENSITIVE(compose->toolbar->linewrap_all_btn, sensitive);
if (compose->toolbar->addrbook_btn)
GTK_BUTTON_SET_SENSITIVE(compose->toolbar->addrbook_btn, sensitive);
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
if (compose->toolbar->spellcheck_btn)
GTK_BUTTON_SET_SENSITIVE(compose->toolbar->spellcheck_btn, sensitive);
#endif
for (; items != NULL; items = g_slist_next(items)) {
- ToolbarSylpheedActions *item = (ToolbarSylpheedActions *)items->data;
+ ToolbarClawsActions *item = (ToolbarClawsActions *)items->data;
GTK_BUTTON_SET_SENSITIVE(item->widget, sensitive);
}
}
/**
* Initialize toolbar structure
**/
-void toolbar_init(Toolbar * toolbar) {
+static void toolbar_init(Toolbar * toolbar)
+{
toolbar->toolbar = NULL;
toolbar->folders_btn = NULL;
toolbar->linewrap_current_btn = NULL;
toolbar->linewrap_all_btn = NULL;
toolbar->addrbook_btn = NULL;
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
toolbar->spellcheck_btn = NULL;
#endif
MessageView *msgview;
GSList *msginfo_list = NULL;
- g_return_if_fail(toolbar_item != NULL);
+ cm_return_if_fail(toolbar_item != NULL);
switch (toolbar_item->type) {
case TOOLBAR_MAIN:
break;
case TOOLBAR_MSGVIEW:
msgview = (MessageView*)toolbar_item->parent;
- g_return_if_fail(msgview != NULL);
+ cm_return_if_fail(msgview != NULL);
msginfo_list = g_slist_append(msginfo_list, msgview->msginfo);
break;
default:
return;
}
- g_return_if_fail(msgview != NULL);
- g_return_if_fail(msginfo_list != NULL);
+ cm_return_if_fail(msgview != NULL);
+ cm_return_if_fail(msginfo_list != NULL);
compose_reply_from_messageview(msgview, msginfo_list, action);
g_slist_free(msginfo_list);