/*
Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+ Copyright (C) 1999-2013 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
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <string.h>
+#include <stdarg.h>
#include "main.h"
#include "mainwindow.h"
#include "folderview.h"
+#include "folder_item_prefs.h"
#include "foldersel.h"
#include "summaryview.h"
#include "summary_search.h"
#include "messageview.h"
+#include "mimeview.h"
#include "message_search.h"
#include "headerview.h"
#include "menu.h"
#include "prefs_template.h"
#include "action.h"
#include "account.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "logwindow.h"
#include "manage_window.h"
#include "alertpanel.h"
#include "tags.h"
#include "textview.h"
#include "imap.h"
+#include "news.h"
#include "socket.h"
#include "printing.h"
+#include "send_message.h"
#ifdef G_OS_WIN32
#include "w32lib.h"
#endif
static void inc_cancel_cb (GtkAction *action,
gpointer data);
+static void send_cancel_cb (GtkAction *action,
+ gpointer data);
static void open_msg_cb (GtkAction *action,
gpointer data);
gpointer data);
static void toggle_fullscreen_cb (GtkAction *action,
gpointer data);
+static void toggle_menubar_cb (GtkAction *action,
+ gpointer data);
static void hide_quotes_cb(GtkAction *action,
gpointer data);
gpointer data);
static void next_labeled_cb (GtkAction *action,
gpointer data);
-static void last_read_cb (GtkAction *action,
+static void prev_history_cb (GtkAction *action,
+ gpointer data);
+static void next_history_cb (GtkAction *action,
gpointer data);
static void parent_cb (GtkAction *action,
gpointer data);
static gint mailing_list_populate_submenu(GtkWidget *menu, const gchar * list_header);
-static void get_url_part(const gchar **buf, gchar *url_decoded, gint maxlen);
+static void get_url_part(const gchar **buf, gchar *url_decoded);
static void mailing_list_compose(GtkWidget *w, gpointer *data);
gpointer data);
static gboolean any_folder_want_synchronise(void);
+static void save_part_as_cb(GtkAction *action, gpointer data);
+static void view_part_as_text_cb(GtkAction *action, gpointer data);
+static void open_part_cb(GtkAction *action, gpointer data);
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data);
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data);
+static void goto_next_part_cb(GtkAction *action, gpointer data);
+static void goto_prev_part_cb(GtkAction *action, gpointer data);
#define DO_ACTION(name, act) { if (!strcmp(a_name, name)) action = act; }
static void mainwindow_nothing_cb (GtkAction *action, gpointer data)
{"File/EmptyTrashes", NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
/* {"File/---", NULL, "---" }, */
- {"File/SaveAs", NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+ {"File/SaveAs", NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+ {"File/SavePartAs", NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
+ /* {"File/---", NULL, "---" }, */
{"File/PageSetup", NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
{"File/Print", NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
{"View/ShowHide/Toolbar", NULL, N_("_Toolbar") },
{"View/SetColumns", NULL, N_("Set displayed _columns") },
- {"View/SetColumns/Folderlist", NULL, N_("in _Folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
- {"View/SetColumns/Messagelist", NULL, N_("in _Message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
+ {"View/SetColumns/Folderlist", NULL, N_("In _folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
+ {"View/SetColumns/Messagelist", NULL, N_("In _message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
{"View/---", NULL, "---" },
{"View/Goto/PrevLabeled", NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) },
{"View/Goto/NextLabeled", NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) },
/* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
- {"View/Goto/LastRead", NULL, N_("Last read message"), NULL, NULL, G_CALLBACK(last_read_cb) },
+ {"View/Goto/PrevHistory", NULL, N_("Previous opened message"), "<alt>Left", NULL, G_CALLBACK(prev_history_cb) },
+ {"View/Goto/NextHistory", NULL, N_("Next opened message"), "<alt>Right", NULL, G_CALLBACK(next_history_cb) },
+ /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
{"View/Goto/ParentMessage", NULL, N_("Parent message"), "<control>Up", NULL, G_CALLBACK(parent_cb) },
/* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
{"View/Goto/NextUnreadFolder", NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
{"View/Goto/OtherFolder", NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
+ /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */
+ {"View/Goto/NextPart", NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
+ {"View/Goto/PrevPart", NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
/* {"View/Scroll/---", NULL, "---", NULL, NULL, NULL }, */
- {"View/Scroll", NULL, N_("Message Scroll") },
+ {"View/Scroll", NULL, N_("Message scroll") },
{"View/Scroll/PrevLine", NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
{"View/Scroll/NextLine", NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
{"View/Scroll/PrevPage", NULL, N_("Previous page"), NULL, NULL, G_CALLBACK(scroll_prev_page_cb) },
/* {"View/---", NULL, "---", NULL, NULL, NULL }, */
{"View/OpenNewWindow", NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
{"View/MessageSource", NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
+ /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
+ {"View/Part", NULL, N_("Message part") },
+ {"View/Part/AsText", NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
+ {"View/Part/Open", NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
+#ifndef G_OS_WIN32
+ {"View/Part/OpenWith", NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
+#endif
+ /* {"View/---", NULL, "---", NULL, NULL, NULL }, */
+
{"View/Quotes", NULL, N_("Quotes") },
/* {"View/---", NULL, "---", NULL, NULL, NULL }, */
{"View/UpdateSummary", NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
{"Message/Receive/---", NULL, "---" },
{"Message/Receive/PlaceHolder", NULL, "PlaceHolder,", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
{"Message/SendQueue", NULL, N_("_Send queued messages"), NULL, NULL, G_CALLBACK(mw_send_queue_cb) },
+ {"Message/CancelSending", NULL, N_("Cancel sending"), NULL, NULL, G_CALLBACK(send_cancel_cb) },
{"Message/---", NULL, "---" },
{"Message/Reply", NULL, N_("_Reply"), "<control>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY */
{"Message/ReplyTo", NULL, N_("Repl_y to") },
- {"Message/ReplyTo/All", NULL, N_("_all"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
- {"Message/ReplyTo/Sender", NULL, N_("_sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
- {"Message/ReplyTo/List", NULL, N_("mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
+ {"Message/ReplyTo/All", NULL, N_("_All"), "<control><shift>R", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
+ {"Message/ReplyTo/Sender", NULL, N_("_Sender"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */
+ {"Message/ReplyTo/List", NULL, N_("Mailing _list"), "<control>L", NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_REPLY_TO_LIST */
{"Message/FollowupReply", NULL, N_("Follow-up and reply to"), NULL, NULL, G_CALLBACK(main_window_reply_cb) }, /* COMPOSE_FOLLOWUP_AND_REPLY_TO */
/*{"Message/---", NULL, "---" },*/
{"Message/MailingList/ViewArchive/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
{"Message/MailingList/ContactOwner", NULL, N_("Contact owner") },
{"Message/MailingList/ContactOwner/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(mainwindow_nothing_cb) },
- /*{"Message/---", NULL, "---" },*/
+ /* separation */
{"Message/Move", NULL, N_("M_ove..."), "<control>O", NULL, G_CALLBACK(move_to_cb) },
{"Message/Copy", NULL, N_("_Copy..."), "<shift><control>O", NULL, G_CALLBACK(copy_to_cb) },
{"Message/Trash", NULL, N_("Move to _trash"), "<control>D", NULL, G_CALLBACK(delete_trash_cb) },
{"Message/Delete", NULL, N_("_Delete..."), NULL, NULL, G_CALLBACK(delete_cb) },
{"Message/CancelNews", NULL, N_("Cancel a news message"), NULL, NULL, G_CALLBACK(cancel_cb) },
- /*{"Message/---", NULL, "---" },*/
+ /* separation */
{"Message/Mark", NULL, N_("_Mark") },
{"Message/Mark/Mark", NULL, N_("_Mark"), "<shift>asterisk", NULL, G_CALLBACK(mark_cb) },
{"Message/Mark/MarkUnread", NULL, N_("Mark as unr_ead"), "<shift>exclam", NULL, G_CALLBACK(mark_as_unread_cb) },
{"Message/Mark/MarkRead", NULL, N_("Mark as rea_d"), NULL, NULL, G_CALLBACK(mark_as_read_cb) },
+ /* separation */
{"Message/Mark/MarkAllRead", NULL, N_("Mark all read"), NULL, NULL, G_CALLBACK(mark_all_read_cb) },
+ /* separation */
{"Message/Mark/IgnoreThread", NULL, N_("Ignore thread"), NULL, NULL, G_CALLBACK(ignore_thread_cb) },
{"Message/Mark/UnignoreThread", NULL, N_("Unignore thread"), NULL, NULL, G_CALLBACK(unignore_thread_cb) },
{"Message/Mark/WatchThread", NULL, N_("Watch thread"), NULL, NULL, G_CALLBACK(watch_thread_cb) },
/*{"Message/---", NULL, "---" },*/
{"Message/Reedit", NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
+ /*{"Message/---", NULL, "---" },*/
+
+ {"Message/CheckSignature", NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
/* Tools menu */
{"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) },
{"Tools/CollectAddresses", NULL, N_("C_ollect addresses") },
- {"Tools/CollectAddresses/FromFolder", NULL, N_("from Current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) },
- {"Tools/CollectAddresses/FromSelected", NULL, N_("from Selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) },
+ {"Tools/CollectAddresses/FromFolder", NULL, N_("From current _folder..."), NULL, NULL, G_CALLBACK(addr_harvest_cb) },
+ {"Tools/CollectAddresses/FromSelected", NULL, N_("From selected _messages..."), NULL, NULL, G_CALLBACK(addr_harvest_msg_cb) },
{"Tools/---", NULL, "---", NULL, NULL, NULL },
{"Tools/FilterFolder", NULL, N_("_Filter all messages in folder"), NULL, NULL, G_CALLBACK(filter_cb) },
static GtkToggleActionEntry mainwin_toggle_entries[] = {
{"File/OfflineMode", NULL, N_("Offline _mode"), "<control>W", NULL, G_CALLBACK(toggle_work_offline_cb) }, /*toggle*/
+ {"View/ShowHide/MenuBar", NULL, N_("Men_ubar"), "F12", NULL, G_CALLBACK(toggle_menubar_cb) }, /* toggle */
{"View/ShowHide/MessageView", NULL, N_("_Message view"), "V", NULL, G_CALLBACK(toggle_message_cb) }, /* toggle */
#ifndef GENERIC_UMPC
{"View/ShowHide/StatusBar", NULL, N_("Status _bar"), NULL, NULL, G_CALLBACK(toggle_statusbar_cb) }, /* toggle */
{"View/HideReadThreads", NULL, N_("Hide read threads"), NULL, NULL, G_CALLBACK(hide_read_threads) }, /* toggle */
{"View/HideReadMessages", NULL, N_("_Hide read messages"), NULL, NULL, G_CALLBACK(hide_read_messages) }, /* toggle */
{"View/HideDelMessages", NULL, N_("Hide deleted messages"), NULL, NULL, G_CALLBACK(hide_del_messages) }, /* toggle */
-#ifndef MAEMO
{"View/FullScreen", NULL, N_("_Fullscreen"), "F11", NULL, G_CALLBACK(toggle_fullscreen_cb) }, /* toggle */
-#endif
{"View/AllHeaders", NULL, N_("Show all _headers"), "<control>H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */
{"View/Quotes/CollapseAll", NULL, N_("_Collapse all"), "<control><shift>Q", NULL, G_CALLBACK(hide_quotes_cb) }, /* 1 toggle */
{"View/Quotes/Collapse2", NULL, N_("Collapse from level _2"), NULL, NULL, G_CALLBACK(hide_quotes_cb) }, /* 2 toggle */
};
#endif
static GtkRadioActionEntry mainwin_sort_radio_entries[] = { /* sort_summary_cb */
- {"View/Sort/Number", NULL, N_("by _Number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
- {"View/Sort/Size", NULL, N_("by S_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
- {"View/Sort/Date", NULL, N_("by _Date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
- {"View/Sort/ThreadDate", NULL, N_("by Thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
- {"View/Sort/From", NULL, N_("by _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
- {"View/Sort/To", NULL, N_("by _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
- {"View/Sort/Subject", NULL, N_("by S_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
- {"View/Sort/Color", NULL, N_("by _Color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
- {"View/Sort/Tag", NULL, N_("by Tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
- {"View/Sort/Mark", NULL, N_("by _Mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
- {"View/Sort/Status", NULL, N_("by _Status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
- {"View/Sort/Attachment", NULL, N_("by A_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
- {"View/Sort/Score", NULL, N_("by Score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
- {"View/Sort/Locked", NULL, N_("by Locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
+ {"View/Sort/Number", NULL, N_("By _number"), NULL, NULL, SORT_BY_NUMBER }, /* radio SORT_BY_NUMBER */
+ {"View/Sort/Size", NULL, N_("By s_ize"), NULL, NULL, SORT_BY_SIZE }, /* radio SORT_BY_SIZE */
+ {"View/Sort/Date", NULL, N_("By _date"), NULL, NULL, SORT_BY_DATE }, /* radio SORT_BY_DATE */
+ {"View/Sort/ThreadDate", NULL, N_("By thread date"), NULL, NULL, SORT_BY_THREAD_DATE }, /* radio SORT_BY_THREAD_DATE */
+ {"View/Sort/From", NULL, N_("By _From"), NULL, NULL, SORT_BY_FROM }, /* radio SORT_BY_FROM */
+ {"View/Sort/To", NULL, N_("By _To"), NULL, NULL, SORT_BY_TO }, /* radio SORT_BY_TO */
+ {"View/Sort/Subject", NULL, N_("By s_ubject"), NULL, NULL, SORT_BY_SUBJECT }, /* radio SORT_BY_SUBJECT */
+ {"View/Sort/Color", NULL, N_("By _color label"), NULL, NULL, SORT_BY_LABEL }, /* radio SORT_BY_LABEL */
+ {"View/Sort/Tag", NULL, N_("By tag"), NULL, NULL, SORT_BY_TAGS }, /* radio SORT_BY_TAGS */
+ {"View/Sort/Mark", NULL, N_("By _mark"), NULL, NULL, SORT_BY_MARK }, /* radio SORT_BY_MARK */
+ {"View/Sort/Status", NULL, N_("By _status"), NULL, NULL, SORT_BY_STATUS }, /* radio SORT_BY_STATUS */
+ {"View/Sort/Attachment", NULL, N_("By a_ttachment"), NULL, NULL, SORT_BY_MIME }, /* radio SORT_BY_MIME */
+ {"View/Sort/Score", NULL, N_("By score"), NULL, NULL, SORT_BY_SCORE }, /* radio SORT_BY_SCORE */
+ {"View/Sort/Locked", NULL, N_("By locked"), NULL, NULL, SORT_BY_LOCKED }, /* radio SORT_BY_LOCKED */
{"View/Sort/DontSort", NULL, N_("D_on't sort"), NULL, NULL, SORT_BY_NONE }, /* radio SORT_BY_NONE */
};
for (; sel != NULL; sel = sel->next) {
MsgInfo *msginfo;
GSList *tags = NULL;
- gint id;
GtkCheckMenuItem *item;
msginfo = (MsgInfo *)sel->data;
sel_len++;
for (; tags; tags = tags->next) {
gint num_checked = GPOINTER_TO_INT(g_hash_table_lookup(menu_allsel_table, tags->data));
- id = GPOINTER_TO_INT(tags->data);
item = g_hash_table_lookup(menu_table, GINT_TO_POINTER(tags->data));
if (item && !gtk_check_menu_item_get_active(item)) {
gtk_check_menu_item_set_active
GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
gchar *new_accel;
- if (keyval == GDK_KEY_BackSpace) {
+ if (keyval == GDK_KEY_Delete) {
const gchar *accel_path;
accel_path = gtk_menu_item_get_accel_path(item);
keyval = 0; modifier = 0;
g_free(new_accel);
}
}
+ g_list_free(closures);
}
static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refresh)
accel_path = g_strdup_printf("<ClawsColorLabels>/None");
gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
g_free(accel_path);
- gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_0, GDK_CONTROL_MASK);
-
+ gtk_accel_map_add_entry("<ClawsColorLabels>/None", GDK_KEY_0, GDK_CONTROL_MASK);
item = gtk_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
gtk_widget_show(item);
accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
if (i < 9)
- gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
+ gtk_accel_map_add_entry(accel_path, GDK_KEY_1+i, GDK_CONTROL_MASK);
g_free(accel_path);
g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager),
"accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
return tag_b == NULL ? 0:1;
if (tag_b == NULL)
- return tag_a == NULL ? 0:1;
+ return 1;
return g_utf8_collate(tag_a, tag_b);
}
accel_path = g_strdup_printf("<ClawsTags>/ApplyTags");
gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
g_free(accel_path);
- gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
-
+ gtk_accel_map_add_entry("<ClawsTags>/ApplyTags", GDK_KEY_T, GDK_CONTROL_MASK|GDK_SHIFT_MASK);
g_slist_free(orig);
gtk_widget_show(menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
switch (event->keyval) {
case GDK_KEY_Q: /* Quit */
-#ifndef MAEMO
BREAK_ON_MODIFIER_KEY();
if (gtk_window_is_active(GTK_WINDOW(mainwin->window))) {
app_exit_cb(NULL, mainwin);
}
-#endif
return FALSE;
case GDK_KEY_space:
BREAK_ON_MODIFIER_KEY();
&& mainwin->summaryview->folder_item->total_msgs == 0))) {
g_signal_stop_emission_by_name(G_OBJECT(widget),
"key_press_event");
- folderview_select_next_unread(mainwin->folderview, TRUE);
- }
- }
- break;
-
-#ifdef MAEMO
- case GDK_KEY_F6:
- if (maemo_mainwindow_is_fullscreen(widget)) {
- gtk_window_unfullscreen(GTK_WINDOW(widget));
- } else {
- gtk_window_fullscreen(GTK_WINDOW(widget));
- }
- break;
- case GDK_KEY_F7:
- {
- PangoFontDescription *font_desc;
- int size;
- font_desc = pango_font_description_from_string(prefs_common.normalfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size < 30) {
- size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.normalfont);
- prefs_common.normalfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
- font_desc = pango_font_description_from_string(prefs_common.textfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size < 30) {
- size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.textfont);
- prefs_common.textfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
- }
- break;
- case GDK_KEY_F8:
- {
- PangoFontDescription *font_desc;
- int size;
- font_desc = pango_font_description_from_string(prefs_common.normalfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size > 5) {
- size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.normalfont);
- prefs_common.normalfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
- font_desc = pango_font_description_from_string(prefs_common.textfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size > 5) {
- size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.textfont);
- prefs_common.textfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
+ folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, TRUE);
}
- pango_font_description_free(font_desc);
}
break;
- case GDK_KEY_Escape:
- if (mainwin->summaryview &&
- mainwin->summaryview->ext_messageview &&
- mainwin->summaryview->ext_messageview->window &&
- widget == mainwin->summaryview->ext_messageview->window) {
- messageview_destroy(mainwin->summaryview->ext_messageview);
- }
- break;
-#endif
default:
break;
}
#undef BREAK_ON_MODIFIER_KEY
-#ifdef MAEMO
-void mainwindow_maemo_led_set(gboolean state) {
- static gint last_state = -1;
- if (last_state == state)
- return;
- last_state = (gint)state;
- if (prefs_common.maemo_show_led) {
- if(state) {
- execute_command_line("/usr/bin/dbus-send --system --type=method_call "
- "--dest=com.nokia.mce "
- "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
- "string:PatternCommunicationEvent", TRUE);
- execute_command_line("/usr/bin/dbus-send --system --type=method_call "
- "--dest=com.nokia.mce "
- "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_activate "
- "string:PatternCommunicationEmail", TRUE);
- } else {
- execute_command_line("/usr/bin/dbus-send --system --type=method_call "
- "--dest=com.nokia.mce "
- "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
- "string:PatternCommunicationEvent", TRUE);
- execute_command_line("/usr/bin/dbus-send --system --type=method_call "
- "--dest=com.nokia.mce "
- "/com/nokia/mce/request com.nokia.mce.request.req_led_pattern_deactivate "
- "string:PatternCommunicationEmail", TRUE);
- }
- }
-}
-
-static void led_update(FolderItem *removed_item)
-{
- guint new, unread, unreadmarked, marked, total, replied;
- guint forwarded, locked, ignored, watched;
-
- folder_count_total_msgs(&new, &unread, &unreadmarked, &marked, &total,
- &replied, &forwarded, &locked, &ignored,
- &watched);
- if (removed_item) {
- total -= removed_item->total_msgs;
- new -= removed_item->new_msgs;
- unread -= removed_item->unread_msgs;
- }
-
- if (new > 0)
- mainwindow_maemo_led_set(TRUE);
- else
- mainwindow_maemo_led_set(FALSE);
-}
-
-static gboolean maemo_folder_item_update_hook(gpointer source, gpointer data)
-{
- led_update(NULL);
-
- return FALSE;
-}
-
-static gboolean maemo_folder_update_hook(gpointer source, gpointer data)
-{
- FolderUpdateData *hookdata;
- hookdata = source;
- if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM)
- led_update(hookdata->item);
- else
- led_update(NULL);
-
- return FALSE;
-}
-
-static void main_window_install_maemo_hooks(MainWindow *mainwin)
-{
- gint maemo_item_hook_id, maemo_folder_hook_id;
-
- maemo_item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, maemo_folder_item_update_hook, NULL);
- if (maemo_item_hook_id == -1) {
- goto err_out_item;
- }
-
- maemo_folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, maemo_folder_update_hook, NULL);
- if (maemo_folder_hook_id == -1) {
- goto err_out_folder;
- }
-
- return;
-
-err_out_folder:
- hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, maemo_item_hook_id);
-err_out_item:
- return;
-}
-#endif
-
MainWindow *main_window_create()
{
MainWindow *mainwin;
/* main window */
window = GTK_WIDGET(gtkut_window_new(GTK_WINDOW_TOPLEVEL, "mainwindow"));
- gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
+ gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION_FRIENDLY);
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
#ifdef GENERIC_UMPC
prefs_common.layout_mode = SMALL_LAYOUT;
gtk_action_group_add_radio_actions(mainwin->action_group, mainwin_radio_dec_entries,
G_N_ELEMENTS(mainwin_radio_dec_entries), C_AUTO, G_CALLBACK(set_decode_cb), (gpointer)mainwin);
-#ifndef MAEMO
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR)
-#else
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_POPUP)
-#endif
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "File", "File", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu", "View", "View", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SavePartAs", "File/SavePartAs", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SynchroniseFolders", "File/SynchroniseFolders", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator7", "File/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Exit", "File/Exit", GTK_UI_MANAGER_MENUITEM)
/* Edit menu */
/* View menu */
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "ShowHide", "View/ShowHide", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "MenuBar", "View/ShowHide/MenuBar", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide", "Toolbar", "View/ShowHide/Toolbar", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBelowIcon", "View/ShowHide/Toolbar/TextBelowIcon", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/ShowHide/Toolbar", "TextBesideIcon", "View/ShowHide/Toolbar/TextBesideIcon", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Messagelist", "View/SetColumns/Messagelist", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
-#ifndef MAEMO
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "FullScreen", "View/FullScreen", GTK_UI_MANAGER_MENUITEM)
-#endif
#ifndef GENERIC_UMPC
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Layout", "View/Layout", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Layout", "Standard", "View/Layout/Standard", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "LastRead", "View/Goto/LastRead", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevHistory", "View/Goto/PrevHistory", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextHistory", "View/Goto/NextHistory", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevPage", "View/Scroll/PrevPage", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextPage", "View/Scroll/NextPage", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator4", "View/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator6", "View/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Part", "View/Part", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "AsText", "View/Part/AsText", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "Open", "View/Part/Open", GTK_UI_MANAGER_MENUITEM)
+#ifndef G_OS_WIN32
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "OpenWith", "View/Part/OpenWith", GTK_UI_MANAGER_MENUITEM)
+#endif
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator8", "View/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "UpdateSummary", "View/UpdateSummary", GTK_UI_MANAGER_MENUITEM)
/* Message menu */
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "Separator1", "Message/Receive/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Receive", "PlaceHolder", "Message/Receive/PlaceHolder", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "SendQueue", "Message/SendQueue", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CancelSending", "Message/CancelSending", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ComposeEmail", "Message/ComposeEmail", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator1", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkUnread", "Message/Mark/MarkUnread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkRead", "Message/Mark/MarkRead", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkAllRead", "Message/Mark/MarkAllRead", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "IgnoreThread", "Message/Mark/IgnoreThread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnignoreThread", "Message/Mark/UnignoreThread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "WatchThread", "Message/Mark/WatchThread", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "UnwatchThread", "Message/Mark/UnwatchThread", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator2", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator4", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkSpam", "Message/Mark/MarkSpam", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "MarkHam", "Message/Mark/MarkHam", GTK_UI_MANAGER_MENUITEM)
- MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator3", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Separator5", "Message/Mark/---", GTK_UI_MANAGER_SEPARATOR)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Lock", "Message/Mark/Lock", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message/Mark", "Unlock", "Message/Mark/Unlock", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "ColorLabel", "Message/ColorLabel", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM)
/* Tools menu */
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
menubar = gtk_ui_manager_get_widget(mainwin->ui_manager, "/Menu");
- gtk_widget_show_all(menubar);
+ if (prefs_common.mainwin_menubar)
+ gtk_widget_show_all(menubar);
+ else
+ gtk_widget_hide(menubar);
gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
-#ifndef MAEMO
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
-#else
- hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
-#endif
if (prefs_common.toolbar_detachable) {
handlebox = gtk_handle_box_new();
mainwin->window = window;
mainwin_list = g_list_append(mainwin_list, mainwin);
-#ifdef MAEMO
- mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
- window,
- (gpointer)mainwin);
-#else
mainwin->toolbar = toolbar_create(TOOLBAR_MAIN,
handlebox,
(gpointer)mainwin);
-#endif
toolbar_set_learn_button
(mainwin->toolbar,
LEARN_SPAM);
set_log_prefs(LOG_PROTOCOL,
&prefs_common.logwin_width,
&prefs_common.logwin_height);
- set_log_title(LOG_DEBUG_FILTERING, _("Filtering/processing debug log"));
+ set_log_title(LOG_DEBUG_FILTERING, _("Filtering/Processing debug log"));
set_log_prefs(LOG_DEBUG_FILTERING,
&prefs_common.filtering_debugwin_width,
&prefs_common.filtering_debugwin_height);
mainwindow_colorlabel_menu_create(mainwin, FALSE);
mainwindow_tags_menu_create(mainwin, FALSE);
-#ifdef MAEMO
- main_window_install_maemo_hooks(mainwin);
-#endif
-#ifndef MAEMO
if (prefs_common.mainwin_fullscreen) {
cm_toggle_menu_set_active_full(mainwin->ui_manager,
"Menu/View/FullScreen",
TRUE);
}
-#endif
+ if (prefs_common.mainwin_menubar)
+ cm_toggle_menu_set_active_full(mainwin->ui_manager,"Menu/View/ShowHide/MenuBar", TRUE);
+
return mainwin;
}
folderview_reinit_fonts(mainwin->folderview);
summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
foldersel_reflect_prefs_pixmap_theme();
+#ifndef USE_NEW_ADDRBOOK
addressbook_reflect_prefs_pixmap_theme();
+#endif
#ifndef GENERIC_UMPC
pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
MainWindow *mainwin = (MainWindow *)data;
if (summary_is_locked(mainwin->summaryview)) {
- tags_tag = 0;
return TRUE;
}
/* re-create tags submenu */
: _("none"));
if (cur_account)
- buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION);
+ buf = g_strdup_printf("%s - %s", ac_name, PROG_VERSION_FRIENDLY);
else
- buf = g_strdup(PROG_VERSION);
+ buf = g_strdup(PROG_VERSION_FRIENDLY);
gtk_window_set_title(GTK_WINDOW(mainwin->window), buf);
g_free(buf);
}
break;
case WIDE_LAYOUT:
- ppaned = mainwin->hpaned;
container = mainwin->vpaned;
if (gtk_widget_get_parent(mainwin->messageview->vbox) != NULL) {
mainwin->messageview->visible = FALSE;
folder_set_ui_func(folder, NULL, NULL);
}
-SensitiveCond main_window_get_current_state(MainWindow *mainwin)
+SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
{
- SensitiveCond state = 0;
+ SensitiveCondMask state = 0;
SummarySelection selection;
FolderItem *item = mainwin->summaryview->folder_item;
GList *account_list = account_get_list();
selection = summary_get_selection_type(mainwin->summaryview);
+#define UPDATE_STATE(...) \
+ do { \
+ state |= main_window_get_mask(__VA_ARGS__, -1); \
+ } while (0)
+
if (mainwin->lock_count == 0 && !claws_is_starting())
- state |= M_UNLOCKED;
+ UPDATE_STATE(M_UNLOCKED);
if (selection != SUMMARY_NONE)
- state |= M_MSG_EXIST;
+ UPDATE_STATE(M_MSG_EXIST);
if (item && item->path && folder_item_parent(item) && !item->no_select) {
- state |= M_EXEC;
+ UPDATE_STATE(M_EXEC);
/* if (item->folder->type != F_NEWS) */
- state |= M_ALLOW_DELETE;
+ UPDATE_STATE(M_ALLOW_DELETE);
if (prefs_common.immediate_exec == 0
&& mainwin->lock_count == 0)
- state |= M_DELAY_EXEC;
+ UPDATE_STATE(M_DELAY_EXEC);
if ((selection == SUMMARY_NONE && item->hide_read_msgs)
|| selection != SUMMARY_NONE)
- state |= M_HIDE_READ_MSG;
+ UPDATE_STATE(M_HIDE_READ_MSG);
if ((selection == SUMMARY_NONE && item->hide_read_threads)
|| selection != SUMMARY_NONE)
- state |= M_HIDE_READ_THREADS;
+ UPDATE_STATE(M_HIDE_READ_THREADS);
}
if (mainwin->summaryview->threaded)
- state |= M_THREADED;
+ UPDATE_STATE(M_THREADED);
else
- state |= M_UNTHREADED;
+ UPDATE_STATE(M_UNTHREADED);
if (selection == SUMMARY_SELECTED_SINGLE ||
selection == SUMMARY_SELECTED_MULTIPLE)
- state |= M_TARGET_EXIST;
+ UPDATE_STATE(M_TARGET_EXIST);
if (selection == SUMMARY_SELECTED_SINGLE)
- state |= M_SINGLE_TARGET_EXIST;
+ UPDATE_STATE(M_SINGLE_TARGET_EXIST);
if (mainwin->summaryview->folder_item &&
mainwin->summaryview->folder_item->folder->klass->type == F_NEWS)
- state |= M_NEWS;
+ UPDATE_STATE(M_NEWS);
else
- state |= M_NOT_NEWS;
+ UPDATE_STATE(M_NOT_NEWS);
if (mainwin->summaryview->folder_item &&
(mainwin->summaryview->folder_item->stype != F_TRASH ||
!folder_has_parent_of_type(mainwin->summaryview->folder_item, F_TRASH)))
- state |= M_NOT_TRASH;
+ UPDATE_STATE(M_NOT_TRASH);
if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
- state |= M_ACTIONS_EXIST;
+ UPDATE_STATE(M_ACTIONS_EXIST);
tmp = tags_get_list();
if (tmp && g_slist_length(tmp))
- state |= M_TAGS_EXIST;
+ UPDATE_STATE(M_TAGS_EXIST);
g_slist_free(tmp);
if (procmsg_have_queued_mails_fast() && !procmsg_is_sending())
- state |= M_HAVE_QUEUED_MAILS;
+ UPDATE_STATE(M_HAVE_QUEUED_MAILS);
if (selection == SUMMARY_SELECTED_SINGLE &&
(item &&
(folder_has_parent_of_type(item, F_DRAFT) ||
folder_has_parent_of_type(item, F_OUTBOX) ||
folder_has_parent_of_type(item, F_QUEUE))))
- state |= M_ALLOW_REEDIT;
+ UPDATE_STATE(M_ALLOW_REEDIT);
if (cur_account)
- state |= M_HAVE_ACCOUNT;
+ UPDATE_STATE(M_HAVE_ACCOUNT);
+ if (cur_account && cur_account->protocol != A_NONE)
+ UPDATE_STATE(M_HAVE_RETRIEVABLE_ACCOUNT);
+
if (any_folder_want_synchronise())
- state |= M_WANT_SYNC;
+ UPDATE_STATE(M_WANT_SYNC);
if (item && item->prefs->processing && selection != SUMMARY_NONE)
- state |= M_HAVE_PROCESSING;
+ UPDATE_STATE(M_HAVE_PROCESSING);
if (g_list_length(account_list) > 1)
- state |= M_HAVE_MULTI_ACCOUNT;
+ UPDATE_STATE(M_HAVE_MULTI_ACCOUNT);
+
+ for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
+ if (((PrefsAccount*)account_list->data)->protocol != A_NONE) {
+ UPDATE_STATE(M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
+ break;
+ }
+ }
- for ( ; account_list != NULL; account_list = account_list->next) {
+ for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
- state |= M_HAVE_NEWS_ACCOUNT;
+ UPDATE_STATE(M_HAVE_NEWS_ACCOUNT);
break;
}
}
(mainwin->summaryview->folder_item &&
mainwin->summaryview->folder_item->folder->klass->type != F_UNKNOWN &&
mainwin->summaryview->folder_item->folder->klass->type != F_NEWS)) {
- state |= M_CAN_LEARN_SPAM;
+ UPDATE_STATE(M_CAN_LEARN_SPAM);
}
if (mainwin->summaryview->folder_item) {
- state |= M_FOLDER_SELECTED;
+ UPDATE_STATE(M_FOLDER_SELECTED);
}
if (inc_is_active())
- state |= M_INC_ACTIVE;
+ UPDATE_STATE(M_INC_ACTIVE);
if (imap_cancel_all_enabled())
- state |= M_INC_ACTIVE;
+ UPDATE_STATE(M_INC_ACTIVE);
+
+ if (send_is_active() | procmsg_is_sending())
+ UPDATE_STATE(M_SEND_ACTIVE);
if (mainwin->summaryview->deleted > 0)
- state |= M_DELETED_EXISTS;
+ UPDATE_STATE(M_DELETED_EXISTS);
if (mainwin->summaryview->deleted > 0 ||
mainwin->summaryview->moved > 0 ||
mainwin->summaryview->copied > 0)
- state |= M_DELAY_EXEC;
+ UPDATE_STATE(M_DELAY_EXEC);
if (summary_is_list(mainwin->summaryview))
- state |= M_SUMMARY_ISLIST;
+ UPDATE_STATE(M_SUMMARY_ISLIST);
if (prefs_common.layout_mode != SMALL_LAYOUT || mainwin->in_folder)
- state |= M_IN_MSGLIST;
+ UPDATE_STATE(M_IN_MSGLIST);
for (account_list = account_get_list(); account_list != NULL; account_list = account_list->next) {
PrefsAccount *account = account_list->data;
if (account->session_passwd || account->session_smtp_passwd) {
- state |= M_SESSION_PASSWORDS;
+ UPDATE_STATE(M_SESSION_PASSWORDS);
break;
}
}
+#undef UPDATE_STATE
return state;
}
+SensitiveCondMask main_window_get_mask(SensitiveCond cond, ...)
+{
+ va_list args;
+ gint i;
+ SensitiveCondMask value;
+ static SensitiveCondMask SensitiveCond_table[M_MAX_RESERVED];
+ static gboolean first_time = TRUE;
+
+ if (first_time) {
+ for (i = 0; i < M_MAX_RESERVED; i++)
+ SensitiveCond_table[i] = (SensitiveCondMask) ((SensitiveCondMask)1 << i);
+ first_time = FALSE;
+ }
+
+ value = 0;
+
+ va_start(args, cond);
+ for (i = (gint) cond; i >= 0; i = va_arg(args, gint))
+ value |= SensitiveCond_table[i];
+ va_end(args);
+ return value;
+}
void main_window_set_menu_sensitive(MainWindow *mainwin)
{
- SensitiveCond state;
+ SensitiveCondMask state;
gboolean sensitive;
SummaryView *summaryview;
gchar *menu_path;
GtkWidget *menu;
GList *children, *cur_item;
gint i;
-
- static const struct {
- gchar *const entry;
- SensitiveCond cond;
- } entry[] = {
- {"Menu/File/SaveAs", M_TARGET_EXIST},
- {"Menu/File/Print" , M_TARGET_EXIST},
- {"Menu/File/SynchroniseFolders", M_WANT_SYNC},
- {"Menu/File/Exit" , M_UNLOCKED},
-
- {"Menu/Edit/SelectThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Edit/DeleteThread" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Edit/Find", M_SINGLE_TARGET_EXIST},
- {"Menu/Edit/QuickSearch", M_IN_MSGLIST},
-
- {"Menu/View/SetColumns/Folderlist" , M_UNLOCKED|M_SUMMARY_ISLIST},
- {"Menu/View/Sort" , M_EXEC|M_SUMMARY_ISLIST},
- {"Menu/View/ThreadView" , M_EXEC|M_SUMMARY_ISLIST},
- {"Menu/View/ExpandThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
- {"Menu/View/CollapseThreads" , M_MSG_EXIST|M_SUMMARY_ISLIST},
- {"Menu/View/HideReadThreads" , M_HIDE_READ_THREADS|M_SUMMARY_ISLIST},
- {"Menu/View/HideReadMessages" , M_HIDE_READ_MSG|M_SUMMARY_ISLIST},
- {"Menu/View/HideDelMessages" , M_SUMMARY_ISLIST},
- {"Menu/View/Goto/Prev" , M_MSG_EXIST},
- {"Menu/View/Goto/Next" , M_MSG_EXIST},
- {"Menu/View/Goto/PrevUnread" , M_MSG_EXIST},
- {"Menu/View/Goto/PrevNew" , M_MSG_EXIST},
- {"Menu/View/Goto/PrevMarked" , M_MSG_EXIST},
- {"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
- {"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
- {"Menu/View/Goto/LastRead" , M_SINGLE_TARGET_EXIST},
- {"Menu/View/Goto/ParentMessage" , M_SINGLE_TARGET_EXIST},
- {"Menu/View/OpenNewWindow" , M_SINGLE_TARGET_EXIST},
- {"Menu/View/MessageSource" , M_SINGLE_TARGET_EXIST},
- {"Menu/View/AllHeaders" , M_SINGLE_TARGET_EXIST},
- {"Menu/View/Quotes" , M_SINGLE_TARGET_EXIST},
-
- {"Menu/Message/Receive/CurrentAccount"
- , M_HAVE_ACCOUNT|M_UNLOCKED},
- {"Menu/Message/Receive/AllAccounts"
- , M_HAVE_ACCOUNT|M_UNLOCKED},
- {"Menu/Message/Receive/CancelReceiving"
- , M_INC_ACTIVE},
- {"Menu/Message/SendQueue" , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
- {"Menu/Message/ComposeEmail", M_HAVE_ACCOUNT},
- {"Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT},
- {"Menu/Message/Reply" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/ReplyTo" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/FollowupReply", M_HAVE_ACCOUNT|M_TARGET_EXIST|M_NEWS|M_SUMMARY_ISLIST},
- {"Menu/Message/Forward" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/ForwardAtt" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/Redirect" , M_HAVE_ACCOUNT|M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/Move" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS},
- {"Menu/Message/Copy" , M_TARGET_EXIST|M_EXEC},
- {"Menu/Message/Trash" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NOT_NEWS|M_NOT_TRASH},
- {"Menu/Message/Delete" , M_TARGET_EXIST|M_ALLOW_DELETE},
- {"Menu/Message/CancelNews" , M_TARGET_EXIST|M_ALLOW_DELETE|M_NEWS},
- {"Menu/Message/Mark" , M_TARGET_EXIST|M_SUMMARY_ISLIST},
- {"Menu/Message/Mark/MarkSpam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
- {"Menu/Message/Mark/MarkHam" , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
- {"Menu/Message/Mark/IgnoreThread" , M_TARGET_EXIST},
- {"Menu/Message/Mark/UnignoreThread" , M_TARGET_EXIST},
- {"Menu/Message/Mark/Lock" , M_TARGET_EXIST},
- {"Menu/Message/Mark/Unlock" , M_TARGET_EXIST},
- {"Menu/Message/ColorLabel" , M_TARGET_EXIST},
- {"Menu/Message/Tags" , M_TARGET_EXIST},
- {"Menu/Message/Reedit" , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
-
- {"Menu/Tools/AddSenderToAB" , M_SINGLE_TARGET_EXIST},
- {"Menu/Tools/CollectAddresses" , M_FOLDER_SELECTED},
- {"Menu/Tools/CollectAddresses/FromFolder"
- , M_FOLDER_SELECTED},
- {"Menu/Tools/CollectAddresses/FromSelected"
- , M_TARGET_EXIST},
- {"Menu/Tools/FilterFolder", M_MSG_EXIST|M_EXEC},
- {"Menu/Tools/FilterSelected" , M_TARGET_EXIST|M_EXEC},
- {"Menu/Tools/RunProcessing" , M_HAVE_PROCESSING},
- {"Menu/Tools/CreateFilterRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
- {"Menu/Tools/CreateProcessingRule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
- {"Menu/Tools/ListUrls" , M_TARGET_EXIST},
- {"Menu/Tools/Actions" , M_TARGET_EXIST|M_ACTIONS_EXIST},
- {"Menu/Tools/Execute" , M_DELAY_EXEC},
- {"Menu/Tools/Expunge" , M_DELETED_EXISTS},
- {"Menu/Tools/ForgetSessionPasswords" , M_SESSION_PASSWORDS},
- {"Menu/Tools/DeleteDuplicates/SelFolder" , M_MSG_EXIST|M_ALLOW_DELETE},
-
- {"Menu/Configuration", M_UNLOCKED},
- {"Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT},
- {"Menu/Configuration/AccountPrefs", M_UNLOCKED},
- {"Menu/Configuration/CreateAccount", M_UNLOCKED},
- {"Menu/Configuration/EditAccounts", M_UNLOCKED},
-
- {NULL, 0}
- };
+ gboolean mimepart_selected = FALSE;
+
+#define N_ENTRIES 83
+ static struct {
+ const gchar *entry;
+ SensitiveCondMask cond;
+ } entry[N_ENTRIES];
+
+ i = 0;
+#define FILL_TABLE(entry_str, ...) \
+do { \
+ entry[i].entry = (const gchar *) entry_str; entry[i++].cond = main_window_get_mask(__VA_ARGS__, -1); \
+} while (0)
+
+ FILL_TABLE("Menu/File/SaveAs", M_TARGET_EXIST);
+ FILL_TABLE("Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/File/Print", M_TARGET_EXIST);
+ FILL_TABLE("Menu/File/SynchroniseFolders", M_WANT_SYNC);
+ FILL_TABLE("Menu/File/Exit", M_UNLOCKED);
+
+ FILL_TABLE("Menu/Edit/SelectThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Edit/DeleteThread", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Edit/Find", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/Edit/QuickSearch", M_IN_MSGLIST);
+ FILL_TABLE("Menu/Edit/SearchFolder", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+
+ FILL_TABLE("Menu/View/SetColumns/Folderlist", M_UNLOCKED, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/Sort", M_EXEC, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/ThreadView", M_EXEC, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/ExpandThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/CollapseThreads", M_MSG_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/HideReadThreads", M_HIDE_READ_THREADS, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/HideReadMessages", M_HIDE_READ_MSG, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/HideDelMessages", M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/View/Goto/Prev", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/Next", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/PrevUnread", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/PrevNew", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/PrevMarked", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/PrevLabeled", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/NextLabeled", M_MSG_EXIST);
+ FILL_TABLE("Menu/View/Goto/ParentMessage", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/Goto/NextPart", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/Goto/PrevPart", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/OpenNewWindow", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/MessageSource", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/Part", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/AllHeaders", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/View/Quotes", M_SINGLE_TARGET_EXIST);
+
+ FILL_TABLE("Menu/Message/Receive/CurrentAccount", M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_RETRIEVABLE_ACCOUNT);
+ FILL_TABLE("Menu/Message/Receive/AllAccounts", M_HAVE_ACCOUNT, M_UNLOCKED, M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
+ FILL_TABLE("Menu/Message/Receive/CancelReceiving", M_INC_ACTIVE);
+ FILL_TABLE("Menu/Message/SendQueue", M_HAVE_ACCOUNT, M_HAVE_QUEUED_MAILS);
+ FILL_TABLE("Menu/Message/CancelSending", M_SEND_ACTIVE);
+ FILL_TABLE("Menu/Message/ComposeEmail", M_HAVE_ACCOUNT);
+ FILL_TABLE("Menu/Message/ComposeNews", M_HAVE_NEWS_ACCOUNT);
+ FILL_TABLE("Menu/Message/Reply", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/ReplyTo", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/FollowupReply", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_NEWS, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/Forward", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/ForwardAtt", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/Redirect", M_HAVE_ACCOUNT, M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/Move", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS);
+ FILL_TABLE("Menu/Message/Copy", M_TARGET_EXIST, M_EXEC);
+ FILL_TABLE("Menu/Message/Trash", M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS, M_NOT_TRASH);
+ FILL_TABLE("Menu/Message/Delete", M_TARGET_EXIST, M_ALLOW_DELETE);
+ FILL_TABLE("Menu/Message/CancelNews", M_TARGET_EXIST, M_ALLOW_DELETE, M_NEWS);
+ FILL_TABLE("Menu/Message/Mark", M_TARGET_EXIST, M_SUMMARY_ISLIST);
+ FILL_TABLE("Menu/Message/Mark/MarkSpam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+ FILL_TABLE("Menu/Message/Mark/MarkHam", M_TARGET_EXIST, M_CAN_LEARN_SPAM);
+ FILL_TABLE("Menu/Message/Mark/IgnoreThread", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/Mark/UnignoreThread", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/Mark/Lock", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/Mark/Unlock", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/ColorLabel", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/Tags", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Message/Reedit", M_HAVE_ACCOUNT, M_ALLOW_REEDIT);
+ FILL_TABLE("Menu/Message/CheckSignature", M_SINGLE_TARGET_EXIST);
+
+ FILL_TABLE("Menu/Tools/AddSenderToAB", M_SINGLE_TARGET_EXIST);
+ FILL_TABLE("Menu/Tools/CollectAddresses", M_FOLDER_SELECTED);
+ FILL_TABLE("Menu/Tools/CollectAddresses/FromFolder", M_FOLDER_SELECTED);
+ FILL_TABLE("Menu/Tools/CollectAddresses/FromSelected", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Tools/FilterFolder", M_MSG_EXIST, M_EXEC);
+ FILL_TABLE("Menu/Tools/FilterSelected", M_TARGET_EXIST, M_EXEC);
+ FILL_TABLE("Menu/Tools/RunProcessing", M_HAVE_PROCESSING);
+ FILL_TABLE("Menu/Tools/CreateFilterRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
+ FILL_TABLE("Menu/Tools/CreateProcessingRule", M_SINGLE_TARGET_EXIST, M_UNLOCKED);
+ FILL_TABLE("Menu/Tools/ListUrls", M_TARGET_EXIST);
+ FILL_TABLE("Menu/Tools/Actions", M_TARGET_EXIST, M_ACTIONS_EXIST);
+ FILL_TABLE("Menu/Tools/Execute", M_DELAY_EXEC);
+ FILL_TABLE("Menu/Tools/Expunge", M_DELETED_EXISTS);
+ FILL_TABLE("Menu/Tools/ForgetSessionPasswords", M_SESSION_PASSWORDS);
+ FILL_TABLE("Menu/Tools/DeleteDuplicates/SelFolder", M_MSG_EXIST, M_ALLOW_DELETE);
+
+ FILL_TABLE("Menu/Configuration", M_UNLOCKED);
+ FILL_TABLE("Menu/Configuration/ChangeAccount", M_HAVE_MULTI_ACCOUNT);
+ FILL_TABLE("Menu/Configuration/AccountPrefs", M_UNLOCKED);
+ FILL_TABLE("Menu/Configuration/CreateAccount", M_UNLOCKED);
+ FILL_TABLE("Menu/Configuration/EditAccounts", M_UNLOCKED);
+ FILL_TABLE(NULL, -1);
+#undef FILL_TABLE
+ if (i > N_ENTRIES)
+ g_error("main window menu entry table overrun (%d/%d)", i, N_ENTRIES);
+#undef ENTRIES
state = main_window_get_current_state(mainwin);
for (; cur_item != NULL; cur_item = cur_item->next) {
gtk_widget_set_sensitive(GTK_WIDGET(cur_item->data),
- (M_UNLOCKED & state) != 0);
+ (main_window_get_mask(M_UNLOCKED, -1) & state) != 0);
}
g_list_free(children);
messageview_is_visible(mainwin->messageview));
summaryview = mainwin->summaryview;
- menu_path = "Menu/View/Sort/DontSort";
switch (summaryview->sort_key) {
case SORT_BY_NUMBER:
cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Sort/Descending", FALSE);
}
- if (mainwin->messageview
+ if (mainwin->messageview
&& mainwin->messageview->mimeview
&& mainwin->messageview->mimeview->textview)
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/AllHeaders",
- mainwin->messageview->mimeview->textview->show_all_headers);
- cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & M_THREADED) != 0);
- cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & M_THREADED) != 0);
- cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & M_THREADED) != 0);
- cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & M_THREADED) != 0);
+ prefs_common.show_all_headers);
+ cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/ThreadView", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ExpandThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/CollapseThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", (state & main_window_get_mask(M_THREADED, -1)) != 0);
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/CollapseAll", (prefs_common.hide_quotes == 1));
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse2", (prefs_common.hide_quotes == 2));
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
- if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs)
+ if (mainwin->summaryview->folder_item && !mainwin->summaryview->folder_item->threaded)
+ cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
+ if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_msgs) ||
+ quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadThreads", FALSE);
- if (mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads)
+ if ((mainwin->summaryview->folder_item && mainwin->summaryview->folder_item->hide_read_threads) ||
+ quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideReadMessages", FALSE);
-
+ if (quicksearch_has_sat_predicate(mainwin->summaryview->quicksearch))
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/HideDelMessages", FALSE);
+
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevHistory",
+ messageview_nav_has_prev(mainwin->messageview));
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextHistory",
+ messageview_nav_has_next(mainwin->messageview));
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimepart_selected = !mimeview_tree_is_empty(mainwin->messageview->mimeview);
+
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/File/SavePartAs", mimepart_selected);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextPart", mimepart_selected);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevPart", mimepart_selected);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part", mimepart_selected);
+ cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature",
+ mimepart_selected && mainwin->messageview->mimeview->signed_part);
+
main_window_menu_callback_unblock(mainwin);
}
g_list_free(children);
if (list_header) {
for (url_pt = list_header; url_pt && *url_pt;) {
- get_url_part (&url_pt, url_decoded, BUFFSIZE);
+ get_url_part (&url_pt, url_decoded);
item = NULL;
if (!g_ascii_strncasecmp(url_decoded, "mailto:", 7)) {
- item = gtk_menu_item_new_with_label ((url_decoded));
+ item = cm_menu_item_new_label_from_url ((url_decoded));
g_signal_connect(G_OBJECT(item), "activate",
G_CALLBACK(mailing_list_compose),
NULL);
else if (!g_ascii_strncasecmp(url_decoded, "http:", 5) ||
!g_ascii_strncasecmp(url_decoded, "https:",6)) {
- item = gtk_menu_item_new_with_label ((url_decoded));
+ item = cm_menu_item_new_label_from_url ((url_decoded));
g_signal_connect(G_OBJECT(item), "activate",
G_CALLBACK(mailing_list_open_uri),
NULL);
return menu_nb;
}
-static void get_url_part (const gchar **buffer, gchar *url_decoded, gint maxlen)
+static void get_url_part (const gchar **buffer, gchar *url_decoded)
{
gchar tmp[BUFFSIZE];
const gchar *buf;
buf++;
if (!strncmp(buf, "mailto:", strlen("mailto:")))
with_plus = FALSE;
- for (i = 0; *buf != '>' && *buf != 0x00 && i<maxlen; tmp[i++] = *(buf++));
+ for (i = 0;
+ *buf != '>' && *buf != 0x00 && i < BUFFSIZE;
+ tmp[i++] = *(buf++));
buf++;
}
else {
return;
}
- tmp[i] = 0x00;
*url_decoded = '\0';
*buffer = NULL;
- if (i == maxlen) {
+ if (i == BUFFSIZE) {
return;
}
+ tmp[i] = 0x00;
decode_uri_with_plus (url_decoded, (const gchar *)tmp, with_plus);
/* Prepare the work for the next url in the list */
if (messageview_is_visible(mainwin->messageview)) {
gtk_paned_add2(GTK_PANED(hpaned), vpaned);
- gtk_paned_add1(GTK_PANED(vpaned),
- GTK_WIDGET_PTR(mainwin->summaryview));
+ gtk_paned_pack1(GTK_PANED(vpaned),
+ GTK_WIDGET_PTR(mainwin->summaryview), TRUE, TRUE);
} else {
gtk_paned_add2(GTK_PANED(hpaned),
GTK_WIDGET_PTR(mainwin->summaryview));
{
while (mainwin_list != NULL) {
MainWindow *mainwin = (MainWindow*)mainwin_list->data;
-
+
/* free toolbar stuff */
toolbar_clear_list(TOOLBAR_MAIN);
TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
static void search_folder_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+ FolderItem *item = mainwin->summaryview->folder_item;
+ cm_return_if_fail(item != NULL);
summary_search(mainwin->summaryview);
}
mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
if (old_layout_mode == SMALL_LAYOUT && layout_mode != SMALL_LAYOUT) {
mainwindow_reset_paned(GTK_PANED(mainwin->hpaned));
+ if (layout_mode == VERTICAL_LAYOUT)
+ mainwindow_reset_paned(GTK_PANED(mainwin->vpaned));
}
if (old_layout_mode != SMALL_LAYOUT && layout_mode == SMALL_LAYOUT) {
mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
gboolean ask_sync)
{
+ static gboolean switching = FALSE;
+
+ if (switching)
+ return;
+
+ switching = TRUE;
+
offline_ask_sync = ask_sync;
if (offline)
online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
else
online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
offline_ask_sync = TRUE;
+
+ switching = FALSE;
}
static void toggle_work_offline_cb (GtkAction *action, gpointer data)
mainwindow_check_synchronise(mainwin, TRUE);
prefs_common.work_offline = TRUE;
imap_disconnect_all(have_connectivity);
+ nntp_disconnect_all(have_connectivity);
hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
} else {
/*go online */
static void addressbook_open_cb(GtkAction *action, gpointer data)
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("Failed to open address book");
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void log_window_show_cb(GtkAction *action, gpointer data)
imap_cancel_all();
}
+static void send_cancel_cb(GtkAction *action, gpointer data)
+{
+ send_cancel();
+}
+
static void move_to_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
{
MainWindow *mainwin = (MainWindow *)data;
if (mainwin->menu_lock_count) return;
- mainwin->summaryview->messageview->all_headers =
+ prefs_common.show_all_headers =
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
summary_display_msg_selected(mainwin->summaryview,
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
}
+static void toggle_menubar_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+ if (mainwin->menu_lock_count) return;
+ if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+ gtk_widget_hide(GTK_WIDGET(mainwin->menubar));
+ prefs_common.mainwin_menubar = FALSE;
+ } else {
+ gtk_widget_show(GTK_WIDGET(mainwin->menubar));
+ prefs_common.mainwin_menubar = TRUE;
+ }
+}
+
static void hide_quotes_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
MainWindow *mainwin = (MainWindow *)data;
if (!mainwin->summaryview->displayed && mainwin->summaryview->selected) {
summary_display_msg_selected(mainwin->summaryview,
- mainwin->messageview->mimeview->textview->show_all_headers);
+ prefs_common.show_all_headers);
}
messageview_list_urls(mainwin->messageview);
}
summary_select_next_labeled(mainwin->summaryview);
}
-static void last_read_cb(GtkAction *action, gpointer data)
+static void prev_history_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+ MsgInfo *info = messageview_nav_get_prev(mainwin->messageview);
+ if (info) {
+ if (info->folder != mainwin->summaryview->folder_item)
+ folderview_select(mainwin->folderview, info->folder);
+ summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
+ summary_display_msg_selected(mainwin->summaryview, FALSE);
+ procmsg_msginfo_free(info);
+ main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+ }
+}
+
+static void next_history_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
- summary_select_last_read(mainwin->summaryview);
+ MsgInfo *info = messageview_nav_get_next(mainwin->messageview);
+ if (info) {
+ if (info->folder != mainwin->summaryview->folder_item)
+ folderview_select(mainwin->folderview, info->folder);
+ summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
+ procmsg_msginfo_free(info);
+ main_window_set_menu_sensitive(mainwindow_get_mainwindow());
+ toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+ }
}
static void parent_cb(GtkAction *action, gpointer data)
static void goto_unread_folder_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
- folderview_select_next_unread(mainwin->folderview, FALSE);
+ folderview_select_next_with_flag(mainwin->folderview, MSG_UNREAD, FALSE);
}
static void scroll_prev_line_cb(GtkAction *action, gpointer data)
gchar *str;
if (item->path)
- str = g_strdup_printf(_("Scanning folder %s%c%s ..."),
+ str = g_strdup_printf(_("Scanning folder %s%c%s..."),
LOCAL_FOLDER(folder)->rootpath,
G_DIR_SEPARATOR,
item->path);
else
- str = g_strdup_printf(_("Scanning folder %s ..."),
+ str = g_strdup_printf(_("Scanning folder %s..."),
LOCAL_FOLDER(folder)->rootpath);
STATUSBAR_PUSH(mainwin, str);
static void addr_harvest_cb( GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+
addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
}
main_window_set_menu_sensitive(mainwin);
}
-#ifdef MAEMO
-gboolean maemo_mainwindow_is_fullscreen(GtkWidget *widget)
+static void save_part_as_cb(GtkAction *action, gpointer data)
{
- gint w, h;
- gtk_window_get_size(GTK_WINDOW(widget), &w, &h);
- return (w == 800);
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_save_as(mainwin->messageview->mimeview);
}
-void maemo_window_full_screen_if_needed (GtkWindow *window)
+static void view_part_as_text_cb(GtkAction *action, gpointer data)
{
- if (maemo_mainwindow_is_fullscreen(mainwindow_get_mainwindow()->window)) {
- gtk_window_fullscreen(GTK_WINDOW(window));
- }
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_display_as_text(mainwin->messageview->mimeview);
}
-void maemo_connect_key_press_to_mainwindow (GtkWindow *window)
+static void open_part_cb(GtkAction *action, gpointer data)
{
- g_signal_connect(G_OBJECT(window), "key_press_event",
- G_CALLBACK(mainwindow_key_pressed), mainwindow_get_mainwindow());
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_launch(mainwin->messageview->mimeview, NULL);
+}
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_open_with(mainwin->messageview->mimeview);
}
#endif
+static void check_signature_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_check_signature(mainwin->messageview->mimeview);
+}
+
+static void goto_next_part_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_select_next_part(mainwin->messageview->mimeview);
+}
+
+static void goto_prev_part_cb(GtkAction *action, gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ if (mainwin->messageview
+ && mainwin->messageview->mimeview)
+ mimeview_select_prev_part(mainwin->messageview->mimeview);
+}