/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001-2013 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2001-2017 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
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * General functions for accessing address book files.
*/
#ifdef HAVE_CONFIG_H
static void toolbar_learn (gpointer data,
guint action);
+static void toolbar_delete_dup (gpointer data,
+ guint action);
+
static void toolbar_trash_cb (GtkWidget *widget,
gpointer data);
static void toolbar_lock_cb (GtkWidget *widget,
gpointer data);
-static void toolbar_ulock_cb (GtkWidget *widget,
+static void toolbar_unlock_cb (GtkWidget *widget,
gpointer data);
static void toolbar_all_read_cb (GtkWidget *widget,
{ "A_FORWARD", N_("Forward Message") },
{ "A_TRASH", N_("Trash Message") },
{ "A_DELETE_REAL", N_("Delete Message") },
- { "A_DELETE_DUP", N_("Delete duplicate messages in current folder") },
+ { "A_DELETE_DUP", N_("Delete duplicate messages") },
{ "A_EXECUTE", N_("Execute") },
{ "A_GOTO_PREV", N_("Go to Previous Unread Message") },
{ "A_GOTO_NEXT", N_("Go to Next Unread Message") },
item->text = g_strdup(C_("Toolbar", "Trash"));
*rewrite = TRUE;
}
+ if (!strcmp(item->file, "mail") && !strcmp(value, "A_DRAFT")) {
+ /* switch icon file */
+ g_free(item->file);
+ item->file = g_strdup("mail_draft");
+ *rewrite = TRUE;
+ }
if (item->index == -1) {
/* item not found in table: try migrating old action names to current ones */
gint i;
case A_READ: return STOCK_PIXMAP_MARK_READ;
case A_UNREAD: return STOCK_PIXMAP_MARK_UNREAD;
- case A_PRINT: return STOCK_PIXMAP_PRINTER;
+ case A_PRINT: return STOCK_PIXMAP_PRINTER_BTN;
case A_LEARN_SPAM: return STOCK_PIXMAP_SPAM_BTN;
case A_GO_FOLDERS: return STOCK_PIXMAP_GO_FOLDERS;
case A_PREFERENCES: return STOCK_PIXMAP_PREFERENCES;
case A_SEND: return STOCK_PIXMAP_MAIL_SEND;
case A_SEND_LATER: return STOCK_PIXMAP_MAIL_SEND_QUEUE;
- case A_DRAFT: return STOCK_PIXMAP_MAIL;
+ case A_DRAFT: return STOCK_PIXMAP_MAIL_DRAFT;
case A_INSERT: return STOCK_PIXMAP_INSERT_FILE;
case A_ATTACH: return STOCK_PIXMAP_MAIL_ATTACH;
case A_SIG: return STOCK_PIXMAP_MAIL_SIGN;
}
}
+static void toolbar_delete_dup(gpointer data, guint all)
+{
+ ToolbarItem *toolbar_item = (ToolbarItem*)data;
+ MainWindow *mainwin = NULL;
+
+ cm_return_if_fail(toolbar_item != NULL);
+
+ switch (toolbar_item->type) {
+ case TOOLBAR_MAIN:
+ mainwin = (MainWindow*)toolbar_item->parent;
+ if (all)
+ mainwindow_delete_duplicated_all(mainwin);
+ else
+ mainwindow_delete_duplicated(mainwin);
+ break;
+ case TOOLBAR_COMPOSE:
+ case TOOLBAR_MSGVIEW:
+ break;
+ default:
+ debug_print("toolbar event not supported\n");
+ return;
+ }
+}
+
static void toolbar_delete_dup_cb(GtkWidget *widget, gpointer data)
{
ToolbarItem *toolbar_item = (ToolbarItem*)data;
toolbar_learn(toolbar_item, GPOINTER_TO_INT(int_value));
}
+static void toolbar_delete_dup_menu_cb(GtkWidget *widget, gpointer data)
+{
+ gpointer int_value = g_object_get_data(G_OBJECT(widget), "int-value");
+ ToolbarItem *toolbar_item = (ToolbarItem *)data;
+
+ toolbar_delete_dup(toolbar_item, GPOINTER_TO_INT(int_value));
+}
+
/**
* Create a new toolbar with specified type
* if a callback list is passed it will be used before the
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->learn_spam_btn), menu);
break;
case A_DELETE_DUP:
+#ifndef GENERIC_UMPC
+ TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
+ _("Delete duplicates"),
+ _("Delete duplicates options"));
+ toolbar_data->delete_dup_btn = item;
+
+ menu = gtk_menu_new();
+ ADD_MENU_ITEM(_("Delete duplicates in selected folder"), toolbar_delete_dup_menu_cb, FALSE);
+ ADD_MENU_ITEM(_("Delete duplicates in all folders"), toolbar_delete_dup_menu_cb, TRUE);
+ gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(toolbar_data->delete_dup_btn), menu);
+#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Delete duplicates"));
toolbar_data->delete_dup_btn = item;
+#endif
break;
case A_REPLY_MESSAGE:
#ifndef GENERIC_UMPC
if (toolbar->delete_dup_btn)
SET_WIDGET_COND(toolbar->delete_dup_btn,
- M_ALLOW_DELETE, M_SUMMARY_ISLIST);
+ M_MSG_EXIST, M_ALLOW_DELETE, M_SUMMARY_ISLIST);
if (toolbar->exec_btn)
SET_WIDGET_COND(toolbar->exec_btn,