[Commits] [SCM] claws branch, master, updated. 3.9.3-123-g88cf83b

colin at claws-mail.org colin at claws-mail.org
Wed Apr 30 21:37:25 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  88cf83bf73b794dd4e65888a845e87b1dd6ede90 (commit)
       via  fc74130e7290940b8128cd086d342b7c57144263 (commit)
      from  5ac71948fc34551c061d0b4af65150507f4ed845 (commit)


- Log -----------------------------------------------------------------
commit 88cf83bf73b794dd4e65888a845e87b1dd6ede90
Author: Colin Leroy <colin at colino.net>
Date:   Wed Apr 30 21:34:53 2014 +0200

    Remove the copy-paste that was folder[view]_fast_scan_tree, and
    instead fix folder_scan_tree to do the right thing when called
    in "Check for new folders" mode: Don't rescan the contents of
    all folders after having updated the list of folders. There's
    "Check for new messages" for that.
    Fixes bug #2119, "Check for new folders on remote mailboxes
    is very slow".

diff --git a/src/folder.c b/src/folder.c
index a248abc..6fa6d78 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -903,13 +903,23 @@ static gboolean folder_scan_tree_func(GNode *node, gpointer data)
 {
 	GHashTable *pptable = (GHashTable *)data;
 	FolderItem *item = (FolderItem *)node->data;
-	
+
 	folder_item_restore_persist_prefs(item, pptable);
 	folder_item_scan_full(item, FALSE);
 
 	return FALSE;
 }
 
+static gboolean folder_restore_prefs_func(GNode *node, gpointer data)
+{
+	GHashTable *pptable = (GHashTable *)data;
+	FolderItem *item = (FolderItem *)node->data;
+
+	folder_item_restore_persist_prefs(item, pptable);
+
+	return FALSE;
+}
+
 void folder_scan_tree(Folder *folder, gboolean rebuild)
 {
 	GHashTable *pptable;
@@ -936,44 +946,11 @@ void folder_scan_tree(Folder *folder, gboolean rebuild)
 	hookdata.item = NULL;
 	hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
 
-	g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_scan_tree_func, pptable);
-	folder_persist_prefs_free(pptable);
-
-	prefs_matcher_read_config();
-
-	folder_write_list();
-}
-
-static gboolean folder_restore_prefs_func(GNode *node, gpointer data)
-{
-	GHashTable *pptable = (GHashTable *)data;
-	FolderItem *item = (FolderItem *)node->data;
-	
-	folder_item_restore_persist_prefs(item, pptable);
-
-	return FALSE;
-}
-
-void folder_fast_scan_tree(Folder *folder)
-{
-	GHashTable *pptable;
-	FolderUpdateData hookdata;
-
-	if (!folder->klass->scan_tree)
-		return;
-	
-	pptable = folder_persist_prefs_new(folder);
-
-	if (folder->klass->scan_tree(folder) < 0) {
-		return;
-	} 
-
-	hookdata.folder = folder;
-	hookdata.update_flags = FOLDER_TREE_CHANGED;
-	hookdata.item = NULL;
-	hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
+	if (rebuild)
+		g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_scan_tree_func, pptable);
+	else
+		g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_restore_prefs_func, pptable);
 
-	g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_restore_prefs_func, pptable);
 	folder_persist_prefs_free(pptable);
 
 	prefs_matcher_read_config();
diff --git a/src/folder.h b/src/folder.h
index 191dcd8..6ba032d 100644
--- a/src/folder.h
+++ b/src/folder.h
@@ -854,7 +854,6 @@ GList *folder_get_list		(void);
 gint   folder_read_list		(void);
 void   folder_write_list	(void);
 void   folder_scan_tree		(Folder *folder, gboolean rebuild);
-void   folder_fast_scan_tree	(Folder *folder);
 FolderItem *folder_create_folder(FolderItem	*parent, const gchar *name);
 gint   folder_item_rename	(FolderItem *item, gchar *newname);
 void   folder_update_op_count		(void);
diff --git a/src/folderview.c b/src/folderview.c
index abbc1de..42a0c86 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -1086,47 +1086,6 @@ void folderview_rescan_tree(Folder *folder, gboolean rebuild)
 	inc_unlock();
 }
 
-void folderview_fast_rescan_tree(Folder *folder)
-{
-	GtkWidget *window;
-	MainWindow *mainwin = mainwindow_get_mainwindow();
-	FolderView *folderview = NULL;
-	GtkAdjustment *pos = NULL;
-	gint height = 0;
-
-	cm_return_if_fail(folder != NULL);
-
-	if (!folder->klass->scan_tree) return;
-
-	inc_lock();
-
-	window = label_window_create(_("Scanning folder tree..."));
-
-	if (mainwin)
-		folderview = mainwin->folderview;
-	
-	if (folderview) {
-		pos = gtk_scrolled_window_get_vadjustment(
-					GTK_SCROLLED_WINDOW(folderview->scrolledwin));
-		height = gtk_adjustment_get_value(pos);
-	}
-
-	folder_set_ui_func(folder, folderview_scan_tree_func, NULL);
-	folder_fast_scan_tree(folder);
-	folder_set_ui_func(folder, NULL, NULL);
-
-	folderview_set_all();
-
-	if (folderview) {
-		pos = gtk_scrolled_window_get_vadjustment(
-					GTK_SCROLLED_WINDOW(folderview->scrolledwin));
-		gtk_adjustment_set_value(pos, height);
-		gtk_adjustment_changed(pos);
-	}
-	label_window_destroy(window);
-	inc_unlock();
-}
-
 /** folderview_check_new()
  *  Scan and update the folder and return the 
  *  count the number of new messages since last check. 
diff --git a/src/folderview.h b/src/folderview.h
index aa6a4c3..c6f524e 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -121,7 +121,6 @@ FolderItem *folderview_get_selected_item(FolderView	*folderview);
 
 void folderview_rescan_tree		(Folder		*folder,
 					 gboolean	 rebuild);
-void folderview_fast_rescan_tree	(Folder 	*folder);
 gint folderview_check_new		(Folder		*folder);
 void folderview_check_new_all		(void);
 
diff --git a/src/imap_gtk.c b/src/imap_gtk.c
index dae79e1..dcda56e 100644
--- a/src/imap_gtk.c
+++ b/src/imap_gtk.c
@@ -552,7 +552,7 @@ static void subscribe_cb_full(FolderView *folderview, guint action)
 			for (cur = transc_list; cur; cur = cur->next) 
 				g_free((gchar *)cur->data);
 			if (r == 0)
-				folderview_fast_rescan_tree(item->folder);
+				folderview_rescan_tree(item->folder, FALSE);
 		} else {
 			alertpanel_notice(_("This folder is already subscribed and "
 				  "has no unsubscribed subfolders.\n\nIf there are new folders, "
@@ -596,7 +596,7 @@ static void subscribe_cb_full(FolderView *folderview, guint action)
 	}
 
 	if (!action && item->folder->account->imap_subsonly)
-		folderview_fast_rescan_tree(item->folder);
+		folderview_rescan_tree(item->folder, FALSE);
 }
 
 static void subscribe_cb(GtkAction *action, gpointer data)
@@ -629,7 +629,7 @@ static void subscribed_cb(GtkAction *action, gpointer data)
 	}
 
 	item->folder->account->imap_subsonly = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-	folderview_fast_rescan_tree(item->folder);
+	folderview_rescan_tree(item->folder, FALSE);
 }
 
 static void download_cb(GtkAction *action, gpointer data)

commit fc74130e7290940b8128cd086d342b7c57144263
Author: Colin Leroy <colin at colino.net>
Date:   Wed Apr 30 20:35:47 2014 +0200

    Don't save libravatarr avatars to addressbook

diff --git a/src/avatars.c b/src/avatars.c
index 51acba4..a68286d 100644
--- a/src/avatars.c
+++ b/src/avatars.c
@@ -39,6 +39,7 @@ AvatarRender *avatars_avatarrender_new(MsgInfo *msginfo)
 	AvatarRender *ar = g_new0(AvatarRender, 1);
 	ar->full_msginfo = msginfo;
 	ar->image = NULL;
+	ar->type = 0;
 
 	return ar;
 }
@@ -76,12 +77,14 @@ gboolean avatars_internal_rendering_hook(gpointer source, gpointer data)
 	aface = procmsg_msginfo_get_avatar(avatarr->full_msginfo, AVATAR_FACE);
 	if (aface) {
 		avatarr->image = face_get_from_header(aface);
+		avatarr->type  = AVATAR_FACE;
 	}
 #if HAVE_LIBCOMPFACE
 	else {
 		aface = procmsg_msginfo_get_avatar(avatarr->full_msginfo, AVATAR_XFACE);
 		if (aface) {
 			avatarr->image = xface_get_from_header(aface);
+			avatarr->type  = AVATAR_XFACE;
 		}
 	}
 #endif
diff --git a/src/avatars.h b/src/avatars.h
index d6f304a..c7ac1c9 100644
--- a/src/avatars.h
+++ b/src/avatars.h
@@ -33,6 +33,7 @@ struct _AvatarRender
 {
 	MsgInfo *full_msginfo;
 	GtkWidget *image;
+	gint type;
 };
 
 AvatarRender *avatars_avatarrender_new		(MsgInfo *msginfo);
diff --git a/src/plugins/libravatar/libravatar.c b/src/plugins/libravatar/libravatar.c
index 48d3bf3..9f225bb 100644
--- a/src/plugins/libravatar/libravatar.c
+++ b/src/plugins/libravatar/libravatar.c
@@ -275,6 +275,7 @@ static gboolean libravatar_image_render_hook(gpointer source, gpointer data)
 			if (ar->image) /* previous plugin set one */
 				gtk_widget_destroy(ar->image);
 			ar->image = image;
+			ar->type  = AVATAR_LIBRAVATAR;
 			return FALSE;
 		}
 		/* not cached copy: try network */
@@ -291,6 +292,7 @@ static gboolean libravatar_image_render_hook(gpointer source, gpointer data)
 				if (ar->image) /* previous plugin set one */
 					gtk_widget_destroy(ar->image);
 				ar->image = image;
+				ar->type  = AVATAR_LIBRAVATAR;
 			}
 		}
 		g_free(base);
diff --git a/src/textview.c b/src/textview.c
index ef50dd8..e5cdb66 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1757,6 +1757,7 @@ void textview_clear(TextView *textview)
 	if (textview->image) 
 		gtk_widget_destroy(textview->image);
 	textview->image = NULL;
+	textview->avatar_type = 0;
 
 	if (textview->messageview->mainwin->cursor_count == 0) {
 		textview_set_cursor(window, text_cursor);
@@ -1987,6 +1988,7 @@ static void textview_show_avatar(TextView *textview)
 		gtk_widget_destroy(textview->image);
 	
 	textview->image = avatarr->image;
+	textview->avatar_type = avatarr->type;
 	avatarr->image = NULL; /* avoid destroying */
 	avatars_avatarrender_free(avatarr);
 
@@ -2005,6 +2007,7 @@ bail:
 	if (textview->image) 
 		gtk_widget_destroy(textview->image);
 	textview->image = NULL;	
+	textview->avatar_type = 0;
 }
 
 void textview_show_icon(TextView *textview, const gchar *stock_id)
@@ -2044,6 +2047,9 @@ static void textview_save_contact_pic(TextView *textview)
 	if (!msginfo->extradata || !msginfo->extradata->avatars)
 		return;
 
+	if (textview->avatar_type > AVATAR_FACE)
+		return;
+
 	if (textview->image) 
 		picture = gtk_image_get_pixbuf(GTK_IMAGE(textview->image));
 
@@ -2132,6 +2138,7 @@ bail:
 	if (textview->image) 
 		gtk_widget_destroy(textview->image);
 	textview->image = NULL;
+	textview->avatar_type = 0;
 #else
 	/* new address book */
 #endif	
diff --git a/src/textview.h b/src/textview.h
index ed36b0b..5d478fd 100644
--- a/src/textview.h
+++ b/src/textview.h
@@ -78,6 +78,7 @@ struct _TextView
 	GtkTextIter uri_hover_start_iter;
 	GtkTextIter uri_hover_end_iter;
 	GtkWidget *image;
+	gint avatar_type;
 	gboolean loading;
 	gboolean stop_loading;
 	gint prev_quote_level;

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

Summary of changes:
 src/avatars.c                       |    3 ++
 src/avatars.h                       |    1 +
 src/folder.c                        |   53 ++++++++++-------------------------
 src/folder.h                        |    1 -
 src/folderview.c                    |   41 ---------------------------
 src/folderview.h                    |    1 -
 src/imap_gtk.c                      |    6 ++--
 src/plugins/libravatar/libravatar.c |    2 ++
 src/textview.c                      |    7 +++++
 src/textview.h                      |    1 +
 10 files changed, 32 insertions(+), 84 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list