[Commits] [SCM] claws branch, master, updated. 3.14.1-156-ga1b7175

wwp at claws-mail.org wwp at claws-mail.org
Fri Jan 20 23:20:37 CET 2017


The branch, master has been updated
       via  a1b7175d0b29b3cc5aacc363537c83f7401d4c05 (commit)
      from  c082dff510d6684e563bdf4b07134ec46ed9dbf6 (commit)

Summary of changes:
 src/mainwindow.c |   10 ++++++++--
 src/mainwindow.h |    1 +
 src/toolbar.c    |   49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 57 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit a1b7175d0b29b3cc5aacc363537c83f7401d4c05
Author: wwp <wwp at free.fr>
Date:   Fri Jan 20 23:18:56 2017 +0100

    Main window's toolbar delete dupes button is now a dropdown, allowing
    both duplication in selected folder and in all folders. Clicking the
    button still raises the deletion in selected (current) folder.

diff --git a/src/mainwindow.c b/src/mainwindow.c
index 8b36262..d23c7db 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4734,9 +4734,8 @@ static void deldup_all(FolderItem *item, gpointer _data)
 	}
 }
 
-static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
+void mainwindow_delete_duplicated_all(MainWindow *mainwin)
 {
-	MainWindow *mainwin = (MainWindow *)mw;
 	struct DelDupsData data = {0, 0};
 
 	main_window_cursor_wait(mainwin);
@@ -4749,6 +4748,13 @@ static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
 			  data.dups, data.folders);
 }
 
+static void delete_duplicated_all_cb(GtkAction *action, gpointer mw)
+{
+	MainWindow *mainwin = (MainWindow *)mw;
+
+	mainwindow_delete_duplicated_all(mainwin);
+}
+
 static void filter_cb(GtkAction *action, gpointer data)
 {
 	MainWindow *mainwin = (MainWindow *)data;
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 551173e..ce0b30c 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -217,6 +217,7 @@ void mainwindow_jump_to			      (const gchar 	 *target,
 void mainwindow_show_error		      (void);
 void mainwindow_clear_error		      (MainWindow *mainwin);
 void mainwindow_delete_duplicated     (MainWindow *mainwin);
+void mainwindow_delete_duplicated_all (MainWindow *mainwin);
 gboolean mainwindow_is_obscured		      (void);
 void mainwindow_exit_folder		      (MainWindow *mainwin);
 void mainwindow_enter_folder		      (MainWindow *mainwin);
diff --git a/src/toolbar.c b/src/toolbar.c
index 4ffd6bb..47f0500 100644
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -107,6 +107,9 @@ static void toolbar_reply			(gpointer 	 data,
 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);
 
@@ -236,7 +239,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_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")            },
@@ -1204,6 +1207,30 @@ static void toolbar_delete_cb(GtkWidget *widget, gpointer data)
 	}
 }
 
+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;
@@ -2113,6 +2140,14 @@ static void toolbar_learn_menu_cb(GtkWidget *widget, gpointer 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 
@@ -2238,8 +2273,20 @@ Toolbar *toolbar_create(ToolbarType 	 type,
 			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

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list