g_return_if_fail(item != NULL);
mlist = folder_item_get_msg_list(item);
-
for (cur = mlist ; cur != NULL ; cur = cur->next) {
MsgInfo * msginfo;
procmsg_msginfo_unset_flags(msginfo, MSG_NEW, 0);
procmsg_msginfo_free(msginfo);
}
+ g_slist_free(mlist);
+
+ folder_item_write_cache(olditem);
folder_update_item(item, FALSE);
- g_slist_free(mlist);
}
gint folder_item_scan(FolderItem *item)
for (cur = mlist ; cur != NULL ; cur = cur->next) {
MsgInfo * msginfo;
cnt++;
- msginfo = (MsgInfo *) cur->data;
- folder_item_move_msg(new_item, msginfo);
if (cnt%500)
statusbar_print_all(_("Moving %s to %s (%d%%)..."), src->name,
new_item->path,
100*cnt/g_slist_length(mlist));
+ msginfo = (MsgInfo *) cur->data;
+ folder_item_move_msg(new_item, msginfo);
+ if (cnt%500)
+ statusbar_pop_all();
}
/*copy prefs*/
}
debug_print("moving \"%s\" to \"%s\"\n", phys_srcpath, phys_dstpath);
if ((tmp = folder_item_move_recursive(src, dest)) == NULL) {
- alertpanel_error(_("Move failed !"));
+ alertpanel_error(_("Move failed!"));
return NULL;
}
if (src_node)
g_node_destroy(src_node);
else
- debug_print("can't remove node: is null !\n");
+ debug_print("can't remove node: it's null!\n");
/* not to much worry if remove fails, move has been done */
debug_print("updating rules ....\n");
return filename;
}
+#define PUT_ESCAPE_STR(fp, attr, str) \
+{ \
+ fputs(" " attr "=\"", fp); \
+ xml_file_put_escape_str(fp, str); \
+ fputs("\"", fp); \
+}
+
static void folder_write_list_recursive(GNode *node, gpointer data)
{
FILE *fp = (FILE *)data;
Folder *folder = item->folder;
fprintf(fp, "<folder type=\"%s\"", folder_type_str[folder->type]);
- if (folder->name) {
- fputs(" name=\"", fp);
- xml_file_put_escape_str(fp, folder->name);
- fputs("\"", fp);
- }
- if ((folder->type == F_MH) || (folder->type == F_MBOX)) {
- fputs(" path=\"", fp);
- xml_file_put_escape_str
- (fp, LOCAL_FOLDER(folder)->rootpath);
- fputs("\"", fp);
- }
+ if (folder->name)
+ PUT_ESCAPE_STR(fp, "name", folder->name);
+ if (folder->type == F_MH || folder->type == F_MBOX)
+ PUT_ESCAPE_STR(fp, "path",
+ LOCAL_FOLDER(folder)->rootpath);
if (item->collapsed && node->children)
fputs(" collapsed=\"1\"", fp);
if (folder->account)
} else {
fprintf(fp, "<folderitem type=\"%s\"",
folder_item_stype_str[item->stype]);
- if (item->name) {
- fputs(" name=\"", fp);
- xml_file_put_escape_str(fp, item->name);
- fputs("\"", fp);
- }
- if (item->path) {
- fputs(" path=\"", fp);
- xml_file_put_escape_str(fp, item->path);
- fputs("\"", fp);
- }
-
+ if (item->name)
+ PUT_ESCAPE_STR(fp, "name", item->name);
+ if (item->path)
+ PUT_ESCAPE_STR(fp, "path", item->path);
+
if (item->no_sub)
fputs(" no_sub=\"1\"", fp);
if (item->no_select)
fprintf(fp,
" mtime=\"%lu\" new=\"%d\" unread=\"%d\" total=\"%d\"",
item->mtime, item->new, item->unread, item->total);
-
+
if (item->account)
fprintf(fp, " account_id=\"%d\"",
item->account->account_id);
g_slist_free(mlist);
}
+/*
+ * Callback handling for FolderItem content changes
+ */
GSList *folder_item_update_callbacks_list = NULL;
gint folder_item_update_callbacks_nextid = 0;
folder_item_update_callback_execute(item, contentchange);
}
-static void folder_update_item_func(FolderItem *item, gpointer data)
+static void folder_update_item_func(FolderItem *item, gpointer contentchange)
{
- gboolean contentchange = GPOINTER_TO_INT(data);
-
if (item->need_update) {
- folder_item_update_callback_execute(item, contentchange);
+ folder_item_update_callback_execute(item, GPOINTER_TO_INT(contentchange));
item->need_update = FALSE;
}
}
node = node->next;
}
}
+
+#undef PUT_ESCAPE_STR