[Commits] [SCM] claws branch, master, updated. 3.14.1-152-gf806a49

wwp at claws-mail.org wwp at claws-mail.org
Thu Jan 19 14:49:49 CET 2017


The branch, master has been updated
       via  f806a49d36959a9320108485fc712db5a04e3962 (commit)
      from  9fc2c3acb34df62339ea9daa8fe4eb569a1b8f7f (commit)

Summary of changes:
 src/Makefile.am                |    1 +
 src/mainwindow.c               |    8 ++++--
 src/mainwindow.h               |    1 +
 src/pixmaps/delete_dup_btn.xpm |   33 +++++++++++++++++++++++
 src/prefs_toolbar.c            |    1 +
 src/stock_pixmap.c             |    3 ++-
 src/stock_pixmap.h             |    1 +
 src/toolbar.c                  |   57 +++++++++++++++++++++++++++++++++-------
 src/toolbar.h                  |    2 ++
 9 files changed, 95 insertions(+), 12 deletions(-)
 create mode 100644 src/pixmaps/delete_dup_btn.xpm


- Log -----------------------------------------------------------------
commit f806a49d36959a9320108485fc712db5a04e3962
Author: wwp <wwp at free.fr>
Date:   Thu Jan 19 14:49:06 2017 +0100

    Add "Delete duplicates" (delete duplicated messages in current folder) to
    the main window's toolbar, including a brand new (not so shining) icon.

diff --git a/src/Makefile.am b/src/Makefile.am
index 5c0de96..b78a58d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -399,6 +399,7 @@ EXTRA_DIST = \
 	pixmaps/continue.xpm \
 	pixmaps/copied.xpm \
 	pixmaps/delete_btn.xpm \
+	pixmaps/delete_dup_btn.xpm \
 	pixmaps/deleted.xpm \
 	pixmaps/dir_close.xpm \
 	pixmaps/dir_close_hrm.xpm \
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 6c8aa07..8b36262 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4694,9 +4694,8 @@ static void attract_by_subject_cb(GtkAction *action, gpointer data)
 	summary_attract_by_subject(mainwin->summaryview);
 }
 
-static void delete_duplicated_cb(GtkAction *action, gpointer data)
+void mainwindow_delete_duplicated(MainWindow *mainwin)
 {
-	MainWindow *mainwin = (MainWindow *)data;
 	FolderItem *item;
 
 	item = folderview_get_selected_item(mainwin->folderview);
@@ -4712,6 +4711,11 @@ static void delete_duplicated_cb(GtkAction *action, gpointer data)
 	}
 }
 
+static void delete_duplicated_cb(GtkAction *action, gpointer data)
+{
+	mainwindow_delete_duplicated((MainWindow *)data);
+}
+
 struct DelDupsData
 {
 	guint	dups;
diff --git a/src/mainwindow.h b/src/mainwindow.h
index e4763b5..551173e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -216,6 +216,7 @@ void mainwindow_jump_to			      (const gchar 	 *target,
 					       gboolean popup);
 void mainwindow_show_error		      (void);
 void mainwindow_clear_error		      (MainWindow *mainwin);
+void mainwindow_delete_duplicated     (MainWindow *mainwin);
 gboolean mainwindow_is_obscured		      (void);
 void mainwindow_exit_folder		      (MainWindow *mainwin);
 void mainwindow_enter_folder		      (MainWindow *mainwin);
diff --git a/src/pixmaps/delete_dup_btn.xpm b/src/pixmaps/delete_dup_btn.xpm
new file mode 100644
index 0000000..6d92856
--- /dev/null
+++ b/src/pixmaps/delete_dup_btn.xpm
@@ -0,0 +1,33 @@
+/* XPM */
+static char * delete_dup_btn_xpm[] = {
+"24 24 6 1",
+" 	c None",
+".	c #000000",
+"+	c #808080",
+"@	c #FFFFFF",
+"#	c #FF0000",
+"$	c #E00000",
+"                        ",
+"                        ",
+" .....                  ",
+".+@@@+.                 ",
+". at +@+ at .                 ",
+".@@+@@.                 ",
+".@@@@@.                 ",
+" .....     ..           ",
+"           .#.          ",
+" .....  ....##.   ..... ",
+".+@@@+. .######. .+@@@+.",
+". at +@+ at . .######$.. at +@+ at .",
+".@@+@@. .######. .@@+@@.",
+".@@@@@. ....##.  .@@@@@.",
+" .....     .#.    ..... ",
+"           ..           ",
+" .....                  ",
+".+@@@+.                 ",
+". at +@+ at .                 ",
+".@@+@@.                 ",
+".@@@@@.                 ",
+" .....                  ",
+"                        ",
+"                        "};
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
index b86835b..b59c1b4 100644
--- a/src/prefs_toolbar.c
+++ b/src/prefs_toolbar.c
@@ -145,6 +145,7 @@ static const gint ToolbarIcons[] =
 	STOCK_PIXMAP_HAM_BTN,
 	STOCK_PIXMAP_TRASH,
 	STOCK_PIXMAP_DELETE,
+	STOCK_PIXMAP_DELETE_DUP,
 	STOCK_PIXMAP_CANCEL,
 	STOCK_PIXMAP_MARK_IGNORETHREAD,
 	STOCK_PIXMAP_MARK_WATCHTHREAD,
diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c
index b73ebc2..2fd5a7b 100644
--- a/src/stock_pixmap.c
+++ b/src/stock_pixmap.c
@@ -133,7 +133,6 @@
 #include "pixmaps/mime_message.xpm"
 #include "pixmaps/address_search.xpm"
 #include "pixmaps/check_spelling.xpm"
-
 #include "pixmaps/dir_close.xpm"
 #include "pixmaps/dir_close_hrm.xpm"
 #include "pixmaps/dir_open.xpm"
@@ -149,6 +148,7 @@
 #include "pixmaps/trash_open.xpm"
 #include "pixmaps/trash_close.xpm"
 #include "pixmaps/delete_btn.xpm"
+#include "pixmaps/delete_dup_btn.xpm"
 #include "pixmaps/cancel.xpm"
 #include "pixmaps/trash_btn.xpm"
 #include "pixmaps/trash_open_hrm.xpm"
@@ -402,6 +402,7 @@ static StockPixmapData pixmaps[] =
     {claws_mail_icon_64_xpm           , NULL, NULL, "claws_mail_icon_64", NULL, NULL},
     {read_xpm                         , NULL, NULL, "read", NULL, NULL},
     {delete_btn_xpm                   , NULL, NULL, "delete_btn", NULL, NULL},
+    {delete_dup_btn_xpm               , NULL, NULL, "delete_dup_btn", NULL, NULL},
     {cancel_xpm                       , NULL, NULL, "cancel", NULL, NULL},
     {trash_btn_xpm                    , NULL, NULL, "trash_btn", NULL, NULL},
     {claws_mail_compose_logo_xpm      , NULL, NULL, "claws_mail_compose_logo", NULL, NULL},
diff --git a/src/stock_pixmap.h b/src/stock_pixmap.h
index 9995cfe..0e7a96b 100644
--- a/src/stock_pixmap.h
+++ b/src/stock_pixmap.h
@@ -164,6 +164,7 @@ typedef enum
 	STOCK_PIXMAP_CLAWS_MAIL_ICON_64,
 	STOCK_PIXMAP_READ,
 	STOCK_PIXMAP_DELETE,
+	STOCK_PIXMAP_DELETE_DUP,
 	STOCK_PIXMAP_CANCEL,
 	STOCK_PIXMAP_TRASH,
 	STOCK_PIXMAP_MAIL_COMPOSE_LOGO,
diff --git a/src/toolbar.c b/src/toolbar.c
index c41b487..4ffd6bb 100644
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -103,13 +103,20 @@ static void activate_compose_button 		(Toolbar	*toolbar,
 /* toolbar callbacks */
 static void toolbar_reply			(gpointer 	 data, 
 						 guint		 action);
+
 static void toolbar_learn			(gpointer 	 data, 
 						 guint		 action);
-static void toolbar_delete_cb			(GtkWidget	*widget,
-					 	 gpointer        data);
+
 static void toolbar_trash_cb			(GtkWidget	*widget,
 					 	 gpointer        data);
 
+static void toolbar_delete_cb			(GtkWidget	*widget,
+					 	 gpointer        data);
+
+static void toolbar_delete_dup_cb   		(GtkWidget   	*widget, 
+
+					 	 gpointer     	 data);
+
 static void toolbar_compose_cb			(GtkWidget	*widget,
 					    	 gpointer	 data);
 
@@ -229,6 +236,7 @@ struct {
 	{ "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_EXECUTE",       	N_("Execute")                              },
 	{ "A_GOTO_PREV",     	N_("Go to Previous Unread Message")        },
 	{ "A_GOTO_NEXT",     	N_("Go to Next Unread Message")            },
@@ -367,11 +375,11 @@ GList *toolbar_get_action_items(ToolbarType source)
 					A_RECEIVE_ALL,   A_RECEIVE_CUR,   A_SEND_QUEUED,
 					A_COMPOSE_EMAIL, A_REPLY_MESSAGE, A_REPLY_SENDER,
 					A_REPLY_ALL,     A_REPLY_ML,      A_OPEN_MAIL,     A_FORWARD,
-					A_TRASH,         A_DELETE_REAL,   A_EXECUTE,       A_GOTO_PREV,
-					A_GOTO_NEXT,     A_IGNORE_THREAD, A_WATCH_THREAD,  A_MARK,
-					A_UNMARK,        A_LOCK,          A_UNLOCK,        A_ALL_READ,
-					A_ALL_UNREAD,    A_READ,          A_UNREAD,          A_PRINT,
-					A_ADDRBOOK,      A_LEARN_SPAM,    A_GO_FOLDERS, 
+					A_TRASH,         A_DELETE_REAL,   A_DELETE_DUP,    A_EXECUTE,
+                    A_GOTO_PREV,     A_GOTO_NEXT,     A_IGNORE_THREAD, A_WATCH_THREAD,
+                    A_MARK,          A_UNMARK,        A_LOCK,          A_UNLOCK,
+                    A_ALL_READ,      A_ALL_UNREAD,    A_READ,          A_UNREAD,
+                    A_PRINT,         A_ADDRBOOK,      A_LEARN_SPAM,    A_GO_FOLDERS,
 					A_CANCEL_INC,    A_CANCEL_SEND,   A_CANCEL_ALL,    A_PREFERENCES };
 
 		for (i = 0; i < sizeof main_items / sizeof main_items[0]; i++)  {
@@ -480,6 +488,7 @@ const gchar *toolbar_get_short_text(int action) {
 	case A_FORWARD: 	return _("Forward");
 	case A_TRASH: 		return C_("Toolbar", "Trash");
 	case A_DELETE_REAL:	return _("Delete");
+	case A_DELETE_DUP: 	return _("Delete duplicates");
 	case A_EXECUTE:		return _("Execute");
 	case A_GOTO_PREV: 	return _("Prev");
 	case A_GOTO_NEXT: 	return _("Next");
@@ -538,6 +547,7 @@ gint toolbar_get_icon(int action) {
 	case A_FORWARD: 	return STOCK_PIXMAP_MAIL_FORWARD;
 	case A_TRASH: 		return STOCK_PIXMAP_TRASH;
 	case A_DELETE_REAL:	return STOCK_PIXMAP_DELETE;
+	case A_DELETE_DUP: 	return STOCK_PIXMAP_DELETE_DUP;
 	case A_EXECUTE:		return STOCK_PIXMAP_EXEC;
 	case A_GOTO_PREV: 	return STOCK_PIXMAP_UP_ARROW;
 	case A_GOTO_NEXT: 	return STOCK_PIXMAP_DOWN_ARROW;
@@ -1194,6 +1204,25 @@ static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
 	}
 }
 
+static void toolbar_delete_dup_cb(GtkWidget *widget, gpointer data)
+{
+	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;
+		mainwindow_delete_duplicated(mainwin);
+		break;
+	case TOOLBAR_COMPOSE:
+	case TOOLBAR_MSGVIEW:
+		break;
+	default:
+		return;
+	}
+}
 
 /*
  * Compose new message
@@ -1955,6 +1984,7 @@ static void toolbar_buttons_cb(GtkWidget   *widget,
 		{ A_UNREAD,			toolbar_unread_cb	},
 		{ A_PRINT,			toolbar_print_cb		},
 		{ A_LEARN_SPAM,		toolbar_learn_cb		},
+		{ A_DELETE_DUP,		toolbar_delete_dup_cb		},
 		{ A_GO_FOLDERS,		toolbar_go_folders_cb		},
 
 		{ A_SEND,		toolbar_send_cb       		},
@@ -2149,7 +2179,7 @@ Toolbar *toolbar_create(ToolbarType 	 type,
 			toolbar_data->getall_btn = item;
 			break;
 		case A_RECEIVE_CUR:
-			TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, _("Receive Mail from 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:
@@ -2207,6 +2237,10 @@ Toolbar *toolbar_create(ToolbarType 	 type,
 			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_DELETE_DUP:
+			TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,_("Delete duplicates"));
+			toolbar_data->delete_dup_btn = item;
+			break;
 		case A_REPLY_MESSAGE:
 #ifndef GENERIC_UMPC
 			TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
@@ -2589,7 +2623,7 @@ do { \
 	} else {
 		SET_WIDGET_COND(toolbar->next_btn, -1);
 	}
-	
+
 	if (toolbar->trash_btn)
 		SET_WIDGET_COND(toolbar->trash_btn,
 			M_TARGET_EXIST, M_ALLOW_DELETE, M_NOT_NEWS);
@@ -2598,6 +2632,10 @@ do { \
 		SET_WIDGET_COND(toolbar->delete_btn,
 			M_TARGET_EXIST, M_ALLOW_DELETE);
 
+	if (toolbar->delete_dup_btn)
+		SET_WIDGET_COND(toolbar->delete_dup_btn,
+			M_ALLOW_DELETE, M_SUMMARY_ISLIST);
+
 	if (toolbar->exec_btn)
 		SET_WIDGET_COND(toolbar->exec_btn, 
 			M_DELAY_EXEC);
@@ -2727,6 +2765,7 @@ static void toolbar_init(Toolbar * toolbar)
 	toolbar->fwd_btn           = NULL;
 	toolbar->trash_btn         = NULL;
 	toolbar->delete_btn        = NULL;
+	toolbar->delete_dup_btn    = NULL;
 	toolbar->prev_btn          = NULL;
 	toolbar->next_btn          = NULL;
 	toolbar->exec_btn          = NULL;
diff --git a/src/toolbar.h b/src/toolbar.h
index 4b84bb6..6047a88 100644
--- a/src/toolbar.h
+++ b/src/toolbar.h
@@ -69,6 +69,7 @@ struct _Toolbar {
 	
 	GtkWidget *trash_btn;
 	GtkWidget *delete_btn;
+	GtkWidget *delete_dup_btn;
 	GtkWidget *prev_btn;
 	GtkWidget *next_btn;
 	GtkWidget *exec_btn;
@@ -168,6 +169,7 @@ enum {
 	A_FORWARD,
 	A_TRASH,
 	A_DELETE_REAL,
+	A_DELETE_DUP,
 	A_EXECUTE,
 	A_GOTO_PREV,
 	A_GOTO_NEXT,

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list