diff options
-rw-r--r-- | camel/ChangeLog | 27 | ||||
-rw-r--r-- | camel/camel-folder.c | 49 | ||||
-rw-r--r-- | camel/camel-object.h | 8 | ||||
-rw-r--r-- | camel/camel-vee-folder.c | 17 | ||||
-rw-r--r-- | camel/providers/local/camel-mbox-folder.c | 14 |
5 files changed, 61 insertions, 54 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index e0366d49ba..0365684d03 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,30 @@ +2004-04-08 Not Zed <NotZed@Ximian.com> + + * camel-folder.c: include camel-debug.h + + * providers/local/camel-mbox-folder.c + (mbox_set_message_user_flag): message changed to folder_changed. + (mbox_set_message_user_tag): ditto. + + * camel-vee-folder.c (camel_vee_folder_finalise): dont hook onto + message_changed. + (camel_vee_folder_add_folder): or unhook. + (camel_vee_folder_remove_folder): " + (message_changed): or proxy. + + * camel-folder.c (camel_folder_class_init): removed the + message_changed event - its redundant, and covered by + folder_changed, and just makes life difficult for everything using + message_changed/folder_changed (and nothing uses it anyway). + (message_changed): removed. + (set_message_user_flag): emit a folder_changed event instead of + message changed. + (set_message_user_tag): " + (set_message_flags): " + + * camel-object.h: revered the CAMEL_OBJECT_TYPE change, it should + be a global variable access. + 2004-04-06 Jeffrey Stedfast <fejj@ximian.com> * providers/imap4/camel-imap4-folder.c: Added mutex locking where diff --git a/camel/camel-folder.c b/camel/camel-folder.c index d467e6bade..129ca418ce 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -22,7 +22,6 @@ * USA */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -33,6 +32,7 @@ #include "camel-exception.h" #include "camel-store.h" #include "camel-mime-message.h" +#include "camel-debug.h" #include "e-util/e-memory.h" #include "camel-operation.h" @@ -116,8 +116,6 @@ static gboolean is_frozen (CamelFolder *folder); static gboolean folder_changed (CamelObject *object, gpointer event_data); -static gboolean message_changed (CamelObject *object, - /*const char *uid*/gpointer event_data); static void camel_folder_class_init (CamelFolderClass *camel_folder_class) @@ -168,7 +166,6 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) /* events */ camel_object_class_add_event(camel_object_class, "folder_changed", folder_changed); - camel_object_class_add_event(camel_object_class, "message_changed", message_changed); camel_object_class_add_event(camel_object_class, "deleted", NULL); camel_object_class_add_event(camel_object_class, "renamed", NULL); } @@ -725,6 +722,7 @@ static gboolean set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set) { CamelMessageInfo *info; + CamelFolderChangeInfo *changes; guint32 new; g_return_val_if_fail(folder->summary != NULL, FALSE); @@ -743,7 +741,10 @@ set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 s camel_folder_summary_touch(folder->summary); camel_folder_summary_info_free(folder->summary, info); - camel_object_trigger_event(folder, "message_changed", (char *) uid); + changes = camel_folder_change_info_new(); + camel_folder_change_info_change_uid(changes, uid); + camel_object_trigger_event(folder, "folder_changed", changes); + camel_folder_change_info_free(changes); return TRUE; } @@ -825,9 +826,13 @@ set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gb return; if (camel_flag_set(&info->user_flags, name, value)) { + CamelFolderChangeInfo *changes = camel_folder_change_info_new(); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch(folder->summary); - camel_object_trigger_event (folder, "message_changed", (char *) uid); + camel_folder_change_info_change_uid(changes, uid); + camel_object_trigger_event (folder, "folder_changed", changes); + camel_folder_change_info_free(changes); } camel_folder_summary_info_free(folder->summary, info); } @@ -905,9 +910,13 @@ set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, con return; if (camel_tag_set(&info->user_tags, name, value)) { + CamelFolderChangeInfo *changes = camel_folder_change_info_new(); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED; camel_folder_summary_touch(folder->summary); - camel_object_trigger_event (folder, "message_changed", (char *) uid); + camel_folder_change_info_change_uid(changes, uid); + camel_object_trigger_event (folder, "folder_changed", changes); + camel_folder_change_info_free(changes); } camel_folder_summary_info_free(folder->summary, info); } @@ -1522,7 +1531,7 @@ freeze (CamelFolder *folder) * @folder: a folder * * Freezes the folder so that a series of operation can be performed - * without "message_changed" and "folder_changed" signals being emitted. + * without "folder_changed" signals being emitted. * When the folder is later thawed with camel_folder_thaw(), the * suppressed signals will be emitted. **/ @@ -1565,8 +1574,8 @@ thaw (CamelFolder * folder) * camel_folder_thaw: * @folder: a folder * - * Thaws the folder and emits any pending folder_changed or - * message_changed signals. + * Thaws the folder and emits any pending folder_changed + * signals. **/ void camel_folder_thaw (CamelFolder *folder) @@ -1821,26 +1830,6 @@ folder_changed (CamelObject *obj, gpointer event_data) return ret; } -static gboolean -message_changed (CamelObject *obj, /*const char *uid*/gpointer event_data) -{ - CamelFolder *folder = CAMEL_FOLDER (obj); - gboolean ret = TRUE; - - d(printf ("message_changed(%p, %p), frozen=%d\n", folder, event_data, folder->priv->frozen)); - - if (folder->priv->frozen) { - CAMEL_FOLDER_LOCK(folder, change_lock); - - camel_folder_change_info_change_uid(folder->priv->changed_frozen, (char *)event_data); - ret = FALSE; - - CAMEL_FOLDER_UNLOCK(folder, change_lock); - } - - return ret; -} - /** * camel_folder_free_nop: * @folder: a folder diff --git a/camel/camel-object.h b/camel/camel-object.h index 69068e02be..80e68aecf3 100644 --- a/camel/camel-object.h +++ b/camel/camel-object.h @@ -1,12 +1,11 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* camel-object.h: Base class for Camel */ - /* - * Author: + * Authors: * Dan Winship <danw@ximian.com> * Michael Zucchi <notzed@ximian.com> * - * Copyright 2000 Ximian, Inc. (www.ximian.com) + * Copyright 2000-2004 Novell, Inc. (www.novell.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -23,7 +22,6 @@ * USA */ - #ifndef CAMEL_OBJECT_H #define CAMEL_OBJECT_H 1 @@ -61,7 +59,7 @@ typedef struct _CamelObjectClass *CamelType; extern CamelType camel_object_type; -#define CAMEL_OBJECT_TYPE (camel_object_get_type ()) +#define CAMEL_OBJECT_TYPE (camel_object_type) /* we can't check casts till we've got the type, use the global type variable because its cheaper */ #define CAMEL_OBJECT(obj) (CAMEL_CHECK_CAST((obj), camel_object_type, CamelObject)) diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c index b937951962..69e5b0dbcb 100644 --- a/camel/camel-vee-folder.c +++ b/camel/camel-vee-folder.c @@ -77,7 +77,6 @@ static void camel_vee_folder_finalise (CamelObject *obj); static int vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException *ex); static void vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *source, int killun); -static void message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf); static void folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder *vf); static void subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf); @@ -181,7 +180,6 @@ camel_vee_folder_finalise (CamelObject *obj) if (vf != folder_unmatched) { camel_object_unhook_event((CamelObject *)f, "folder_changed", (CamelObjectEventHookFunc) folder_changed, vf); - camel_object_unhook_event((CamelObject *)f, "message_changed", (CamelObjectEventHookFunc) message_changed, vf); camel_object_unhook_event((CamelObject *)f, "deleted", (CamelObjectEventHookFunc) subfolder_deleted, vf); /* this updates the vfolder */ if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) @@ -374,7 +372,6 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub) d(printf("camel_vee_folder_add_folde(%p, %p)\n", vf, sub)); camel_object_hook_event((CamelObject *)sub, "folder_changed", (CamelObjectEventHookFunc)folder_changed, vf); - camel_object_hook_event((CamelObject *)sub, "message_changed", (CamelObjectEventHookFunc)message_changed, vf); camel_object_hook_event((CamelObject *)sub, "deleted", (CamelObjectEventHookFunc)subfolder_deleted, vf); vee_folder_build_folder(vf, sub, NULL); @@ -406,7 +403,6 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub) } camel_object_unhook_event((CamelObject *)sub, "folder_changed", (CamelObjectEventHookFunc) folder_changed, vf); - camel_object_unhook_event((CamelObject *)sub, "message_changed", (CamelObjectEventHookFunc) message_changed, vf); camel_object_unhook_event((CamelObject *)sub, "deleted", (CamelObjectEventHookFunc) subfolder_deleted, vf); p->folders = g_list_remove(p->folders, sub); @@ -1634,18 +1630,6 @@ folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder camel_session_thread_queue(session, &m->msg, 0); } -/* track flag changes in the summary, we just promote it to a folder_changed event */ -static void -message_changed(CamelFolder *f, const char *uid, CamelVeeFolder *vf) -{ - CamelFolderChangeInfo *changes; - - changes = camel_folder_change_info_new(); - camel_folder_change_info_change_uid(changes, uid); - folder_changed(f, changes, vf); - camel_folder_change_info_free(changes); -} - /* track vanishing folders */ static void subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf) @@ -1653,7 +1637,6 @@ subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf) camel_vee_folder_remove_folder(vf, f); } - static void vee_freeze (CamelFolder *folder) { diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c index f06d4e31f5..eeeb974a52 100644 --- a/camel/providers/local/camel-mbox-folder.c +++ b/camel/providers/local/camel-mbox-folder.c @@ -522,9 +522,14 @@ mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *nam return; if (camel_flag_set(&info->user_flags, name, value)) { + CamelFolderChangeInfo *changes = camel_folder_change_info_new(); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE; camel_folder_summary_touch(folder->summary); - camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); + + camel_folder_change_info_change_uid(changes, uid); + camel_object_trigger_event(folder, "folder_changed", changes); + camel_folder_change_info_free(changes); } camel_folder_summary_info_free(folder->summary, info); } @@ -541,9 +546,14 @@ mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name return; if (camel_tag_set(&info->user_tags, name, value)) { + CamelFolderChangeInfo *changes = camel_folder_change_info_new(); + info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED|CAMEL_MESSAGE_FOLDER_XEVCHANGE; camel_folder_summary_touch(folder->summary); - camel_object_trigger_event(CAMEL_OBJECT(folder), "message_changed", (char *) uid); + + camel_folder_change_info_change_uid(changes, uid); + camel_object_trigger_event (folder, "folder_changed", changes); + camel_folder_change_info_free(changes); } camel_folder_summary_info_free(folder->summary, info); } |