2005-06-21 [colin] 1.9.11cvs86

* src/folder.c
	* src/folderview.c
		Respect the no_select flag
	* src/imap.c
		Fix recursive deletion
	* src/imap_gtk.c
	* src/mh_gtk.c
		Make the folder deletion's warning
		more explicit
This commit is contained in:
Colin Leroy 2005-06-21 17:25:18 +00:00
parent 5220ff8687
commit 2dba92f0cf
8 changed files with 93 additions and 36 deletions

View file

@ -1,3 +1,15 @@
2005-06-21 [colin] 1.9.11cvs86
* src/folder.c
* src/folderview.c
Respect the no_select flag
* src/imap.c
Fix recursive deletion
* src/imap_gtk.c
* src/mh_gtk.c
Make the folder deletion's warning
more explicit
2005-06-21 [colin] 1.9.11cvs85
* src/textview.c

View file

@ -574,3 +574,4 @@
( cvs diff -u -r 1.207.2.42 -r 1.207.2.43 src/folderview.c; cvs diff -u -r 1.179.2.35 -r 1.179.2.36 src/imap.c; cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/imap_gtk.c; cvs diff -u -r 1.79.2.12 -r 1.79.2.13 src/mh.c; cvs diff -u -r 1.83.2.33 -r 1.83.2.34 src/mimeview.c; ) > 1.9.11cvs83.patchset
( cvs diff -u -r 1.213.2.35 -r 1.213.2.36 src/folder.c; ) > 1.9.11cvs84.patchset
( cvs diff -u -r 1.96.2.57 -r 1.96.2.58 src/textview.c; ) > 1.9.11cvs85.patchset
( cvs diff -u -r 1.213.2.36 -r 1.213.2.37 src/folder.c; cvs diff -u -r 1.207.2.43 -r 1.207.2.44 src/folderview.c; cvs diff -u -r 1.179.2.36 -r 1.179.2.37 src/imap.c; cvs diff -u -r 1.1.2.12 -r 1.1.2.13 src/imap_gtk.c; cvs diff -u -r 1.2.2.6 -r 1.2.2.7 src/mh_gtk.c; ) > 1.9.11cvs86.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=11
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=85
EXTRA_VERSION=86
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -333,7 +333,7 @@ void folder_item_remove(FolderItem *item)
g_return_if_fail(item != NULL);
g_return_if_fail(item->folder != NULL);
g_return_if_fail(item->node != NULL);
g_return_if_fail(item->no_select == FALSE);
node = item->node;
if (item->folder->node == node)
@ -781,6 +781,8 @@ FolderItem *folder_create_folder(FolderItem *parent, const gchar *name)
{
FolderItem *new_item;
g_return_val_if_fail(parent->no_select == FALSE, NULL);
new_item = parent->folder->klass->create_folder(parent->folder, parent, name);
if (new_item) {
FolderUpdateData hookdata;
@ -802,6 +804,7 @@ gint folder_item_rename(FolderItem *item, gchar *newname)
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(newname != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
retval = item->folder->klass->rename_folder(item->folder, item, newname);
@ -1438,6 +1441,8 @@ static gint folder_sort_folder_list(gconstpointer a, gconstpointer b)
gint folder_item_open(FolderItem *item)
{
gchar *buf;
g_return_val_if_fail(item->no_select == FALSE, -1);
if((item->folder->klass->scan_required != NULL) &&
(item->folder->klass->scan_required(item->folder, item))) {
folder_item_scan_full(item, TRUE);
@ -1465,6 +1470,7 @@ gint folder_item_close(FolderItem *item)
Folder *folder;
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
if (item->new_msgs) {
folder_item_update_freeze();
@ -1498,7 +1504,8 @@ static MsgInfoList *get_msginfos(FolderItem *item, MsgNumberList *numlist)
{
MsgInfoList *msglist = NULL;
Folder *folder = item->folder;
g_return_val_if_fail(item->no_select == FALSE, NULL);
if (folder->klass->get_msginfos != NULL)
msglist = folder->klass->get_msginfos(folder, item, numlist);
else {
@ -1544,6 +1551,7 @@ static gint syncronize_flags(FolderItem *item, MsgInfoList *msglist)
return 0;
if(item->folder->klass->get_flags == NULL)
return 0;
g_return_val_if_fail(item->no_select == FALSE, 0);
relation = g_relation_new(2);
g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
@ -1591,6 +1599,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
g_return_val_if_fail(item != NULL, -1);
if (item->path == NULL) return -1;
g_return_val_if_fail(item->no_select == FALSE, -1);
folder = item->folder;
@ -1871,7 +1880,8 @@ gint folder_item_syncronize_flags(FolderItem *item)
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(item->folder != NULL, -1);
g_return_val_if_fail(item->folder->klass != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
if (item->cache == NULL)
folder_item_read_cache(item);
@ -2037,7 +2047,7 @@ MsgInfo *folder_item_get_msginfo(FolderItem *item, gint num)
MsgInfo *msginfo = NULL;
g_return_val_if_fail(item != NULL, NULL);
g_return_val_if_fail(item->no_select == FALSE, NULL);
folder = item->folder;
if (!item->cache)
folder_item_read_cache(item);
@ -2061,6 +2071,7 @@ MsgInfo *folder_item_get_msginfo_by_msgid(FolderItem *item, const gchar *msgid)
g_return_val_if_fail(item != NULL, NULL);
g_return_val_if_fail(msgid != NULL, NULL);
g_return_val_if_fail(item->no_select == FALSE, FALSE);
folder = item->folder;
if (!item->cache)
@ -2075,6 +2086,7 @@ MsgInfo *folder_item_get_msginfo_by_msgid(FolderItem *item, const gchar *msgid)
GSList *folder_item_get_msg_list(FolderItem *item)
{
g_return_val_if_fail(item != NULL, NULL);
g_return_val_if_fail(item->no_select == FALSE, FALSE);
if (item->cache == 0)
folder_item_read_cache(item);
@ -2126,6 +2138,7 @@ gchar *folder_item_fetch_msg(FolderItem *item, gint num)
folder = item->folder;
g_return_val_if_fail(folder->klass->fetch_msg != NULL, NULL);
g_return_val_if_fail(item->no_select == FALSE, NULL);
msgfile = folder->klass->fetch_msg(folder, item, num);
@ -2160,7 +2173,8 @@ gchar *folder_item_fetch_msg_full(FolderItem *item, gint num, gboolean headers,
MsgInfo *msginfo;
g_return_val_if_fail(item != NULL, NULL);
g_return_val_if_fail(item->no_select == FALSE, NULL);
folder = item->folder;
if (folder->klass->fetch_msg_full == NULL)
@ -2203,6 +2217,7 @@ gint folder_item_fetch_all_msg(FolderItem *item)
gint total = 0;
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
debug_print("fetching all messages in %s ...\n", item->path);
statusbar_print_all(_("Fetching all messages in %s ...\n"), item->path);
@ -2405,6 +2420,7 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
g_return_val_if_fail(dest != NULL, -1);
g_return_val_if_fail(file_list != NULL, -1);
g_return_val_if_fail(dest->folder != NULL, -1);
g_return_val_if_fail(dest->no_select == FALSE, -1);
folder = dest->folder;
@ -2475,25 +2491,6 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
return lastnum;
}
/*
gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
{
Folder *folder;
gint num;
g_return_val_if_fail(dest != NULL, -1);
g_return_val_if_fail(msginfo != NULL, -1);
folder = dest->folder;
if (dest->last_num < 0) folder->scan(folder, dest);
num = folder->move_msg(folder, dest, msginfo);
if (num > 0) dest->last_num = num;
return num;
}
*/
FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
{
@ -2504,6 +2501,8 @@ FolderItem *folder_item_move_recursive(FolderItem *src, FolderItem *dest)
gchar *old_id, *new_id;
mlist = folder_item_get_msg_list(src);
g_return_val_if_fail(dest->no_select == FALSE, NULL);
/* move messages */
debug_print("Moving %s to %s\n", src->path, dest->path);
@ -2573,7 +2572,7 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_ite
if (tmp == src) {
return F_MOVE_FAILED_DEST_IS_CHILD;
}
tmp = folder_item_parent(tmp);;
tmp = folder_item_parent(tmp);
}
tmp = folder_item_parent(src);
@ -2594,6 +2593,9 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_ite
return F_MOVE_FAILED_DEST_OUTSIDE_MAILBOX;
}
if (dest->no_select)
return F_MOVE_FAILED;
phys_srcpath = folder_item_get_path(src);
phys_dstpath = g_strconcat(folder_item_get_path(dest),
G_DIR_SEPARATOR_S,
@ -2641,6 +2643,7 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
folder = dest->folder;
g_return_val_if_fail(folder->klass->copy_msg != NULL, -1);
g_return_val_if_fail(dest->no_select == FALSE, -1);
relation = g_relation_new(2);
g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
@ -2855,6 +2858,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
g_return_val_if_fail(item != NULL, -1);
folder = item->folder;
g_return_val_if_fail(folder->klass->remove_msg != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
if (!item->cache) folder_item_read_cache(item);
@ -2877,6 +2881,7 @@ gint folder_item_remove_msgs(FolderItem *item, GSList *msglist)
g_return_val_if_fail(item != NULL, -1);
folder = item->folder;
g_return_val_if_fail(folder != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
inc_lock();
if (!item->cache) folder_item_read_cache(item);
@ -2911,6 +2916,7 @@ gint folder_item_remove_all_msg(FolderItem *item)
gint result;
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
folder = item->folder;
@ -2946,6 +2952,7 @@ void folder_item_change_msg_flags(FolderItem *item, MsgInfo *msginfo, MsgPermFla
{
g_return_if_fail(item != NULL);
g_return_if_fail(msginfo != NULL);
g_return_if_fail(item->no_select == FALSE);
if (item->folder->klass->change_flags != NULL) {
item->folder->klass->change_flags(item->folder, item, msginfo, newflags);
@ -2959,6 +2966,7 @@ gboolean folder_item_is_msg_changed(FolderItem *item, MsgInfo *msginfo)
Folder *folder;
g_return_val_if_fail(item != NULL, FALSE);
g_return_val_if_fail(item->no_select == FALSE, FALSE);
folder = item->folder;
@ -3385,7 +3393,7 @@ void folder_item_apply_processing(FolderItem *item)
gchar buf[32];
g_return_if_fail(item != NULL);
g_return_if_fail(item->no_select == FALSE);
processing_list = item->prefs->processing;
folder_item_update_freeze();

View file

@ -135,6 +135,9 @@ static GdkBitmap *draftsxpmmask;
static GdkPixmap *draftsopenxpm;
static GdkBitmap *draftsopenxpmmask;
static GdkPixmap *noselectxpm;
static GdkBitmap *noselectxpmmask;
static void folderview_select_node (FolderView *folderview,
GtkCTreeNode *node);
static void folderview_set_folders (FolderView *folderview);
@ -465,6 +468,7 @@ void folderview_init(FolderView *folderview)
stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_HRM, &queueopenhrmxpm, &queueopenhrmxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_DRAFTS_CLOSE, &draftsxpm, &draftsxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_DRAFTS_OPEN, &draftsopenxpm, &draftsopenxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_DIR_NOSELECT, &noselectxpm, &noselectxpmmask);
/* CLAWS: titles for "New" and "Unread" show new & unread pixmaps
* instead text (text overflows making them unreadable and ugly) */
@ -1106,6 +1110,12 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
openmask = folderopenxpmmask;
}
}
if (item->no_select) {
xpm = openxpm = noselectxpm;
mask = openmask = noselectxpmmask;
}
name = folder_item_get_name(item);
if (!GTK_CTREE_ROW(node)->expanded) {
@ -1576,7 +1586,7 @@ static void folderview_selected(GtkCTree *ctree, GtkCTreeNode *row,
folderview->open_folder = FALSE;
return;
}
if (!can_select || summary_is_locked(folderview->summaryview)) {
gtkut_ctree_set_focus_row(ctree, folderview->opened);
gtk_ctree_select(ctree, folderview->opened);
@ -1586,7 +1596,7 @@ static void folderview_selected(GtkCTree *ctree, GtkCTreeNode *row,
if (!folderview->open_folder) return;
item = gtk_ctree_node_get_row_data(ctree, row);
if (!item) return;
if (!item || item->no_select) return;
can_select = FALSE;
@ -2196,7 +2206,7 @@ static void folderview_drag_received_cb(GtkWidget *widget,
src_item = folderview->summaryview->folder_item;
/* re-check (due to acceptable possibly set for folder moves */
if (!(item && item->folder && item->path &&
if (!(item && item->folder && item->path && !item->no_select &&
src_item && src_item != item && FOLDER_CLASS(item->folder)->copy_msg != NULL)) {
return;
}
@ -2232,7 +2242,7 @@ static void folderview_drag_received_cb(GtkWidget *widget,
item = gtk_ctree_node_get_row_data(GTK_CTREE(widget), node);
src_item = folder_find_item_from_identifier(source);
if (!item || !src_item || src_item->stype != F_NORMAL) {
if (!item || item->no_select || !src_item || src_item->stype != F_NORMAL) {
gtk_drag_finish(drag_context, FALSE, FALSE, time);
return;
}

View file

@ -1380,7 +1380,8 @@ static gint imap_remove_msgs(Folder *folder, FolderItem *dest,
g_return_val_if_fail(folder != NULL, -1);
g_return_val_if_fail(dest != NULL, -1);
g_return_val_if_fail(msglist != NULL, -1);
if (msglist == NULL)
return 0;
msginfo = (MsgInfo *)msglist->data;
g_return_val_if_fail(msginfo->folder != NULL, -1);
@ -2047,7 +2048,7 @@ static gint imap_rename_folder(Folder *folder, FolderItem *item,
return 0;
}
static gint imap_remove_folder(Folder *folder, FolderItem *item)
static gint imap_remove_folder_real(Folder *folder, FolderItem *item)
{
gint ok;
IMAPSession *session;
@ -2096,6 +2097,29 @@ static gint imap_remove_folder(Folder *folder, FolderItem *item)
return 0;
}
static gint imap_remove_folder(Folder *folder, FolderItem *item)
{
GNode *node, *next;
g_return_val_if_fail(item != NULL, -1);
g_return_val_if_fail(item->folder != NULL, -1);
g_return_val_if_fail(item->node != NULL, -1);
g_return_val_if_fail(item->no_select == FALSE, -1);
node = item->node->children;
while (node != NULL) {
next = node->next;
if (imap_remove_folder(folder, FOLDER_ITEM(node->data)) < 0)
return -1;
node = next;
}
debug_print("IMAP removing %s\n", item->path);
if (imap_remove_all_msg(folder, item) < 0)
return -1;
return imap_remove_folder_real(folder, item);
}
typedef struct _uncached_data {
IMAPSession *session;
FolderItem *item;

View file

@ -308,6 +308,7 @@ static void delete_folder_cb(FolderView *folderview, guint action,
g_return_if_fail(item != NULL);
g_return_if_fail(item->path != NULL);
g_return_if_fail(item->folder != NULL);
g_return_if_fail(item->no_select == FALSE);
name = trim_string(item->name, 32);
AUTORELEASE_STR(name, {g_free(name); return;});

View file

@ -164,10 +164,11 @@ static void delete_folder_cb(FolderView *folderview, guint action,
name = trim_string(item->name, 32);
AUTORELEASE_STR(name, {g_free(name); return;});
message = g_strdup_printf
(_("All folders and messages under `%s' will be deleted.\n"
(_("All folders and messages under `%s' will be permanently deleted.\n"
"Recovery will not be possible.\n\n"
"Do you really want to delete?"), name);
avalue = alertpanel(_("Delete folder"), message,
_("Yes"), _("+No"), NULL);
avalue = alertpanel_with_type(_("Delete folder"), message,
_("Yes"), _("+No"), NULL, NULL, ALERT_WARNING);
g_free(message);
if (avalue != G_ALERTDEFAULT) return;