aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-06-14 12:56:24 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-06-14 12:56:24 +0800
commit87ae2d3b9c329297dbe8cc06583d4ce7deb7aec1 (patch)
tree58c827a4f2f3b998ff20ad01da5330b186627998 /mail
parent6693f71b99af23ecc709857eebb0c85bd8debfc9 (diff)
downloadgsoc2013-evolution-87ae2d3b9c329297dbe8cc06583d4ce7deb7aec1.tar.gz
gsoc2013-evolution-87ae2d3b9c329297dbe8cc06583d4ce7deb7aec1.tar.zst
gsoc2013-evolution-87ae2d3b9c329297dbe8cc06583d4ce7deb7aec1.zip
don't check rule->source, its irrelevent to vfolder sources, and clean up
2004-06-14 Not Zed <NotZed@Ximian.com> * mail-vfolder.c (rule_changed): don't check rule->source, its irrelevent to vfolder sources, and clean up the logic a bit. #59158. * em-folder-tree.c (emft_popup_new_folder_response): destroy the create dialogue if we're firing up the vfolder creation window. svn path=/trunk/; revision=26332
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/em-folder-tree.c1
-rw-r--r--mail/mail-vfolder.c81
3 files changed, 39 insertions, 50 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8c8f254118..e453114742 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,12 @@
2004-06-14 Not Zed <NotZed@Ximian.com>
+ * mail-vfolder.c (rule_changed): don't check rule->source, its
+ irrelevent to vfolder sources, and clean up the logic a bit.
+ #59158.
+
+ * em-folder-tree.c (emft_popup_new_folder_response): destroy the
+ create dialogue if we're firing up the vfolder creation window.
+
* em-composer-utils.c (get_reply_all): if we removed all of the
addresses because they were 'us', add the first to
address back. otherwise reply-to-all behaves strange.
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index b69b179a2e..8d82094c61 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2290,6 +2290,7 @@ emft_popup_new_folder_response (EMFolderSelector *emfs, int response, EMFolderTr
rule = vfolder_rule_new();
filter_rule_set_name((FilterRule *)rule, path);
vfolder_gui_add_rule(rule);
+ gtk_widget_destroy((GtkWidget *)emfs);
} else {
g_object_ref (emfs);
emft_create_folder (si->store, path, new_folder_created_cb, emfs);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 1f1f5eeec7..14fa477b63 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -638,14 +638,34 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
static void context_rule_added(RuleContext *ctx, FilterRule *rule);
static void
+rule_add_sources(GList *l, GList **sources_folderp, GList **sources_urip)
+{
+ GList *sources_folder = *sources_folderp;
+ GList *sources_uri = *sources_urip;
+ CamelFolder *newfolder;
+
+ while (l) {
+ char *curi = em_uri_to_camel(l->data);
+
+ if (mail_note_get_folder_from_uri(curi, &newfolder)) {
+ if (newfolder)
+ sources_folder = g_list_append(sources_folder, newfolder);
+ else
+ sources_uri = g_list_append(sources_uri, g_strdup(curi));
+ }
+ g_free(curi);
+ l = l->next;
+ }
+
+ *sources_folderp = sources_folder;
+ *sources_urip = sources_uri;
+}
+
+static void
rule_changed(FilterRule *rule, CamelFolder *folder)
{
- const char *sourceuri;
- GList *l;
GList *sources_uri = NULL, *sources_folder = NULL;
GString *query;
- int i;
- CamelFolder *newfolder;
/* if the folder has changed name, then add it, then remove the old manually */
if (strcmp(folder->full_name, rule->name) != 0) {
@@ -673,53 +693,14 @@ rule_changed(FilterRule *rule, CamelFolder *folder)
d(printf("Filter rule changed? for folder '%s'!!\n", folder->name));
/* find any (currently available) folders, and add them to the ones to open */
- sourceuri = NULL;
- while ( (sourceuri = vfolder_rule_next_source((VfolderRule *)rule, sourceuri)) ) {
- char *curi = em_uri_to_camel(sourceuri);
+ rule_add_sources(((VfolderRule *)rule)->sources, &sources_folder, &sources_uri);
- d(printf(" adding source '%s' '%s'\n", sourceuri, curi));
- if (mail_note_get_folder_from_uri(curi, &newfolder)) {
- if (newfolder)
- sources_folder = g_list_append(sources_folder, newfolder);
- else
- sources_uri = g_list_append(sources_uri, g_strdup(sourceuri));
- } else {
- d(printf(" no i'm not - this folder doesn't exist anywhere\n"));
- }
-
- g_free(curi);
- }
-
- /* check the remote/local uri lists for any other uri's that should be looked at */
- if (rule->source) {
- LOCK();
- for (i=0;i<2;i++) {
- if (i==0 && (((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL
- || ((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE))
- l = source_folders_local;
- else if (i==1 && (((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_REMOTE_ACTIVE
- || ((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE))
- l = source_folders_remote;
- else
- l = NULL;
-
- while (l) {
- char *curi = em_uri_to_camel(l->data);
-
- if (mail_note_get_folder_from_uri(curi, &newfolder)) {
- if (newfolder)
- sources_folder = g_list_append(sources_folder, newfolder);
- else
- sources_uri = g_list_append(sources_uri, g_strdup(curi));
- } else {
- d(printf(" -> No such folder?\n"));
- }
- g_free(curi);
- l = l->next;
- }
- }
- UNLOCK();
- }
+ LOCK();
+ if (((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL || ((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE)
+ rule_add_sources(source_folders_local, &sources_folder, &sources_uri);
+ if (((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_REMOTE_ACTIVE || ((VfolderRule *)rule)->with == VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE)
+ rule_add_sources(source_folders_remote, &sources_folder, &sources_uri);
+ UNLOCK();
query = g_string_new("");
filter_rule_build_code(rule, query);