evolution-data-server r8939 - in branches/camel-db-summary/camel: . providers/local



Author: sragavan
Date: Fri Jun  6 08:04:11 2008
New Revision: 8939
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8939&view=rev

Log:
It works better now.


Modified:
   branches/camel-db-summary/camel/camel-db.c
   branches/camel-db-summary/camel/camel-folder-summary.c
   branches/camel-db-summary/camel/camel-folder-summary.h
   branches/camel-db-summary/camel/providers/local/camel-mbox-store.c
   branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c

Modified: branches/camel-db-summary/camel/camel-db.c
==============================================================================
--- branches/camel-db-summary/camel/camel-db.c	(original)
+++ branches/camel-db-summary/camel/camel-db.c	Fri Jun  6 08:04:11 2008
@@ -368,9 +368,9 @@
 	char *del_query;
 	char *ins_query;
 
-	ins_query = sqlite3_mprintf ("INSERT INTO folders VALUES ( %Q, %d, %d, %d, 143, %d, %d, %d, %d, %Q ) ", 
+	ins_query = sqlite3_mprintf ("INSERT INTO folders VALUES ( %Q, %d, %d, %d, %d, %d, %d, %d, %d, %Q ) ", 
 			record->folder_name, record->version,
-			record->flags, record->nextuid,
+								 record->flags, record->nextuid, 123,
 			record->saved_count, record->unread_count,
 			record->deleted_count, record->junk_count, record->bdata); 
 

Modified: branches/camel-db-summary/camel/camel-folder-summary.c
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.c	(original)
+++ branches/camel-db-summary/camel/camel-folder-summary.c	Fri Jun  6 08:04:11 2008
@@ -103,7 +103,7 @@
 static int summary_meta_header_load(CamelFolderSummary *, FILE *);
 static int summary_meta_header_save(CamelFolderSummary *, FILE *);
 
-static int camel_folder_summary_header_load_from_db (CamelFolderSummary *s, CamelException *ex);
+
 
 static CamelMessageInfo * message_info_new_from_header(CamelFolderSummary *, struct _camel_header_raw *);
 static CamelMessageInfo * message_info_new_from_parser(CamelFolderSummary *, CamelMimeParser *);
@@ -498,7 +498,6 @@
 		}
 	}
 
-	#warning "this will help to find crash, so leave it just like this atm"
 	if (info)
 		info->refcount++;
 	
@@ -648,7 +647,7 @@
 	camel_exception_init (&ex);
 	s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
-	ret = camel_folder_summary_header_load_from_db (s, &ex);
+	ret = camel_folder_summary_header_load_from_db (s, s->folder->parent_store, s->folder->full_name, &ex);
 
 	if (ret)
 		return ret;
@@ -739,7 +738,8 @@
 		}
 
 		/* Just now we are reading from the DB, it can't be dirty. */
-		((CamelMessageInfoBase *)info)->flags &= CAMEL_MESSAGE_DB_DIRTY;
+		((CamelMessageInfoBase *)info)->dirty = FALSE;
+//		((CamelMessageInfoBase *)info)->flags &= ~CAMEL_MESSAGE_DB_DIRTY;
 		camel_folder_summary_add (s, info);
 
 		d(g_print ("\nAdding messageinfo to db from db \n"));
@@ -876,9 +876,10 @@
 	char *folder_name = s->folder->full_name;
 	CamelDB *cdb = s->folder->parent_store->cdb;
 	CamelMIRecord *mir;
-	
-	if (!(mi->flags & CAMEL_MESSAGE_DB_DIRTY))
+
+	if (!mi->dirty)
 		return;
+
 	mir = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_to_db (s, (CamelMessageInfo *)mi);
 	
 	if (mir && s->build_content) {
@@ -896,7 +897,7 @@
 	}
 
 	/* Reset the flags */
-	mi->flags &= ~CAMEL_MESSAGE_DB_DIRTY;
+	mi->dirty = FALSE;
 	
 	camel_db_camel_mir_free (mir);	
 }
@@ -1116,19 +1117,17 @@
 	return -1;
 }
 
-static int
-camel_folder_summary_header_load_from_db (CamelFolderSummary *s, CamelException *ex)
+int
+camel_folder_summary_header_load_from_db (CamelFolderSummary *s, CamelStore *store, const char *folder_name, CamelException *ex)
 {
 	CamelDB *cdb;
 	CamelFIRecord *record;
-	char *folder_name;
 	int ret = 0;
 
 	d(printf ("\ncamel_folder_summary_load_from_db called \n"));
 	s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
-	folder_name = s->folder->full_name;
-	cdb = s->folder->parent_store->cdb;
+	cdb = store->cdb;
 
 	record = g_new0 (CamelFIRecord, 1);
 	camel_db_read_folder_info_record (cdb, folder_name, &record, ex);
@@ -1259,7 +1258,7 @@
 #endif
 
 	/* Summary always holds a ref for the loaded infos */
-	camel_message_info_ref(info); //FIXME: Check how things are loaded.
+	//camel_message_info_ref(info); //FIXME: Check how things are loaded.
 	#warning "FIXME: SHould we ref it or redesign it later on"
 	/* The uid array should have its own memory. We will unload the infos when not reqd.*/
 	g_ptr_array_add (s->uids, g_strdup(camel_message_info_uid(info)));
@@ -3556,7 +3555,7 @@
 	info->summary = s;
 
 	/* We assume that mi is always dirty unless freshly read or just saved*/
-	((CamelMessageInfoBase *)info)->flags |= CAMEL_MESSAGE_DB_DIRTY;
+	((CamelMessageInfoBase *)info)->dirty = TRUE;
 	
 	return info;
 }
@@ -3896,6 +3895,7 @@
 	mi->flags = (old & ~flags) | (set & flags);
 	if (old != mi->flags) {
 		mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+		mi->dirty = TRUE;
 		if (mi->summary)
 			camel_folder_summary_touch(mi->summary);
 	}
@@ -3947,6 +3947,7 @@
 		CamelFolderChangeInfo *changes = camel_folder_change_info_new();
 
 		mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+		mi->dirty = TRUE;
 		camel_folder_summary_touch(mi->summary);
 		camel_folder_change_info_change_uid(changes, camel_message_info_uid(info));
 		camel_object_trigger_event(mi->summary->folder, "folder_changed", changes);
@@ -3988,6 +3989,7 @@
 		CamelFolderChangeInfo *changes = camel_folder_change_info_new();
 
 		mi->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+		mi->dirty = TRUE;		
 		camel_folder_summary_touch(mi->summary);
 		camel_folder_change_info_change_uid(changes, camel_message_info_uid(info));
 		camel_object_trigger_event(mi->summary->folder, "folder_changed", changes);

Modified: branches/camel-db-summary/camel/camel-folder-summary.h
==============================================================================
--- branches/camel-db-summary/camel/camel-folder-summary.h	(original)
+++ branches/camel-db-summary/camel/camel-folder-summary.h	Fri Jun  6 08:04:11 2008
@@ -185,6 +185,9 @@
 	/* tree of content description - NULL if it is not available */
 	CamelMessageContentInfo *content;
 	struct _camel_header_param *headers;
+
+	/*FIXME: Make it work with the CAMEL_MESSADE_DB_DIRTY flag instead of another 4 bytes*/
+	gboolean dirty;
 };
 
 /* probably do this as well, removing CamelFolderChangeInfo and interfaces 
@@ -326,6 +329,7 @@
 
 /* only load the header */
 int camel_folder_summary_header_load(CamelFolderSummary *summary);
+int camel_folder_summary_header_load_from_db (CamelFolderSummary *s, CamelStore *store, const char *folder_name, CamelException *ex);
 
 /* set the dirty bit on the summary */
 void camel_folder_summary_touch(CamelFolderSummary *summary);

Modified: branches/camel-db-summary/camel/providers/local/camel-mbox-store.c
==============================================================================
--- branches/camel-db-summary/camel/providers/local/camel-mbox-store.c	(original)
+++ branches/camel-db-summary/camel/providers/local/camel-mbox-store.c	Fri Jun  6 08:04:11 2008
@@ -638,7 +638,8 @@
 		folderpath = camel_local_store_get_full_path(store, fi->full_name);
 		
 		mbs = (CamelMboxSummary *)camel_mbox_summary_new(NULL, path, folderpath, NULL);
-		if (camel_folder_summary_header_load((CamelFolderSummary *)mbs) != -1) {
+		#warning "track exception"
+		if (camel_folder_summary_header_load_from_db ((CamelFolderSummary *)mbs, store, fi->full_name, NULL) != -1) {
 			fi->unread = ((CamelFolderSummary *)mbs)->unread_count;
 			fi->total = ((CamelFolderSummary *)mbs)->saved_count;
 		}

Modified: branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c
==============================================================================
--- branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c	(original)
+++ branches/camel-db-summary/camel/providers/local/camel-mbox-summary.c	Fri Jun  6 08:04:11 2008
@@ -984,8 +984,7 @@
 		CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
 
 		g_assert(info);
-//		if (!info)
-//			continue;
+		
 		if ((expunge && (info->info.info.flags & CAMEL_MESSAGE_DELETED)) ||
 		    (info->info.info.flags & (CAMEL_MESSAGE_FOLDER_NOXEV|CAMEL_MESSAGE_FOLDER_XEVCHANGE)))
 			quick = FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]