diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 8 | ||||
-rw-r--r-- | libsylph/virtual.c | 22 | ||||
-rw-r--r-- | libsylph/virtual.h | 2 | ||||
-rw-r--r-- | src/folderview.c | 32 | ||||
-rw-r--r-- | src/prefs_search_folder.c | 28 | ||||
-rw-r--r-- | src/prefs_search_folder.h | 2 | ||||
-rw-r--r-- | src/summary_search.c | 15 | ||||
-rw-r--r-- | src/summary_search.h | 2 |
9 files changed, 98 insertions, 20 deletions
@@ -1,5 +1,12 @@ 2006-01-25 + * libsylph/virtual.c + src/summary_search.c: exclude trash on recursive search. + * src/prefs_search_folder.[ch] + src/folderview.c: update summary when virtual folders are modified. + +2006-01-25 + * libsylph/procmsg.[ch]: procmsg_trash_messages_exist(): added. * src/folderview.c: folderview_menu_popup(): don't make 'Empty trash' active if trashed messages don't exist. diff --git a/ChangeLog.ja b/ChangeLog.ja index a3da4e6c..a08d936e 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,13 @@ 2006-01-25 + * libsylph/virtual.c + src/summary_search.c: 再帰検索のときはごみ箱を除外するようにした。 + * src/prefs_search_folder.[ch] + src/folderview.c: 仮想フォルダが変更された場合はサマリを更新する + ようにした。 + +2006-01-25 + * libsylph/procmsg.[ch]: procmsg_trash_messages_exist(): 追加。 * src/folderview.c: folderview_menu_popup(): ごみ箱のメッセージが存在 しなければ「ごみ箱を空にする」を有効にしないようにした。 diff --git a/libsylph/virtual.c b/libsylph/virtual.c index 9d9de5b7..5a229416 100644 --- a/libsylph/virtual.c +++ b/libsylph/virtual.c @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -50,6 +50,8 @@ struct _VirtualSearchInfo { GSList *mlist; GHashTable *search_cache_table; FILE *fp; + gboolean requires_full_headers; + gboolean exclude_trash; }; struct _SearchCacheInfo { @@ -322,7 +324,6 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) GSList *mlist; GSList *cur; FilterInfo fltinfo; - gboolean full_headers; gint count = 1, total, ncachehit = 0; GTimeVal tv_prev, tv_cur; @@ -345,8 +346,6 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) debug_print("start query search: %s\n", item->path); - full_headers = filter_rule_requires_full_headers(info->rule); - virtual_write_search_cache(info->fp, item, NULL, 0); for (cur = mlist; cur != NULL; cur = cur->next) { @@ -392,7 +391,7 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item) } fltinfo.flags = msginfo->flags; - if (full_headers) { + if (info->requires_full_headers) { gchar *file; file = procmsg_get_message_file(msginfo); @@ -437,6 +436,8 @@ static gboolean virtual_search_recursive_func(GNode *node, gpointer data) if (!item->path) return FALSE; + if (info->exclude_trash && item->stype == F_TRASH) + return FALSE; mlist = virtual_search_folder(info, item); info->mlist = g_slist_concat(info->mlist, mlist); @@ -497,6 +498,17 @@ static GSList *virtual_get_msg_list(Folder *folder, FolderItem *item, if (!info.fp) goto finish; + info.requires_full_headers = + filter_rule_requires_full_headers(rule); + + if (rule->recursive) { + if (target->stype == F_TRASH) + info.exclude_trash = FALSE; + else + info.exclude_trash = TRUE; + } else + info.exclude_trash = FALSE; + if (rule->recursive) { g_node_traverse(target->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, virtual_search_recursive_func, &info); diff --git a/libsylph/virtual.h b/libsylph/virtual.h index 1a7ba38f..86a74b3d 100644 --- a/libsylph/virtual.h +++ b/libsylph/virtual.h @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/folderview.c b/src/folderview.c index 5a903324..2ede96d2 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -2756,12 +2756,32 @@ static void folderview_search_cb(FolderView *folderview, guint action, FolderItem *item; item = folderview_get_selected_item(folderview); - if (item) { - if (item->stype == F_VIRTUAL) - prefs_search_folder_open(item); - else - summary_search(item); - } + if (!item) + return; + + if (item->stype == F_VIRTUAL) { + GtkTreePath *sel_path, *open_path; + + sel_path = gtk_tree_row_reference_get_path + (folderview->selected); + open_path = gtk_tree_row_reference_get_path(folderview->opened); + + if (prefs_search_folder_open(item)) { + if (sel_path && open_path && + gtk_tree_path_compare(open_path, sel_path) == 0) { + GtkTreeRowReference *row; + row = gtk_tree_row_reference_copy(folderview->opened); + folderview_unselect(folderview); + summary_clear_all(folderview->summaryview); + folderview_select_row_ref(folderview, row); + gtk_tree_row_reference_free(row); + } + } + + gtk_tree_path_free(open_path); + gtk_tree_path_free(sel_path); + } else + summary_search(item); } static void folderview_property_cb(FolderView *folderview, guint action, diff --git a/src/prefs_search_folder.c b/src/prefs_search_folder.c index c44309c4..a8ad0cda 100644 --- a/src/prefs_search_folder.c +++ b/src/prefs_search_folder.c @@ -75,10 +75,14 @@ struct _PrefsSearchFolderDialog GtkWidget *subfolder_checkbtn; GtkWidget *case_checkbtn; + + gboolean finished; + gboolean updated; }; static PrefsSearchFolderDialog *prefs_search_folder_create(FolderItem *item); static void prefs_search_folder_set_dialog(PrefsSearchFolderDialog *dialog); +static void prefs_search_folder_destroy (PrefsSearchFolderDialog *dialog); static gint prefs_search_folder_delete_cb(GtkWidget *widget, GdkEventAny *event, @@ -100,16 +104,25 @@ static void prefs_search_folder_cancel_cb(GtkWidget *widget, PrefsSearchFolderDialog *dialog); -void prefs_search_folder_open(FolderItem *item) +gboolean prefs_search_folder_open(FolderItem *item) { PrefsSearchFolderDialog *dialog; + gboolean updated; - g_return_if_fail(item != NULL); + g_return_val_if_fail(item != NULL, FALSE); dialog = prefs_search_folder_create(item); manage_window_set_transient(GTK_WINDOW(dialog->dialog->window)); prefs_search_folder_set_dialog(dialog); gtk_widget_show(dialog->dialog->window); + + while (dialog->finished == FALSE) + gtk_main_iteration(); + + updated = dialog->updated; + prefs_search_folder_destroy(dialog); + + return updated; } static PrefsSearchFolderDialog *prefs_search_folder_create(FolderItem *item) @@ -265,6 +278,9 @@ static PrefsSearchFolderDialog *prefs_search_folder_create(FolderItem *item) new_dialog->subfolder_checkbtn = subfolder_checkbtn; new_dialog->case_checkbtn = case_checkbtn; + new_dialog->finished = FALSE; + new_dialog->updated = FALSE; + return new_dialog; } @@ -335,7 +351,7 @@ static void prefs_search_folder_destroy(PrefsSearchFolderDialog *dialog) static gint prefs_search_folder_delete_cb(GtkWidget *widget, GdkEventAny *event, PrefsSearchFolderDialog *dialog) { - prefs_search_folder_destroy(dialog); + dialog->finished = TRUE; return TRUE; } @@ -371,7 +387,7 @@ static void prefs_search_folder_ok_cb(GtkWidget *widget, PrefsSearchFolderDialog *dialog) { prefs_search_folder_apply_cb(widget, dialog); - prefs_search_folder_destroy(dialog); + dialog->finished = TRUE; } static void prefs_search_folder_apply_cb(GtkWidget *widget, @@ -426,10 +442,12 @@ static void prefs_search_folder_apply_cb(GtkWidget *widget, g_free(path); filter_rule_free(rule); + + dialog->updated = TRUE; } static void prefs_search_folder_cancel_cb(GtkWidget *widget, PrefsSearchFolderDialog *dialog) { - prefs_search_folder_destroy(dialog); + dialog->finished = TRUE; } diff --git a/src/prefs_search_folder.h b/src/prefs_search_folder.h index 2592888b..60f51791 100644 --- a/src/prefs_search_folder.h +++ b/src/prefs_search_folder.h @@ -24,6 +24,6 @@ #include "folder.h" -void prefs_search_folder_open (FolderItem *item); +gboolean prefs_search_folder_open (FolderItem *item); #endif /* __PREFS_SEARCH_FOLDER_H__ */ diff --git a/src/summary_search.c b/src/summary_search.c index c21407c5..c2cc33aa 100644 --- a/src/summary_search.c +++ b/src/summary_search.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -103,6 +103,8 @@ static struct SummarySearchWindow { FilterRule *rule; gboolean requires_full_headers; + gboolean exclude_trash; + gboolean on_search; gboolean cancelled; } search_window; @@ -481,6 +483,14 @@ static void summary_search_query(void) search_window.requires_full_headers = filter_rule_requires_full_headers(search_window.rule); + if (search_window.rule->recursive) { + if (item->stype == F_TRASH) + search_window.exclude_trash = FALSE; + else + search_window.exclude_trash = TRUE; + } else + search_window.exclude_trash = FALSE; + search_window.cancelled = FALSE; gtk_button_set_label(GTK_BUTTON(search_window.search_btn), @@ -496,6 +506,7 @@ static void summary_search_query(void) filter_rule_free(search_window.rule); search_window.rule = NULL; search_window.requires_full_headers = FALSE; + search_window.exclude_trash = FALSE; gtk_button_set_label(GTK_BUTTON(search_window.search_btn), GTK_STOCK_FIND); @@ -600,6 +611,8 @@ static gboolean summary_search_recursive_func(GNode *node, gpointer data) if (!item->path) return FALSE; + if (search_window.exclude_trash && item->stype == F_TRASH) + return FALSE; summary_search_folder(item); diff --git a/src/summary_search.h b/src/summary_search.h index 5f1eacf5..cd95e376 100644 --- a/src/summary_search.h +++ b/src/summary_search.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |