[Commits] [SCM] claws branch, gtk3tree, updated. 4.0.0-479-g0f32afba9

thorsten at claws-mail.org thorsten at claws-mail.org
Fri Feb 4 16:04:20 UTC 2022


The branch, gtk3tree has been updated
       via  0f32afba90be2c42ca82c041dbdeaeaf0b30e6f1 (commit)
       via  16aa94775b0fbe308e37414589384837839515e7 (commit)
       via  4f36256a378bc2e02d2169b26fdee1c6784574b6 (commit)
       via  0fa34a586ac0a2d3495130434b705ca75307dabe (commit)
       via  2e9da93fe8b684144ef6f0889d970803576f0274 (commit)
       via  e393256458da8383d35168739b74215f2daa0d45 (commit)
       via  817071429ee9fd06edd1f03463eac526c3e8c4ec (commit)
       via  fdbb06fa7463e60e35bbfe9bee9216ab2ccf4cce (commit)
       via  ddbb7286e39cdb6fb2ea61606520862840d00cf2 (commit)
       via  84455a6c078eec07c3c5b937c0636be65a8d11d6 (commit)
      from  cf28b240cc4b4998ecce391870f88559d44e361d (commit)

Summary of changes:
 src/Makefile.am                                    |   7 +-
 src/account.c                                      |   9 +-
 src/addrcustomattr.c                               |  18 ++-
 src/addrduplicates.c                               |  15 +-
 src/addressadd.c                                   |  11 +-
 src/addressbook.c                                  |  48 +++---
 src/addressbook_foldersel.c                        |  10 +-
 src/addrgather.c                                   |   8 +-
 src/addrindex.c                                    |   7 +-
 src/addrmerge.c                                    |   7 +-
 src/alertpanel.c                                   |  50 ++++--
 src/alertpanel.h                                   |  27 ++--
 src/browseldap.c                                   |   6 +-
 src/compose.c                                      |  75 ++++-----
 src/editaddress.c                                  |  14 +-
 src/editbook.c                                     |   8 +-
 src/editgroup.c                                    |   8 +-
 src/editjpilot.c                                   |   8 +-
 src/editldap.c                                     |   8 +-
 src/editldap_basedn.c                              |   8 +-
 src/edittags.c                                     |  12 +-
 src/editvcard.c                                    |   8 +-
 src/exphtmldlg.c                                   |  19 ++-
 src/expldifdlg.c                                   |  18 ++-
 src/export.c                                       |   8 +-
 src/file_checker.c                                 |  10 +-
 src/foldersel.c                                    |   8 +-
 src/folderview.c                                   |  26 +--
 src/gtk/about.c                                    |   4 +-
 src/gtk/description_window.c                       |   6 +-
 src/gtk/foldersort.c                               |   8 +-
 src/gtk/gtkutils.c                                 |  22 ++-
 src/gtk/gtkutils.h                                 |  11 +-
 src/gtk/icon_legend.c                              |   6 +-
 src/gtk/pluginwindow.c                             |  12 +-
 src/gtk/prefswindow.c                              |  14 +-
 src/gtk/sslcertwindow.c                            |  16 +-
 src/imap.c                                         |   6 +-
 src/imap_gtk.c                                     |  14 +-
 src/import.c                                       |  10 +-
 src/importldif.c                                   |  10 +-
 src/importmutt.c                                   |   8 +-
 src/importpine.c                                   |   8 +-
 src/inc.c                                          |  14 +-
 src/main.c                                         |   9 +-
 src/mainwindow.c                                   |  12 +-
 src/mbox.c                                         |   4 +-
 src/message_search.c                               |  11 +-
 src/messageview.c                                  |  16 +-
 src/mh_gtk.c                                       |   8 +-
 src/mimeview.c                                     |  14 +-
 src/news.c                                         |   6 +-
 src/news_gtk.c                                     |   6 +-
 src/plugins/address_keeper/Makefile.am             |  33 +---
 src/plugins/address_keeper/claws.def               |  41 -----
 src/plugins/address_keeper/plugin.def              |  10 --
 src/plugins/archive/archiver_gtk.c                 |  10 +-
 src/plugins/att_remover/Makefile.am                |  33 +---
 src/plugins/att_remover/att_remover.c              |  12 +-
 src/plugins/att_remover/claws.def                  |  63 --------
 src/plugins/att_remover/plugin.def                 |  10 --
 src/plugins/attachwarner/Makefile.am               |  33 +---
 src/plugins/attachwarner/attachwarner.c            |   9 +-
 src/plugins/attachwarner/claws.def                 |  31 ----
 src/plugins/attachwarner/plugin.def                |  10 --
 src/plugins/bsfilter/Makefile.am                   |  33 +---
 src/plugins/bsfilter/claws.def                     |  56 -------
 src/plugins/bsfilter/plugin.def                    |  10 --
 src/plugins/fancy/Makefile.am                      |  33 +---
 src/plugins/fancy/claws.def                        |  99 ------------
 src/plugins/fancy/plugin.def                       |  10 --
 src/plugins/fetchinfo/Makefile.am                  |  33 +---
 src/plugins/fetchinfo/claws.def                    |  32 ----
 src/plugins/fetchinfo/plugin.def                   |  10 --
 src/plugins/libravatar/Makefile.am                 |  33 +---
 src/plugins/libravatar/claws.def                   |  46 ------
 src/plugins/libravatar/libravatar_prefs.c          |   6 +-
 src/plugins/libravatar/plugin.def                  |  10 --
 src/plugins/litehtml_viewer/Makefile.am            |  29 +---
 src/plugins/litehtml_viewer/claws.def              |  29 ----
 src/plugins/litehtml_viewer/plugin.def             |  10 --
 src/plugins/mailmbox/Makefile.am                   |  33 +---
 src/plugins/mailmbox/claws.def                     |  34 ----
 src/plugins/mailmbox/plugin.def                    |  10 --
 src/plugins/mailmbox/plugin_gtk.c                  |  10 +-
 src/plugins/managesieve/Makefile.am                |  33 +---
 src/plugins/managesieve/claws.def                  |  76 ---------
 src/plugins/managesieve/plugin.def                 |  10 --
 src/plugins/managesieve/sieve_editor.c             |   7 +-
 src/plugins/managesieve/sieve_manager.c            |  12 +-
 src/plugins/notification/Makefile.am               |  34 +---
 src/plugins/notification/claws.def                 |  75 ---------
 .../notification/notification_foldercheck.c        |   8 +-
 src/plugins/notification/notification_trayicon.c   |   6 +-
 src/plugins/notification/plugin.def                |  10 --
 src/plugins/pdf_viewer/Makefile.am                 |  33 +---
 src/plugins/pdf_viewer/claws.def                   |  37 -----
 src/plugins/pdf_viewer/plugin.def                  |  10 --
 src/plugins/pdf_viewer/poppler_viewer.c            |   6 +-
 src/plugins/perl/perl_plugin.c                     |  10 +-
 src/plugins/pgpcore/Makefile.am                    |  35 +---
 src/plugins/pgpcore/claws.def                      |  81 ----------
 src/plugins/pgpcore/passphrase.c                   |   8 +-
 src/plugins/pgpcore/pgp_viewer.c                   |   6 +-
 src/plugins/pgpcore/plugin.def                     |  31 ----
 src/plugins/pgpcore/select-keys.c                  |  10 +-
 src/plugins/pgpcore/sgpgme.c                       |  11 +-
 src/plugins/pgpinline/Makefile.am                  |  38 +----
 src/plugins/pgpinline/claws.def                    |  32 ----
 src/plugins/pgpinline/mypgpcore.def                |  18 ---
 src/plugins/pgpinline/plugin.def                   |  10 --
 src/plugins/pgpmime/Makefile.am                    |  39 +----
 src/plugins/pgpmime/claws.def                      |  26 ---
 src/plugins/pgpmime/mypgpcore.def                  |  21 ---
 src/plugins/pgpmime/plugin.def                     |   9 --
 src/plugins/rssyl/Makefile.am                      |  35 +---
 src/plugins/rssyl/claws.def                        | 130 ---------------
 src/plugins/rssyl/plugin.def                       |  10 --
 src/plugins/rssyl/rssyl_cb_menu.c                  |   8 +-
 src/plugins/smime/Makefile.am                      |  38 +----
 src/plugins/smime/claws.def                        |  37 -----
 src/plugins/smime/mypgpcore.def                    |  20 ---
 src/plugins/smime/plugin.def                       |  10 --
 src/plugins/spam_report/Makefile.am                |  33 +---
 src/plugins/spam_report/claws.def                  |  56 -------
 src/plugins/spam_report/plugin.def                 |   9 --
 src/plugins/tnef_parse/Makefile.am                 |  33 +---
 src/plugins/tnef_parse/claws.def                   |  21 ---
 src/plugins/tnef_parse/plugin.def                  |  10 --
 src/plugins/vcalendar/Makefile.am                  |  33 +---
 src/plugins/vcalendar/claws.def                    | 177 ---------------------
 src/plugins/vcalendar/day-view.c                   |  15 +-
 src/plugins/vcalendar/plugin.def                   |  10 --
 src/plugins/vcalendar/vcal_folder.c                |   5 +-
 src/plugins/vcalendar/vcal_meeting_gtk.c           |  15 +-
 src/plugins/vcalendar/vcalendar.c                  |  20 +--
 src/plugins/win_pgpcore.mk                         |  15 ++
 src/plugins/win_plugin.mk                          |  27 ++++
 src/prefs_actions.c                                |  33 ++--
 src/prefs_customheader.c                           |   9 +-
 src/prefs_display_header.c                         |   8 +-
 src/prefs_filtering.c                              |  24 +--
 src/prefs_filtering_action.c                       |   8 +-
 src/prefs_folder_column.c                          |   8 +-
 src/prefs_folder_item.c                            |   6 +-
 src/prefs_matcher.c                                |  12 +-
 src/prefs_migration.c                              |   5 +-
 src/prefs_other.c                                  |   8 +-
 src/prefs_summaries.c                              |   6 +-
 src/prefs_summary_column.c                         |   8 +-
 src/prefs_summary_open.c                           |   6 +-
 src/prefs_template.c                               |  28 ++--
 src/prefs_themes.c                                 |  12 +-
 src/send_message.c                                 |   6 +-
 src/ssl_manager.c                                  |   8 +-
 src/summary_search.c                               |   9 +-
 src/summaryview.c                                  |  49 +++---
 src/textview.c                                     |   6 +-
 src/toolbar.c                                      |  10 +-
 src/uri_opener.c                                   |   8 +-
 160 files changed, 742 insertions(+), 2621 deletions(-)
 delete mode 100644 src/plugins/address_keeper/claws.def
 delete mode 100644 src/plugins/address_keeper/plugin.def
 delete mode 100644 src/plugins/att_remover/claws.def
 delete mode 100644 src/plugins/att_remover/plugin.def
 delete mode 100644 src/plugins/attachwarner/claws.def
 delete mode 100644 src/plugins/attachwarner/plugin.def
 delete mode 100644 src/plugins/bsfilter/claws.def
 delete mode 100644 src/plugins/bsfilter/plugin.def
 delete mode 100644 src/plugins/fancy/claws.def
 delete mode 100644 src/plugins/fancy/plugin.def
 delete mode 100644 src/plugins/fetchinfo/claws.def
 delete mode 100644 src/plugins/fetchinfo/plugin.def
 delete mode 100644 src/plugins/libravatar/claws.def
 delete mode 100644 src/plugins/libravatar/plugin.def
 delete mode 100644 src/plugins/litehtml_viewer/claws.def
 delete mode 100644 src/plugins/litehtml_viewer/plugin.def
 delete mode 100644 src/plugins/mailmbox/claws.def
 delete mode 100644 src/plugins/mailmbox/plugin.def
 delete mode 100644 src/plugins/managesieve/claws.def
 delete mode 100644 src/plugins/managesieve/plugin.def
 delete mode 100644 src/plugins/notification/claws.def
 delete mode 100644 src/plugins/notification/plugin.def
 delete mode 100644 src/plugins/pdf_viewer/claws.def
 delete mode 100644 src/plugins/pdf_viewer/plugin.def
 delete mode 100644 src/plugins/pgpcore/claws.def
 delete mode 100644 src/plugins/pgpcore/plugin.def
 delete mode 100644 src/plugins/pgpinline/claws.def
 delete mode 100644 src/plugins/pgpinline/mypgpcore.def
 delete mode 100644 src/plugins/pgpinline/plugin.def
 delete mode 100644 src/plugins/pgpmime/claws.def
 delete mode 100644 src/plugins/pgpmime/mypgpcore.def
 delete mode 100644 src/plugins/pgpmime/plugin.def
 delete mode 100644 src/plugins/rssyl/claws.def
 delete mode 100644 src/plugins/rssyl/plugin.def
 delete mode 100644 src/plugins/smime/claws.def
 delete mode 100644 src/plugins/smime/mypgpcore.def
 delete mode 100644 src/plugins/smime/plugin.def
 delete mode 100644 src/plugins/spam_report/claws.def
 delete mode 100644 src/plugins/spam_report/plugin.def
 delete mode 100644 src/plugins/tnef_parse/claws.def
 delete mode 100644 src/plugins/tnef_parse/plugin.def
 delete mode 100644 src/plugins/vcalendar/claws.def
 delete mode 100644 src/plugins/vcalendar/plugin.def
 create mode 100644 src/plugins/win_pgpcore.mk
 create mode 100644 src/plugins/win_plugin.mk


- Log -----------------------------------------------------------------
commit 0f32afba90be2c42ca82c041dbdeaeaf0b30e6f1
Merge: cf28b240c 16aa94775
Author: Thorsten Maerz <info at netztorte.de>
Date:   Fri Feb 4 17:03:12 2022 +0100

    Merge branch 'gtk3' into gtk3tree

diff --cc src/folderview.c
index bd8e9d3f4,a532e133c..5dbe2c11f
--- a/src/folderview.c
+++ b/src/folderview.c
@@@ -2055,311 -1280,230 +2055,311 @@@ void folderview_check_new_all(void
  	inc_unlock();
  }
  
 -static gboolean folderview_have_children_sub(FolderView *folderview,
 -					     FolderItem *item,
 -					     gboolean in_sub)
 +void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
 +			    FolderItem *to_folder, gboolean copy)
  {
 -	GNode *node = NULL;
 -	
 -	if (!item || !item->folder || !item->folder->node)
 -		return FALSE;
 -		
 -	node = item->folder->node;
 -	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	FolderItem *new_folder = NULL;
 +	gchar *buf;
 +	gint status;
  
 -	if (in_sub && item->total_msgs > 0) {
 -		return TRUE;
 -	}
 +	cm_return_if_fail(folderview != NULL);
 +	cm_return_if_fail(from_folder != NULL);
 +	cm_return_if_fail(to_folder != NULL);
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_children_sub(folderview, 
 -							 next_item, TRUE))
 -				return TRUE;
 -		}
 -	}
 +	if (prefs_common.warn_dnd) {
 +		buf = g_strdup_printf(copy ? _("Do you really want to copy folder '%s' in '%s'?"):
 +					     _("Do you really want to make folder '%s' a subfolder of '%s'?"),
 +					from_folder->name, to_folder->name);
 +		status = alertpanel_full(copy ? _("Copy folder"):_("Move folder"), buf,
- 					 _("_No"), _("_Yes"), NULL, ALERTFOCUS_FIRST,
- 					TRUE, NULL, ALERT_QUESTION);
++				       	 NULL, _("_No"), NULL, _("_Yes"), NULL, NULL,
++					 ALERTFOCUS_FIRST, TRUE, NULL, ALERT_QUESTION);
 +		g_free(buf);
  
 -	return FALSE;
 -}
 +		if ((status & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
 +			return;
 +		else if (status & G_ALERTDISABLE)
 +			prefs_common.warn_dnd = FALSE;
 +	}
  
 -static gboolean folderview_have_children(FolderView *folderview,
 -					 FolderItem *item)
 -{
 -	return folderview_have_children_sub(folderview, item, FALSE);
 -}
 +	buf = g_strdup_printf(copy ? _("Copying %s to %s..."):_("Moving %s to %s..."),
 +				from_folder->name, to_folder->name);
 +	STATUSBAR_PUSH(folderview->mainwin, buf);
 +	g_free(buf);
 +	summary_clear_all(folderview->summaryview);
 +	gtk_widget_set_sensitive(GTK_WIDGET(folderview->treeview), FALSE);
 +	inc_lock();
 +	main_window_cursor_wait(folderview->mainwin);
  
 -static gboolean folderview_have_new_children_sub(FolderView *folderview,
 -						 FolderItem *item,
 -						 gboolean in_sub)
 +	statusbar_verbosity_set(FALSE);
 +	folder_item_update_freeze();
 +	folderview_freeze(folderview);
 +	if ((status = folder_item_move_to(from_folder, to_folder, &new_folder, copy)) == F_MOVE_OK) {
 +		statusbar_verbosity_set(FALSE);
 +		main_window_cursor_normal(folderview->mainwin);
 +		STATUSBAR_POP(folderview->mainwin);
 +		folder_item_update_thaw();
 +		folder_item_update_recursive(new_folder, F_ITEM_UPDATE_MSGCNT);
 +		folderview_select(folderview, new_folder);
 +		folderview_thaw(folderview);
 +	} else {
 +		statusbar_verbosity_set(FALSE);
 +		main_window_cursor_normal(folderview->mainwin);
 +		STATUSBAR_POP(folderview->mainwin);
 +		folderview_thaw(folderview);
 +		folder_item_update_thaw();
 +		switch (status) {
 +		case F_MOVE_FAILED_DEST_IS_PARENT:
 +			alertpanel_error(_("Source and destination are the same."));
 +			break;
 +		case F_MOVE_FAILED_DEST_IS_CHILD:
 +			alertpanel_error(copy ? _("Can't copy a folder to one of its children."):
 +						_("Can't move a folder to one of its children."));
 +			break;
 +		case F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX:
 +			alertpanel_error(_("A folder cannot be moved between different mailboxes."));
 +			break;
 +		default:
 +			alertpanel_error(copy ? _("Copy failed!"):_("Move failed!"));
 +			break;
 +		}
 +	}
 +	inc_unlock();
 +	gtk_widget_set_sensitive(GTK_WIDGET(folderview->treeview), TRUE);
 +}
 +
 +void folderview_set_target_folder_color(GdkRGBA color_op)
  {
 -	GNode *node = NULL;
 -	
 -	if (!item || !item->folder || !item->folder->node)
 -		return FALSE;
 -		
 -	node = item->folder->node;
 -	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	GList *list;
 +	FolderView *folderview;
  
 -	if (in_sub &&
 -	    (item->new_msgs > 0 ||
 -	    (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0))) {
 -		return TRUE;
 -	}
 +	debug_print("folderview_set_target_folder_color\n");
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_new_children_sub(folderview, 
 -							     next_item, TRUE))
 -				return TRUE;
 -		}
 +	for (list = folderview_list; list != NULL; list = list->next) {
 +		folderview = (FolderView *)list->data;
 +		folderview->color_op = color_op;
  	}
 +}
  
 -	return FALSE;
 +void folderview_reinit_fonts(FolderView *folderview)
 +{
 +/* TM: not necessary (and useless, unless folderview_reflect_prefs() is called)
 +	debug_print("========STUB======== folderview_reinit_fonts\n");
 +*/
  }
  
 -static gboolean folderview_have_new_children(FolderView *folderview,
 -					     FolderItem *item)
 +/* TODO: this function will eventually set normal or bold fonts,
 + * text color, etc. */
 +static gboolean update_prefs_func(GtkTreeModel *model, GtkTreePath *path,
 +				  GtkTreeIter *iter, gpointer user_data)
  {
 -	return folderview_have_new_children_sub(folderview, item, FALSE);
 +	FolderView *folderview = (FolderView *)user_data;
 +
 +	folderview_update_row_iter(folderview, iter, NULL);
 +//	gtk_tree_store_set(GTK_TREE_STORE(model), iter,
 +//			F_COL_FONT, folderview->normal_font,
 +//			-1);
 +
 +	return FALSE;
  }
  
 -static gboolean folderview_have_unread_children_sub(FolderView *folderview,
 -						    FolderItem *item, 
 -						    gboolean in_sub)
 +void folderview_reflect_prefs(FolderView *folderview)
  {
 -	GNode *node = NULL;
 -	
 -	if (!item || !item->folder || !item->folder->node)
 -		return FALSE;
 -	
 -	node = item->folder->node;
 +	gboolean update_font = FALSE;
 +
 +	debug_print("folderview_reflect_prefs\n");
 +
 +	cm_return_if_fail(folderview != NULL);
 +
 +	/* Check if fonts have changed */
 +	gchar *last_normal_font =
 +		pango_font_description_to_string(folderview->normal_font);
 +	if (strcmp(last_normal_font, NORMAL_FONT))
 +		update_font = TRUE;
 +	g_free(last_normal_font);
  	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	folderview->color_new = prefs_common.color[COL_NEW];
 +	folderview->color_op = prefs_common.color[COL_TGT_FOLDER];
  
 -	if (in_sub &&
 -	    (item->unread_msgs > 0 ||
 -	    (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0))) {
 -		return TRUE;
 -	}
 +	gchar *last_bold_font =
 +		pango_font_description_to_string(folderview->bold_font);
 +	if (strcmp(last_bold_font, BOLD_FONT))
 +		update_font = TRUE;
 +	g_free(last_bold_font);
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_unread_children_sub(folderview, 
 -							        next_item, 
 -								TRUE))
 -				return TRUE;
 -		}
 +// 	/* Check if color_new has changed */
 +// 	gint last_color_new = gtkut_convert_gdk_color_to_int(&folderview->color_new);
 +// 	if (last_color_new != prefs_common.color_new)
 +// 		update_color = TRUE;
 +
 +	if (update_font) {
 +		debug_print("updating folderview fonts\n");
 +		pango_font_description_free(folderview->normal_font);
 +		pango_font_description_free(folderview->bold_font);
 +		folderview->normal_font = pango_font_description_from_string(NORMAL_FONT);
 +		folderview->bold_font = pango_font_description_from_string(BOLD_FONT);
  	}
  
 -	return FALSE;
 -}
 +// 	if (update_color) {
 +// 		debug_print("updating folderview colors\n");
 +// 
 +// 		GdkColormap *colormap =
 +// 			gdk_drawable_get_colormap(gtk_widget_get_window(
 +// 						folderview->mainwin->window));
 +// 		gdk_colormap_alloc_color(colormap, &folderview->color_new, TRUE, FALSE);
 +// 	}
  
 -static gboolean folderview_have_unread_children(FolderView *folderview,
 -						FolderItem *item)
 -{
 -	return folderview_have_unread_children_sub(folderview, item, FALSE);
 +// 	if (update_font || update_color) {
 +	if (update_font) {
 +		GtkTreeModel *model =
 +			gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
 +
 +		/* Apply new fonts to all rows */
 +		gtk_tree_model_foreach(model, update_prefs_func, folderview);
 +	}
  }
  
 -static gboolean folderview_have_read_children_sub(FolderView *folderview,
 -						    FolderItem *item, 
 -						    gboolean in_sub)
 +static GtkActionGroup *create_action_group(FolderView *folderview,
 +					   FolderViewPopup *fpopup)
  {
 -	GNode *node = NULL;
 -	
 -	if (!item || !item->folder || !item->folder->node) {
 -		return FALSE;
 -	}			
 +	FolderViewPopup *fpopup_common;
 +	GtkActionGroup *action_group;
  
 -	node = item->folder->node;
 -	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	action_group = cm_menu_create_action_group(
 +				fpopup->path,
 +				fpopup->entries, fpopup->n_entries,
 +				(gpointer)folderview);
  
 -	if (in_sub &&
 -	    (((item->total_msgs > 0) &&
 -		(item->unread_msgs != (item->total_msgs - item->ignored_msgs))))) {
 -		return TRUE;
 -	}
 +	if (fpopup->toggle_entries)
 +		gtk_action_group_add_toggle_actions(action_group, fpopup->toggle_entries,
 +				fpopup->n_toggle_entries,
 +				(gpointer)folderview);
 +	if (fpopup->radio_entries)
 +		gtk_action_group_add_radio_actions(action_group, fpopup->radio_entries,
 +				fpopup->n_radio_entries, fpopup->radio_default,
 +				G_CALLBACK(fpopup->radio_callback),
 +				(gpointer)folderview);
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_read_children_sub(folderview, 
 -							        next_item, 
 -								TRUE)) {
 -				return TRUE;
 -			}
 -		}
 +	fpopup_common = g_hash_table_lookup(folderview_popups, "common");
 +	if (fpopup_common != fpopup) {
 +		gtk_action_group_add_actions(action_group, fpopup_common->entries,
 +				fpopup_common->n_entries,
 +				(gpointer)folderview);
 +		if (fpopup_common->toggle_entries)
 +			gtk_action_group_add_toggle_actions(action_group, fpopup_common->toggle_entries,
 +					fpopup_common->n_toggle_entries,
 +					(gpointer)folderview);
 +		if (fpopup_common->radio_entries)
 +			gtk_action_group_add_radio_actions(action_group, fpopup_common->radio_entries,
 +					fpopup_common->n_radio_entries, fpopup_common->radio_default,
 +					G_CALLBACK(fpopup_common->radio_callback),
 +					(gpointer)folderview);
  	}
  
 -	return FALSE;
 +	return action_group;
  }
  
 -static gboolean folderview_have_read_children(FolderView *folderview,
 -						FolderItem *item)
 +static void create_action_groups(gpointer key, gpointer value, gpointer data)
  {
 -	return folderview_have_read_children_sub(folderview, item, FALSE);
 +	FolderView *folderview = data;
 +	FolderViewPopup *fpopup = value;
 +	GtkActionGroup *group;
 +
 +	group = create_action_group(folderview, fpopup);
 +	g_hash_table_insert(folderview->popups, fpopup->klass, group);
  }
  
 -static gboolean folderview_have_matching_children_sub(FolderView *folderview,
 -						      FolderItem *item,
 -						      gboolean in_sub)
 +void folderview_register_popup(FolderViewPopup *fpopup)
  {
 -	GNode *node = NULL;
 +	GList *folderviews;
  
 -	if (!item || !item->folder || !item->folder->node)
 -		return FALSE;
 +	cm_return_if_fail(fpopup != NULL);
  
 -	node = item->folder->node;
 -	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	debug_print("folderview_register_popup %s (%s)\n",
 +			fpopup->klass, fpopup->path);
  
 -	if (in_sub && item->search_match){
 -		return TRUE;
 -	}
 +	for (folderviews = folderview_list; folderviews != NULL; folderviews = g_list_next(folderviews)) {
 +		FolderView *folderview = folderviews->data;
 +		GtkActionGroup *factory;
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_matching_children_sub(folderview, 
 -							          next_item, 
 -								  TRUE))
 -				return TRUE;
 -		}
 +		factory = create_action_group(folderview, fpopup);
 +		g_hash_table_insert(folderview->popups, fpopup->klass, factory);
  	}
  
 -	return FALSE;
 +	g_hash_table_insert(folderview_popups, fpopup->klass, fpopup);
  }
  
 -static gboolean folderview_have_matching_children(FolderView *folderview,
 -						  FolderItem *item)
 +void folderview_unregister_popup(FolderViewPopup *fpopup)
  {
 -	return folderview_have_matching_children_sub(folderview, item, FALSE);
 +	GList *folderviews;
 +
 +	cm_return_if_fail(fpopup != NULL);
 +
 +	debug_print("folderview_unregister_popup %s (%s)\n",
 +			fpopup->klass, fpopup->path);
 +
 +	for (folderviews = folderview_list; folderviews != NULL; folderviews = g_list_next(folderviews)) {
 +		FolderView *folderview = folderviews->data;
 +		g_hash_table_remove(folderview->popups, fpopup->klass);
 +	}
 +
 +	g_hash_table_remove(folderview_popups, fpopup->klass);
  }
  
 -static gboolean folderview_have_marked_children_sub(FolderView *folderview,
 -						    FolderItem *item,
 -						    gboolean in_sub)
 +void free_paths_to_recollapse(GSList *paths_to_recollapse)
  {
 -	GNode *node = NULL;
 -	
 -	if (!item || !item->folder || !item->folder->node)
 -		return FALSE;
 -		
 -	node = item->folder->node;
 -	
 -	node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
 -	node = node->children;
 +	GSList *list;
 +	for (list=paths_to_recollapse; list; list = g_slist_next(list))
 +		gtk_tree_path_free(list->data);
 +}
 +static void folderview_recollapse_paths(FolderView *folderview,
 +					GtkTreePath *path)
 +{
 +	GSList *list = NULL;
 +	GSList *done = NULL;
  
 -	if (item->marked_msgs != 0) {
 -		return TRUE;
 +	for (list = folderview->paths_to_recollapse; list != NULL; list = g_slist_next(list)) {
 +		GtkTreePath *listpath = list->data;
 +		if (!gtk_tree_path_is_ancestor(listpath, path)
 +		&&  listpath != path) {
 +			gtk_tree_view_collapse_row(GTK_TREE_VIEW(folderview->treeview),
 +						   listpath);
 +			done = g_slist_append(done, listpath);
 +			gtk_tree_path_free(listpath);
 +		}
 +	}
 +	for (list = done; list != NULL; list = g_slist_next(list)) {
 +		folderview->paths_to_recollapse = g_slist_remove(folderview->paths_to_recollapse,
 +								 list->data);
  	}
 +	g_slist_free(done);
 +}
  
 -	while (node != NULL) {
 -		if (node && node->data) {
 -			FolderItem *next_item = (FolderItem*) node->data;
 -			node = node->next;
 -			if (folderview_have_marked_children_sub(folderview,
 -							        next_item, TRUE))
 -				return TRUE;
 -		}
 +static void drag_state_stop(FolderView *folderview)
 +{
 +	if (folderview->drag_timer_id)
 +		g_source_remove(folderview->drag_timer_id);
 +	folderview->drag_timer_id = 0;
 +	if (folderview->drag_dst_path) {
 +		gtk_tree_path_free(folderview->drag_dst_path);
 +		folderview->drag_dst_path = NULL;
  	}
 +}
  
 +static gboolean folderview_defer_expand(FolderView *folderview)
 +{
 +	if (folderview->drag_dst_path) {
 +		folderview_recollapse_paths(folderview, folderview->drag_dst_path);
 +		if (folderview->drag_dst_item->collapsed) {
 +			gtk_tree_view_expand_row(GTK_TREE_VIEW(folderview->treeview),
 +						 folderview->drag_dst_path, FALSE);
 +			/* reverse order: child doesn't get closed, if parent is already closed. */
 +			folderview->paths_to_recollapse = g_slist_insert
 +				(folderview->paths_to_recollapse,
 +				 gtk_tree_path_copy(folderview->drag_dst_path), 0);
 +		}
 +	}
 +	folderview->drag_dst_item  = NULL;
 +	folderview->drag_timer_id = 0;
  	return FALSE;
  }
  
@@@ -3251,203 -2561,770 +3251,203 @@@ static void folderview_send_queue_cb(Gt
  	if (procmsg_send_queue(item, prefs_common.savemsg, &errstr) < 0) {
  		if (!errstr)
  			alertpanel_error_log(_("Some errors occurred while "
 -					   "sending queued messages."));
 -		else {
 -			alertpanel_error_log(_("Some errors occurred "
 -					"while sending queued messages:\n%s"), errstr);
 -			g_free(errstr);
 -		}
 -	}
 -}
 -
 -static void folderview_search_cb(GtkAction *action, gpointer data)
 -{
 -	FolderView *folderview = (FolderView *)data;
 -	summary_search(folderview->summaryview);
 -}
 -
 -static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 -{
 -	FolderView *folderview = (FolderView *)data;
 -	FolderItem *item;
 -
 -	if (!folderview->selected) return;
 -
 -	item = folderview_get_selected_item(folderview);
 -
 -	folderview_run_processing(item);
 -}
 -
 -void folderview_run_processing(FolderItem *item)
 -{
 -	cm_return_if_fail(item != NULL);
 -	cm_return_if_fail(item->folder != NULL);
 -
 -	item->processing_pending = TRUE;
 -	folder_item_apply_processing(item);
 -	item->processing_pending = FALSE;
 -}
 -
 -static void folderview_property_cb(GtkAction *action, gpointer data)
 -{
 -	FolderView *folderview = (FolderView *)data;
 -	FolderItem *item;
 -
 -	if (!folderview->selected) return;
 -
 -	item = folderview_get_selected_item(folderview);
 -	cm_return_if_fail(item != NULL);
 -	cm_return_if_fail(item->folder != NULL);
 -
 -	prefs_folder_item_open(item);
 -}
 -
 -static void folderview_recollapse_nodes(FolderView *folderview, GtkCMCTreeNode *node)
 -{
 -	GSList *list = NULL;
 -	GSList *done = NULL;
 -	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 -	
 -	for (list = folderview->nodes_to_recollapse; list != NULL; list = g_slist_next(list)) {
 -		if (!gtkut_ctree_node_is_parent(GTK_CMCTREE_NODE(list->data), node)
 -		&&  list->data != node) {
 -			gtk_cmctree_collapse(ctree, GTK_CMCTREE_NODE(list->data));
 -			done = g_slist_append(done, GTK_CMCTREE_NODE(list->data));
 -		}
 -	}
 -	for (list = done; list != NULL; list = g_slist_next(list)) {
 -		folderview->nodes_to_recollapse = g_slist_remove(folderview->nodes_to_recollapse, 
 -								 list->data);
 -	}
 -	g_slist_free(done);
 -}
 -
 -void folderview_move_folder(FolderView *folderview, FolderItem *from_folder,
 -		            FolderItem *to_folder, gboolean copy)
 -{
 -	FolderItem *new_folder = NULL;
 -	gchar *buf;
 -	gint status;
 -
 -	cm_return_if_fail(folderview != NULL);
 -	cm_return_if_fail(from_folder != NULL);
 -	cm_return_if_fail(to_folder != NULL);
 -
 -	if (prefs_common.warn_dnd) {
 -		buf = g_strdup_printf(copy ? _("Do you really want to copy folder '%s' in '%s'?"):
 -					     _("Do you really want to make folder '%s' a subfolder of '%s'?"), 
 -					from_folder->name, to_folder->name);
 -		status = alertpanel_full(copy ? _("Copy folder"):_("Move folder"), buf,
 -				       	 NULL, _("_No"), NULL, _("_Yes"), NULL, NULL,
 -					 ALERTFOCUS_FIRST, TRUE, NULL, ALERT_QUESTION);
 -		g_free(buf);
 -
 -		if ((status & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
 -			return;
 -		else if (status & G_ALERTDISABLE)
 -			prefs_common.warn_dnd = FALSE;
 -	}
 -
 -	buf = g_strdup_printf(copy ? _("Copying %s to %s..."):_("Moving %s to %s..."), 
 -				from_folder->name, to_folder->name);
 -	STATUSBAR_PUSH(folderview->mainwin, buf);
 -	g_free(buf);
 -	summary_clear_all(folderview->summaryview);
 -	folderview->opened = NULL;
 -	folderview->selected = NULL;
 -	gtk_widget_set_sensitive(GTK_WIDGET(folderview->ctree), FALSE);
 -	inc_lock();
 -	main_window_cursor_wait(folderview->mainwin);
 -
 -	statusbar_verbosity_set(FALSE);
 -	folder_item_update_freeze();
 -	gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree));
 -	if ((status = folder_item_move_to(from_folder, to_folder, &new_folder, copy)) == F_MOVE_OK) {
 -		statusbar_verbosity_set(FALSE);
 -		main_window_cursor_normal(folderview->mainwin);
 -		STATUSBAR_POP(folderview->mainwin);
 -		folder_item_update_thaw();
 -		folder_item_update_recursive(new_folder, F_ITEM_UPDATE_MSGCNT);
 -
 -		folderview_sort_folders(folderview, 
 -			gtk_cmctree_find_by_row_data(GTK_CMCTREE(folderview->ctree), 
 -				NULL, to_folder), new_folder->folder);
 -		folderview_select(folderview, new_folder);
 -		gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
 -	} else {
 -		statusbar_verbosity_set(FALSE);		
 -		main_window_cursor_normal(folderview->mainwin);
 -		STATUSBAR_POP(folderview->mainwin);
 -		gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
 -		folder_item_update_thaw();
 -		switch (status) {
 -		case F_MOVE_FAILED_DEST_IS_PARENT:
 -			alertpanel_error(_("Source and destination are the same."));
 -			break;
 -		case F_MOVE_FAILED_DEST_IS_CHILD:
 -			alertpanel_error(copy ? _("Can't copy a folder to one of its children."):
 -						_("Can't move a folder to one of its children."));
 -			break;
 -		case F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX:
 -			alertpanel_error(_("A folder cannot be moved between different mailboxes."));
 -			break;
 -		default:
 -			alertpanel_error(copy ? _("Copy failed!"):_("Move failed!"));
 -			break;
 -		}
 -	}	
 -	inc_unlock();		
 -	gtk_widget_set_sensitive(GTK_WIDGET(folderview->ctree), TRUE);
 -}
 -
 -static gint folderview_clist_compare(GtkCMCList *clist,
 -				     gconstpointer ptr1, gconstpointer ptr2)
 -{
 -	FolderItem *item1 = ((GtkCMCListRow *)ptr1)->data;
 -	FolderItem *item2 = ((GtkCMCListRow *)ptr2)->data;
 -
 -	if (item1->order > 0 && item2->order > 0)  // if we have an order item, use it
 -	{
 -		return item1->order - item2->order;
 -	}
 -
 -	// if only one folder has an order it comes first
 -	if (item1->order > 0)
 -	{
 -		return -1;
 -	}
 -	if (item2->order > 0)
 -	{
 -		return 1;
 -	}
 -
 -	if (!item1->name)
 -		return (item2->name != NULL);
 -	if (!item2->name)
 -		return -1;
 -
 -	return g_utf8_collate(item1->name, item2->name);
 -}
 -
 -static void folderview_processing_cb(GtkAction *action, gpointer data)
 -{
 -	FolderView *folderview = (FolderView *)data;
 -	FolderItem *item;
 -	gchar *id, *title;
 -
 -	if (!folderview->selected) return;
 -
 -	item = folderview_get_selected_item(folderview);
 -	cm_return_if_fail(item != NULL);
 -	cm_return_if_fail(item->folder != NULL);
 -
 -	id = folder_item_get_identifier(item);
 -	title = g_strdup_printf (_("Processing configuration for folder %s"), id);
 -	g_free (id);
 -
 -	prefs_filtering_open(&item->prefs->processing, title,
 -			MANUAL_ANCHOR_PROCESSING, NULL, NULL, FALSE);
 -	g_free (title);
 -}
 -
 -void folderview_set_target_folder_color(GdkRGBA color_op)
 -{
 -	GList *list;
 -	FolderView *folderview;
 -
 -	for (list = folderview_list; list != NULL; list = list->next) {
 -		folderview = (FolderView *)list->data;
 -		folderview->color_op = color_op;
 -	}
 -}
 -
 -static gchar *last_smallfont = NULL;
 -static gchar *last_normalfont = NULL;
 -static gchar *last_boldfont = NULL;
 -static gboolean last_derive = 0;
 -
 -void folderview_reinit_fonts(FolderView *folderview)
 -{
 -	/* force reinit */
 -	g_free(last_smallfont);
 -	last_smallfont = NULL;
 -	g_free(last_normalfont);
 -	last_normalfont = NULL;
 -	g_free(last_boldfont);
 -	last_boldfont = NULL;
 -}
 -
 -void folderview_reflect_prefs(void)
 -{
 -	gboolean update_font = FALSE;
 -	FolderView *folderview = mainwindow_get_mainwindow()->folderview;
 -	FolderItem *item = folderview_get_selected_item(folderview);
 -	GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
 -				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
 -	gint height = gtk_adjustment_get_value(pos);
 -
 -	folderview->color_new = prefs_common.color[COL_NEW];
 -	folderview->color_op = prefs_common.color[COL_TGT_FOLDER];
 -
 -	if (!last_smallfont || strcmp(last_smallfont, SMALL_FONT) ||
 -			!last_normalfont || strcmp(last_normalfont, NORMAL_FONT) ||
 -			!last_boldfont || strcmp(last_boldfont, BOLD_FONT) ||
 -			last_derive != prefs_common.derive_from_normal_font)
 -		update_font = TRUE;
 -
 -	if (!update_font)
 -		return;
 -
 -	g_free(last_smallfont);
 -	last_smallfont = g_strdup(SMALL_FONT);
 -	g_free(last_normalfont);
 -	last_normalfont = g_strdup(NORMAL_FONT);
 -	g_free(last_boldfont);
 -	last_boldfont = g_strdup(BOLD_FONT);
 -	last_derive = prefs_common.derive_from_normal_font;
 -
 -	folderview_set_fonts(folderview);
 -
 -	gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree));
 -	folderview_column_set_titles(folderview);
 -	folderview_set_all();
 -
 -	g_signal_handlers_block_by_func
 -		(G_OBJECT(folderview->ctree),
 -		 G_CALLBACK(folderview_selected), folderview);
 -
 -	if (item) {
 -		GtkCMCTreeNode *node = gtk_cmctree_find_by_row_data(
 -			GTK_CMCTREE(folderview->ctree), NULL, item);
 -
 -		folderview_select(folderview, item);
 -		folderview->open_folder = FALSE;
 -		folderview->selected = node;
 -	}
 -
 -	g_signal_handlers_unblock_by_func
 -		(G_OBJECT(folderview->ctree),
 -		 G_CALLBACK(folderview_selected), folderview);
 -
 -	pos = gtk_scrolled_window_get_vadjustment(
 -				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
 -	gtk_adjustment_set_value(pos, height);
 -	gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
 -}
 -
 -static void drag_state_stop(FolderView *folderview)
 -{
 -	if (folderview->drag_timer_id)
 -		g_source_remove(folderview->drag_timer_id);
 -	folderview->drag_timer_id = 0;
 -	folderview->drag_node = NULL;
 -}
 -
 -static gboolean folderview_defer_expand(FolderView *folderview)
 -{
 -	if (folderview->drag_node) {
 -		folderview_recollapse_nodes(folderview, folderview->drag_node);
 -		if (folderview->drag_item->collapsed) {
 -			gtk_cmctree_expand(GTK_CMCTREE(folderview->ctree), folderview->drag_node);
 -			folderview->nodes_to_recollapse = g_slist_append
 -				(folderview->nodes_to_recollapse, folderview->drag_node);
 -		}
 -	}
 -	folderview->drag_item  = NULL;
 -	folderview->drag_timer_id = 0;
 -	return FALSE;
 -}
 -
 -static void drag_state_start(FolderView *folderview, GtkCMCTreeNode *node, FolderItem *item)
 -{
 -	/* the idea is that we call drag_state_start() whenever we want expansion to
 -	 * start after 'prefs_common.hover_time' msecs. if we want to cancel expansion,
 -	 * we need to call drag_state_stop() */
 -	drag_state_stop(folderview);
 -	/* request expansion */
 -	if (0 != (folderview->drag_timer_id = g_timeout_add
 -			(prefs_common.hover_timeout, 
 -			 (GSourceFunc)folderview_defer_expand,
 -			 folderview))) {
 -		folderview->drag_node = node;
 -		folderview->drag_item = item;
 -	}			 
 -}
 -#ifndef GENERIC_UMPC
 -static void folderview_start_drag(GtkWidget *widget, gint button, GdkEvent *event,
 -			          FolderView       *folderview)
 -{
 -	GdkDragContext *context;
 -
 -	cm_return_if_fail(folderview != NULL);
 -	if (folderview->selected == NULL) return;
 -	if (folderview->nodes_to_recollapse) 
 -		g_slist_free(folderview->nodes_to_recollapse);
 -	folderview->nodes_to_recollapse = NULL;
 -	context = gtk_drag_begin_with_coordinates(widget, folderview->target_list,
 -				 GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_DEFAULT, button, event,
 -				 -1, -1);
 -	gtk_drag_set_icon_default(context);
 -}
 -#endif
 -static void folderview_drag_data_get(GtkWidget        *widget,
 -				     GdkDragContext   *drag_context,
 -				     GtkSelectionData *selection_data,
 -				     guint             info,
 -				     guint             time,
 -				     FolderView       *folderview)
 -{
 -	FolderItem *item;
 -	GList *sel;
 -	if (info == TARGET_DUMMY) {
 -		sel = GTK_CMCLIST(folderview->ctree)->selection;
 -		if (!sel)
 -			return;
 -
 -		item = gtk_cmctree_node_get_row_data
 -			(GTK_CMCTREE(folderview->ctree),
 -			 GTK_CMCTREE_NODE(sel->data));
 -		if (item) {
 -			gchar *source = NULL;
 -			gchar *name = folder_item_get_identifier(item);
 -			source = g_strdup_printf ("FROM_OTHER_FOLDER%s", name);
 -			g_free(name);
 -			gtk_selection_data_set(selection_data,
 -					       gtk_selection_data_get_target(selection_data), 8,
 -					       source, strlen(source));
 -		}
 -	} else {
 -		g_warning("unknown info %d", info);
 -	}
 -}
 -
 -static gboolean folderview_update_folder(gpointer source, gpointer userdata)
 -{
 -	FolderUpdateData *hookdata;
 -	FolderView *folderview;
 -	GtkWidget *ctree;
 -
 -	hookdata = source;
 -	folderview = (FolderView *) userdata;	
 -	cm_return_val_if_fail(hookdata != NULL, FALSE);
 -	cm_return_val_if_fail(folderview != NULL, FALSE);
 -
 -	ctree = folderview->ctree;
 -	cm_return_val_if_fail(ctree != NULL, FALSE);
 -
 -	if (hookdata->update_flags & FOLDER_ADD_FOLDERITEM)
 -		folderview_create_folder_node(folderview, hookdata->item);
 -	else if (hookdata->update_flags & FOLDER_RENAME_FOLDERITEM) {
 -		GtkCMCTreeNode *node = gtk_cmctree_find_by_row_data(GTK_CMCTREE(ctree),
 -				NULL, folder_item_parent(hookdata->item));
 -		folderview_sort_folders(folderview, node, hookdata->folder);
 -	} else if (hookdata->update_flags & FOLDER_REMOVE_FOLDERITEM) {
 -		GtkCMCTreeNode *node;
 -
 -		node = gtk_cmctree_find_by_row_data(GTK_CMCTREE(ctree), NULL, hookdata->item);
 -		if (node != NULL) {
 -			gtk_cmctree_remove_node(GTK_CMCTREE(ctree), node);
 -			if (folderview->selected == node)
 -				folderview->selected = NULL;
 -			if (folderview->opened == node)
 -				folderview->opened = NULL;
 -		}
 -	} else if (hookdata->update_flags & FOLDER_MOVE_FOLDERITEM) {
 -		/* do nothing, it's done by the ADD and REMOVE) */
 -	} else if (hookdata->update_flags & (FOLDER_TREE_CHANGED | FOLDER_ADD_FOLDER | FOLDER_REMOVE_FOLDER))
 -		folderview_set(folderview);
 -
 -	return FALSE;
 -}
 -
 -static gboolean folderview_dnd_scroll_cb(gpointer data)
 -{
 -	FolderView *folderview = (FolderView *)data;
 -	GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
 -				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
 -	gint new_val = (int)gtk_adjustment_get_value(pos) + folderview->scroll_value;
 -	gint max = (int)gtk_adjustment_get_upper(pos) -
 -               (int)gtk_adjustment_get_page_size(pos);
 -
 -	if (folderview->scroll_value == 0) {
 -		folderview->scroll_timeout_id = 0;
 -		return FALSE;
 -	}
 -
 -	if (folderview->scroll_value > 0 && new_val > max) {
 -		new_val = max;
 -	} else if (folderview->scroll_value < 0 && new_val < 0) {
 -		new_val = 0;
 -	}
 -	gtk_adjustment_set_value(pos, new_val);
 -	
 -	return TRUE;
 -}
 -
 -static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
 -					  GdkDragContext *context,
 -					  gint            x,
 -					  gint            y,
 -					  guint           time,
 -					  FolderView     *folderview)
 -{
 -	gint row, column;
 -	FolderItem *item = NULL, *src_item = NULL;
 -	GtkCMCTreeNode *node = NULL;
 -	gboolean acceptable = FALSE;
 -	GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
 -				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
 -	int height = (int)gtk_adjustment_get_page_size(pos);
 -	int total_height = (int)gtk_adjustment_get_upper(pos);
 -	int vpos = (int)gtk_adjustment_get_value(pos);
 -	int offset = prefs_common.show_col_headers ? 24:0;
 -	int dist;
 -
 -	if (gtk_cmclist_get_selection_info
 -		(GTK_CMCLIST(widget), x - offset, y - offset, &row, &column)) {
 -		GtkWidget *srcwidget;
 -
 -		if (y > height - (48 - offset) && height + vpos < total_height) {
 -			dist = -(height - (48 - offset) - y);
 -			folderview->scroll_value = 1.41f * (1+(dist / 6));
 -		} else if (y < 72 - (24 - offset) && y >= 0) {
 -			dist = 72 - (24 - offset) - y;
 -			folderview->scroll_value = -1.41f * (1+(dist / 6));
 -		} else {
 -			folderview->scroll_value = 0;
 -		}
 -		if (folderview->scroll_value != 0 && folderview->scroll_timeout_id == 0) {
 -			folderview->scroll_timeout_id = 
 -				g_timeout_add(30, folderview_dnd_scroll_cb,
 -					      folderview);
 -		}
 -
 -		node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
 -		item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
 -		src_item = folderview->summaryview->folder_item;
 -
 -		srcwidget = gtk_drag_get_source_widget(context);
 -		if (srcwidget == summary_get_main_widget(folderview->summaryview)) {
 -			/* comes from summaryview */
 -			/* we are copying messages, so only accept folder items that are not
 -			   the source item, are no root items and can copy messages */
 -			if (item && item->folder && folder_item_parent(item) != NULL && src_item &&
 -			    src_item != item && FOLDER_CLASS(item->folder)->copy_msg != NULL &&
 -			    FOLDER_TYPE(item->folder) != F_UNKNOWN)
 -				acceptable = TRUE;
 -		} else if (srcwidget == folderview->ctree) {
 -			/* comes from folderview */
 -			/* we are moving folder items, only accept folders that are not
 -                           the source items and can copy messages and create folder items */
 -			if (item && item->folder && src_item && src_item != item &&
 -			    FOLDER_CLASS(item->folder)->copy_msg != NULL &&
 -			    FOLDER_CLASS(item->folder)->create_folder != NULL &&
 -			    ((FOLDER_TYPE(item->folder) != F_UNKNOWN &&  FOLDER_TYPE(src_item->folder) != F_UNKNOWN)
 -			     || item->folder == src_item->folder))
 -				acceptable = TRUE;
 -		} else {
 -			/* comes from another app */
 -			/* we are adding messages, so only accept folder items that are 
 -			   no root items and can copy messages */
 -			if (item && item->folder && folder_item_parent(item) != NULL
 -			    && FOLDER_CLASS(item->folder)->add_msg != NULL &&
 -			    FOLDER_TYPE(item->folder) != F_UNKNOWN)
 -				acceptable = TRUE;
 -		}
 -	}
 -
 -	if (acceptable || (src_item && src_item == item))
 -		drag_state_start(folderview, node, item);
 -	
 -	if (acceptable) {
 -		g_signal_handlers_block_by_func
 -			(G_OBJECT(widget),
 -			 G_CALLBACK(folderview_selected), folderview);
 -		gtk_cmctree_select(GTK_CMCTREE(widget), node);
 -		g_signal_handlers_unblock_by_func
 -			(G_OBJECT(widget),
 -			 G_CALLBACK(folderview_selected), folderview);
 -		gdk_drag_status(context, 
 -					(gdk_drag_context_get_actions(context) == GDK_ACTION_COPY ?
 -					GDK_ACTION_COPY : GDK_ACTION_MOVE) , time);
 -	} else {
 -		if (folderview->opened)
 -			gtk_cmctree_select(GTK_CMCTREE(widget), folderview->opened);
 -		gdk_drag_status(context, 0, time);
 -	}
 -
 -	return acceptable;
 -}
 -
 -static void folderview_drag_leave_cb(GtkWidget      *widget,
 -				     GdkDragContext *context,
 -				     guint           time,
 -				     FolderView     *folderview)
 -{
 -	drag_state_stop(folderview);
 -	folderview->scroll_value = 0;
 -	gtk_cmctree_select(GTK_CMCTREE(widget), folderview->opened);
 -}
 -
 -static void free_info (gpointer stuff, gpointer data)
 -{
 -	g_free(stuff);
 -}
 -
 -void folderview_finish_dnd(const gchar *data, GdkDragContext *drag_context,
 -			   guint time, FolderItem *item)
 -{
 -	GList *list, *tmp;
 -	GSList *msglist = NULL;
 -	list = uri_list_extract_filenames(data);
 -	if (!(item && item->folder && folder_item_parent(item) != NULL
 -		    && FOLDER_CLASS(item->folder)->add_msg != NULL))
 -	{
 -		gtk_drag_finish(drag_context, FALSE, FALSE, time);
 -		debug_print("item doesn't fit\n");			
 -		return;
 -	}	
 -	if (!list) {
 -		gtk_drag_finish(drag_context, FALSE, FALSE, time);
 -		debug_print("list is empty\n");			
 -		return;
 -	}
 -	for (tmp = list; tmp != NULL; tmp = tmp->next) {
 -		MsgFileInfo *info = NULL;
 -
 -		if (file_is_email((gchar *)tmp->data)) {
 -			info = g_new0(MsgFileInfo, 1);
 -			info->msginfo = NULL;
 -			info->file = (gchar *)tmp->data;
 -			msglist = g_slist_prepend(msglist, info);
 -			debug_print("file is a mail\n");
 -		} else {
 -			debug_print("file isn't a mail\n");
 +					   "sending queued messages."));
 +		else {
 +			alertpanel_error_log(_("Some errors occurred "
 +					"while sending queued messages:\n%s"), errstr);
 +			g_free(errstr);
  		}
  	}
 -	if (msglist) {
 -		msglist = g_slist_reverse(msglist);
 -		folder_item_add_msgs(item, msglist, FALSE);
 -		g_slist_foreach(msglist, free_info, NULL);
 -		g_slist_free(msglist);
 -		gtk_drag_finish(drag_context, TRUE, FALSE, time);
 -	} else {
 -		gtk_drag_finish(drag_context, FALSE, FALSE, time);
 -	}
 -	list_free_strings_full(list);
  }
  
 -static void folderview_drag_received_cb(GtkWidget        *widget,
 -					GdkDragContext   *drag_context,
 -					gint              x,
 -					gint              y,
 -					GtkSelectionData *data,
 -					guint             info,
 -					guint             time,
 -					FolderView       *folderview)
 +static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
  {
 -	gint row, column;
 -	FolderItem *item = NULL, *src_item;
 -	GtkCMCTreeNode *node;
 -	int offset = prefs_common.show_col_headers ? 24:0;
 +	FolderView *folderview = (FolderView *)data;
 +	FolderItem *item;
 +	GSList *mlist = NULL;
 +	GSList *cur = NULL;
 +	FolderItem *special_trash = NULL;
 +	PrefsAccount *ac;
  
 -	folderview->scroll_value = 0;
 +	item = folderview->menu_item;
 +	cm_return_if_fail(item != NULL);
 +	cm_return_if_fail(item->folder != NULL);
  
 -	if (info == TARGET_DUMMY) {
 -		drag_state_stop(folderview);
 -		const gchar *ddata = (const gchar *)gtk_selection_data_get_data(data);
 -		if ((gchar *)strstr(ddata, "FROM_OTHER_FOLDER") != ddata) {
 -			/* comes from summaryview */
 -			if (gtk_cmclist_get_selection_info
 -				(GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0)
 -				return;
 +	if (NULL != (ac = account_find_from_item(item)))
 +		special_trash = account_get_special_folder(ac, F_TRASH);
  
 -			node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
 -			item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
 -			src_item = folderview->summaryview->folder_item;
 +	if (item != item->folder->trash && item != special_trash
 +	&&  !folder_has_parent_of_type(item, F_TRASH)) return;
  
 -			if (item && item->no_select) {
 -				alertpanel_error(_("The destination folder can only be used to "
 -						   "store subfolders."));
 -				return;
 -			}
 -			/* re-check (due to acceptable possibly set for folder moves */
 -			if (!(item && item->folder && item->path && !item->no_select && 
 -			      src_item && src_item != item && FOLDER_CLASS(item->folder)->copy_msg != NULL)) {
 -				return;
 -			}
 +	if (prefs_common.ask_on_clean) {
 +		if (alertpanel(_("Empty trash"),
 +			       _("Delete all messages in trash folders?"),
- 			       _("_No"), _("_Yes"), NULL,
- 						 ALERTFOCUS_SECOND));
++			       NULL, _("_Cancel"), NULL, _("_Empty trash"), NULL, NULL,
++				ALERTFOCUS_SECOND) != G_ALERTALTERNATE)
 +			return;
 +	}
  
 -			switch (gdk_drag_context_get_selected_action(drag_context)) {
 -			case GDK_ACTION_COPY:
 -				summary_copy_selected_to(folderview->summaryview, item);
 -				gtk_drag_finish(drag_context, TRUE, FALSE, time);
 -				break;
 -			case GDK_ACTION_MOVE:
 -			case GDK_ACTION_DEFAULT:
 -			default:
 -				if (FOLDER_CLASS(src_item->folder)->remove_msg == NULL)
 -					summary_copy_selected_to(folderview->summaryview, item);
 -				else
 -					summary_move_selected_to(folderview->summaryview, item);
 -				gtk_drag_finish(drag_context, TRUE, TRUE, time);
 -			}
 -		} else {
 -			/* comes from folderview */
 -			char *source;
 -			gboolean folder_is_normal = TRUE;
 -			gboolean copy = (GDK_ACTION_COPY ==
 -				gdk_drag_context_get_selected_action(drag_context));
 +	mlist = folder_item_get_msg_list(item);
  
 -			source = (char *)gtk_selection_data_get_data(data) + 17;
 -			if (gtk_cmclist_get_selection_info
 -			    (GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0
 -			    || *source == 0) {
 -				gtk_drag_finish(drag_context, FALSE, FALSE, time);			
 -				return;
 -			}
 -			node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
 -			item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
 -			src_item = folder_find_item_from_identifier(source);
 +	for (cur = mlist ; cur != NULL ; cur = cur->next) {
 +		MsgInfo * msginfo = (MsgInfo *) cur->data;
 +		if (MSG_IS_LOCKED(msginfo->flags))
 +			continue;
 +		/* is it partially received? (partial_recv isn't cached) */
 +		if (msginfo->total_size != 0 &&
 +		    msginfo->size != (off_t)msginfo->total_size)
 +			partial_mark_for_delete(msginfo);
 +	}
 +	procmsg_msg_list_free(mlist);
  
 -			folder_is_normal = 
 -				src_item != NULL &&
 -				src_item->stype == F_NORMAL &&
 -				!folder_has_parent_of_type(src_item, F_OUTBOX) &&
 -				!folder_has_parent_of_type(src_item, F_DRAFT) &&
 -				!folder_has_parent_of_type(src_item, F_QUEUE) &&
 -				!folder_has_parent_of_type(src_item, F_TRASH);
 -			if (!item || !src_item || !folder_is_normal) {
 -				gtk_drag_finish(drag_context, FALSE, FALSE, time);			
 -				return;
 -			}
 +	folder_item_remove_all_msg(item);
 +}
  
 -			folderview_move_folder(folderview, src_item, item, copy);
 -			gtk_drag_finish(drag_context, TRUE, TRUE, time);
 -		}
 -		folderview->nodes_to_recollapse = NULL;
 -	} else if (info == TARGET_MAIL_URI_LIST) {
 -		if (gtk_cmclist_get_selection_info
 -			(GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0)
 -			return;
 +static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 +{
 +	FolderView *folderview = (FolderView *)data;
 +	FolderItem *item;
  
 -		node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
 -		if (!node) {
 -			gtk_drag_finish(drag_context, FALSE, FALSE, time);
 -			debug_print("no node\n");		
 -			return;
 -		}
 -		item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
 -		if (!item) {
 -			gtk_drag_finish(drag_context, FALSE, FALSE, time);			
 -			debug_print("no item\n");
 -			return;
 -		}
 -		folderview_finish_dnd(gtk_selection_data_get_data(data),
 -			drag_context, time, item);
 -	}
 +	item = folderview->menu_item;
 +	cm_return_if_fail(item != NULL);
 +	cm_return_if_fail(item->folder != NULL);
 +
 +	item->processing_pending = TRUE;
 +	folder_item_apply_processing(item);
 +	item->processing_pending = FALSE;
  }
  
 -static void folderview_drag_end_cb(GtkWidget	    *widget, 
 -				   GdkDragContext   *drag_context,
 -                                   FolderView	    *folderview)
 +void folderview_run_processing(FolderItem *item)
  {
 -	drag_state_stop(folderview);
 -	folderview->scroll_value = 0;
 -	g_slist_free(folderview->nodes_to_recollapse);
 -	folderview->nodes_to_recollapse = NULL;
 +	cm_return_if_fail(item != NULL);
 +	cm_return_if_fail(item->folder != NULL);
 +
 +	item->processing_pending = TRUE;
 +	folder_item_apply_processing(item);
 +	item->processing_pending = FALSE;
  }
  
 -void folderview_register_popup(FolderViewPopup *fpopup)
 +static void folderview_processing_cb(GtkAction *action, gpointer data)
  {
 -	GList *folderviews;
 +	FolderView *folderview = (FolderView *)data;
 +	FolderItem *item;
 +	gchar *id, *title;
  
 -	for (folderviews = folderview_list; folderviews != NULL; folderviews = g_list_next(folderviews)) {
 -		FolderView *folderview = folderviews->data;
 -		GtkActionGroup *factory;
 +	item = folderview->menu_item;
 +	cm_return_if_fail(item != NULL);
 +	cm_return_if_fail(item->folder != NULL);
  
 -		factory = create_action_group(folderview, fpopup);
 -		g_hash_table_insert(folderview->popups, fpopup->klass, factory);
 -	}	
 -	g_hash_table_insert(folderview_popups, fpopup->klass, fpopup);
 +	id = folder_item_get_identifier(item);
 +	title = g_strdup_printf (_("Processing configuration for folder %s"), id);
 +	g_free (id);
 +
 +	prefs_filtering_open(&item->prefs->processing, title,
 +			MANUAL_ANCHOR_PROCESSING, NULL, NULL, FALSE);
 +	g_free (title);
  }
  
 -void folderview_unregister_popup(FolderViewPopup *fpopup)
 +static void folderview_property_cb(GtkAction *action, gpointer data)
  {
 -	GList *folderviews;
 -
 +	FolderView *folderview = (FolderView *)data;
 +	FolderItem *item;
 +	item = folderview->menu_item;
 +	cm_return_if_fail(item != NULL);
 +	cm_return_if_fail(item->folder != NULL);
  
 -	for (folderviews = folderview_list; folderviews != NULL; folderviews = g_list_next(folderviews)) {
 -		FolderView *folderview = folderviews->data;
 +	prefs_folder_item_open(item);
 +}
  
 -		g_hash_table_remove(folderview->popups, fpopup->klass);
 -	}	
 -	g_hash_table_remove(folderview_popups, fpopup->klass);
 +static void folderview_search_cb(GtkAction *action, gpointer data)
 +{
 +	FolderView *folderview = (FolderView *)data;
 +	summary_search(folderview->summaryview);
  }
  
 -void folderview_remove_item(FolderView *folderview, FolderItem *item)
 +static void mark_all_read_unread_handler(GtkAction *action, gpointer data,
 +					 gboolean recursive, gboolean read)
  {
 -	g_return_if_fail(folderview != NULL);
 -	g_return_if_fail(item != NULL);
 +	FolderView *folderview = (FolderView *)data;
 +	FolderItem *item;
 +	AlertValue val;
 +	gchar *message;
 +	gchar *title;
 +
 +	item = folderview->menu_item;
 +	if (item == NULL)
 +		return;
  
 -	GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
 -	g_return_if_fail(ctree != NULL);
 +	if (read) {
 +		title = _("Mark all as read");
 +		message = recursive? _("Do you really want to mark all mails in this "
 +							"folder and its sub-folders as read?") :
 +							_("Do you really want to mark all mails in this "
 +							"folder as read?");
 +	} else {
 +		title = _("Mark all as unread");
 +		message = recursive? _("Do you really want to mark all mails in this "
 +							"folder and its sub-folders as unread?") :
 +							_("Do you really want to mark all mails in this "
 +							"folder as unread?");
 +	}
 +	if (prefs_common.ask_mark_all_read) {
 +		val = alertpanel_full(title, message,
- 			  _("_No"), _("_Yes"), NULL, ALERTFOCUS_FIRST,
- 			  TRUE, NULL, ALERT_QUESTION);
++				      NULL, _("_No"), NULL, _("_Yes"), NULL, NULL,
++				      ALERTFOCUS_FIRST, TRUE, NULL, ALERT_QUESTION);
 +
 +		if ((val & ~G_ALERTDISABLE) != G_ALERTALTERNATE)
 +			return;
 +		else if (val & G_ALERTDISABLE)
 +			prefs_common.ask_mark_all_read = FALSE;
 +	}
 +
 +	folder_item_update_freeze();
 +	if (folderview->summaryview->folder_item != item && !recursive)
 +		summary_lock(folderview->summaryview);
 +	else
 +		summary_freeze(folderview->summaryview);
  
 -	GtkCMCTreeNode *node =
 -		gtk_cmctree_find_by_row_data(ctree, NULL, item);
 -	g_return_if_fail(node != NULL);
 +	if (read) {
 +		if (recursive)
 +			folderutils_mark_all_read_recursive(item, TRUE);
 +		else {
 +			if (prefs_common.run_processingrules_before_mark_all)
 +				folderview_run_processing(item);
 +			folderutils_mark_all_read(item, TRUE);
 +		}
 +	} else {
 +		if (recursive)
 +			folderutils_mark_all_read_recursive(item, FALSE);
 +		else {
 +			folderutils_mark_all_read(item, FALSE);
 +			if (prefs_common.run_processingrules_before_mark_all)
 +				folderview_run_processing(item);
 +		}
 +	}
 +	if (folderview->summaryview->folder_item != item && !recursive)
 +		summary_unlock(folderview->summaryview);
 +	else
 +		summary_thaw(folderview->summaryview);
 +	folder_item_update_thaw();
 +}
  
 -	gtk_cmctree_remove_node(ctree, node);
 +static void mark_all_read_cb(GtkAction *action, gpointer data)
 +{
 +	mark_all_read_unread_handler(action, data, FALSE, TRUE);
  }
  
 -void folderview_freeze(FolderView *folderview)
 +static void mark_all_unread_cb(GtkAction *action, gpointer data)
  {
 -	if (folderview)
 -		gtk_cmclist_freeze(GTK_CMCLIST(folderview->ctree));
 +	mark_all_read_unread_handler(action, data, FALSE, FALSE);
  }
  
 -void folderview_thaw(FolderView *folderview)
 +static void mark_all_read_recursive_cb(GtkAction *action, gpointer data)
  {
 -	if (folderview)
 -		gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
 +	mark_all_read_unread_handler(action, data, TRUE, TRUE);
  }
  
 -void folderview_grab_focus(FolderView *folderview)
 +static void mark_all_unread_recursive_cb(GtkAction *action, gpointer data)
  {
 -	 if (folderview)
 -		 gtk_widget_grab_focus(folderview->ctree);
 +	mark_all_read_unread_handler(action, data, TRUE, FALSE);
  }
  
  static void folderview_header_set_displayed_columns_cb(GtkAction *gaction,

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list