aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog17
-rw-r--r--mail/component-factory.c4
-rw-r--r--mail/folder-browser.c19
-rw-r--r--mail/folder-browser.h2
-rw-r--r--mail/mail-folder-cache.c9
-rw-r--r--mail/mail-local.c2
-rw-r--r--mail/mail-vfolder.c29
7 files changed, 56 insertions, 26 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 6844a1a362..638e26b389 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,20 @@
+2001-10-29 <NotZed@Ximian.com>
+
+ * mail-vfolder.c (rule_changed): Copy the folder's full_name
+ before trying to use it to rename.
+ (vfolder_edit_rule): Set 'orig' to be a reference of the original
+ rule.
+ (edit_rule_clicked): Dont lookup orig by name, copy it over
+ instead.
+
+ * folder-browser.c (got_folder): oops, emit signal before
+ unreffing object, incase we got killded during getting folder.
+ (got_folder): Reset get_id.
+ (folder_browser_new): Set get_id of the get_folder task.
+ (folder_browser_init): Init get_id.
+ (folder_browser_destroy): IF we have outstanding 'get folder' op,
+ cancel it.
+
2001-10-28 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (mail_account_gui_save): Call
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 0139cb43e7..2ac7a4a110 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -46,13 +46,15 @@
#include "mail-session.h"
#include "mail-mt.h"
#include "mail-importer.h"
-#include "mail-vfolder.h" /* vfolder_create_storage */
#include "mail-folder-cache.h"
#include "component-factory.h"
#include "mail-send-recv.h"
+#include "mail-vfolder.h"
+#include "mail-autofilter.h"
+
char *default_drafts_folder_uri;
CamelFolder *drafts_folder = NULL;
char *default_sent_folder_uri;
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index a210a98280..8e79e6467e 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -207,6 +207,11 @@ folder_browser_destroy (GtkObject *object)
/* wait for all outstanding async events against us */
mail_async_event_destroy (folder_browser->async_event);
+
+ if (folder_browser->get_id != -1) {
+ mail_msg_cancel(folder_browser->get_id);
+ folder_browser->get_id = -1;
+ }
if (folder_browser->folder) {
camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "folder_changed",
@@ -826,8 +831,10 @@ static void folder_changed(CamelObject *o, void *event_data, void *data)
static void
got_folder(char *uri, CamelFolder *folder, void *data)
{
- FolderBrowser *fb = data;
-
+ FolderBrowser *fb = data;
+
+ fb->get_id = -1;
+
d(printf ("got folder '%s' = %p, previous folder was %p\n", uri, folder, fb->folder));
if (fb->message_list == NULL)
@@ -855,10 +862,9 @@ got_folder(char *uri, CamelFolder *folder, void *data)
if (fb->uicomp)
folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE);
- done:
- gtk_object_unref (GTK_OBJECT (fb));
-
+ done:
gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [FOLDER_LOADED], fb->uri);
+ gtk_object_unref (GTK_OBJECT (fb));
}
void
@@ -1932,6 +1938,7 @@ folder_browser_init (GtkObject *object)
FolderBrowser *fb = (FolderBrowser *)object;
fb->async_event = mail_async_event_new();
+ fb->get_id = -1;
}
static void
@@ -2035,7 +2042,7 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri)
folder_browser->uri = g_strdup (uri);
gtk_object_ref (GTK_OBJECT (folder_browser));
- mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new);
+ folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new);
return GTK_WIDGET (folder_browser);
}
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index d5a494ce54..b3d0b3f7af 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -86,6 +86,8 @@ struct _FolderBrowser {
/* for async events */
struct _MailAsyncEvent *async_event;
+
+ int get_id; /* for getting folder op */
};
typedef struct {
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 3ef602eda0..732a9dadb5 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -47,7 +47,7 @@
#include "mail-vfolder.h"
#include "mail-autofilter.h"
-#define d(x)
+#define d(x) x
/* note that many things are effectively serialised by having them run in
the main loop thread which they need to do because of corba/gtk calls */
@@ -161,13 +161,16 @@ real_flush_updates(void *o, void *event_data, void *data)
} else {
/* Its really a rename, but we have no way of telling the shell that, so remove it */
if (up->oldpath) {
- if (storage != NULL)
+ if (storage != NULL) {
+ printf("Removing old folder (rename?) '%s'\n", up->oldpath);
evolution_storage_removed_folder(storage, up->oldpath);
+ }
/* ELSE? Shell supposed to handle the local snot case */
}
/* We can tell the vfolder code though */
if (up->olduri && up->add) {
+ printf("renaming folder '%s' to '%s'\n", up->olduri, up->uri);
mail_vfolder_rename_uri(up->store, up->olduri, up->uri);
mail_filter_rename_uri(up->store, up->olduri, up->uri);
}
@@ -590,7 +593,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
CamelRenameInfo *info = event_data;
struct _store_info *si;
- d(printf("Folder renamed?\n"));
+ d(printf("Folder renamed: oldbase = '%s' new->full = '%s'\n", info->old_base, info->new->full_name));
LOCK(info_lock);
si = g_hash_table_lookup(stores, store);
diff --git a/mail/mail-local.c b/mail/mail-local.c
index c2f1ad87f7..77dec887b5 100644
--- a/mail/mail-local.c
+++ b/mail/mail-local.c
@@ -821,7 +821,7 @@ static void
mls_rename_folder(CamelStore *store, const char *old_name, const char *new_name, CamelException *ex)
{
CamelStore *real_store;
- MailLocalStore *mls = (MailLocalStore *)store;
+ /*MailLocalStore *mls = (MailLocalStore *)store;*/
char *uri;
/*CamelException local_ex;*/
struct _local_meta *meta;
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 216337b4b0..76ba1e200e 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -44,7 +44,7 @@
#include "e-util/e-unicode-i18n.h"
-#define d(x)
+#define d(x) x
static VfolderContext *context; /* context remains open all time */
static CamelStore *vfolder_store; /* the 1 static vfolder store */
@@ -498,7 +498,7 @@ rule_changed(FilterRule *rule, CamelFolder *folder)
/* if the folder has changed name, then add it, then remove the old manually */
if (strcmp(folder->full_name, rule->name) != 0) {
- char *key;
+ char *key, *oldname;
CamelFolder *old;
LOCK();
@@ -513,7 +513,10 @@ rule_changed(FilterRule *rule, CamelFolder *folder)
g_warning("couldn't find a vfolder rule in our table? %s", folder->full_name);
}
- camel_store_rename_folder(vfolder_store, folder->full_name, rule->name, NULL);
+ /* TODO: make the folder->full_name var thread accessible */
+ oldname = g_strdup(folder->full_name);
+ camel_store_rename_folder(vfolder_store, oldname, rule->name, NULL);
+ g_free(oldname);
}
d(printf("Filter rule changed? for folder '%s'!!\n", folder->name));
@@ -783,15 +786,9 @@ edit_rule_clicked(GtkWidget *w, int button, void *data)
if (button == 0) {
char *user;
FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule");
- FilterRule *orig;
+ FilterRule *orig = gtk_object_get_data((GtkObject *)w, "orig");
- orig = rule_context_find_rule((RuleContext *)context, rule->name, NULL);
- if (orig) {
- filter_rule_copy(orig, rule);
- } else {
- gtk_object_ref((GtkObject *)rule);
- rule_context_add_rule((RuleContext *)context, rule);
- }
+ filter_rule_copy(orig, rule);
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
rule_context_save((RuleContext *)context, user);
g_free(user);
@@ -806,15 +803,16 @@ vfolder_edit_rule(const char *uri)
{
GtkWidget *w;
GnomeDialog *gd;
- FilterRule *rule;
+ FilterRule *rule, *newrule;
CamelURL *url;
url = camel_url_new(uri, NULL);
if (url && url->fragment
&& (rule = rule_context_find_rule((RuleContext *)context, url->fragment, NULL))) {
- rule = filter_rule_clone(rule);
+ gtk_object_ref((GtkObject *)rule);
+ newrule = filter_rule_clone(rule);
- w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context);
+ w = filter_rule_get_widget((FilterRule *)newrule, (RuleContext *)context);
gd = (GnomeDialog *)gnome_dialog_new(_("Edit VFolder"),
GNOME_STOCK_BUTTON_OK,
@@ -826,7 +824,8 @@ vfolder_edit_rule(const char *uri)
gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500);
gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0);
gtk_widget_show((GtkWidget *)gd);
- gtk_object_set_data_full((GtkObject *)gd, "rule", rule, (GtkDestroyNotify)gtk_object_unref);
+ gtk_object_set_data_full((GtkObject *)gd, "rule", newrule, (GtkDestroyNotify)gtk_object_unref);
+ gtk_object_set_data_full((GtkObject *)gd, "orig", rule, (GtkDestroyNotify)gtk_object_unref);
gtk_signal_connect((GtkObject *)gd, "clicked", edit_rule_clicked, NULL);
gtk_widget_show((GtkWidget *)gd);
} else {