Patch: Add a get_url_string implementation for TnyMergeFolder



	Hi,

	This patch adds an implementation of get_string_url () method to
TnyMergeFolder. URL's are used to reference messages from external
applications. As we didn't have a valid implementation of
get_url_string, we couldn't reference messages in merged folders.

-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: ChangeLog
===================================================================
--- ChangeLog	(revisión: 2812)
+++ ChangeLog	(copia de trabajo)
@@ -1,3 +1,16 @@
+2007-10-03  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail/tny-merge-folder.c:
+	(tny_merge_folder_get_id): fixed id generation. We
+	were setting this with a fixed value always due to
+	an error in initialisation. Now we calculate an
+	id with the merged folder id's and their account
+	id's.
+	(tny_merge_folder_get_url_string): created 
+	implementation. Now it gets the merge folder id
+	as part of the url string with this format:
+	"merge://ID"
+
 2007-09-28  Philip Van Hoof  <pvanhoof gnome org>
 
 	* Unsigned integers can't be < 0
Index: libtinymail/tny-merge-folder.c
===================================================================
--- libtinymail/tny-merge-folder.c	(revisión: 2812)
+++ libtinymail/tny-merge-folder.c	(copia de trabajo)
@@ -650,8 +650,13 @@
 		while (!tny_iterator_is_done (iter))
 		{
 			TnyFolder *cur = TNY_FOLDER (tny_iterator_get_current (iter));
+			TnyAccount *account = tny_folder_get_account (cur);
 			if (!first)
 				g_string_append_c (ids, '&');
+			if (TNY_IS_ACCOUNT (account)) {
+				g_string_append (ids, tny_account_get_id (account));
+				g_string_append_c (ids, '+');
+			}
 			g_string_append (ids, tny_folder_get_id (cur));
 			g_object_unref (cur);
 			first = FALSE;
@@ -1271,10 +1276,7 @@
 static gchar*
 tny_merge_folder_get_url_string (TnyFolder *self)
 {
-	g_warning ("tny_merge_folder_get_url_string not reliable. "
-		   "Please don't use this functionality\n");
-
-	return "not://implemented";
+	return g_strdup_printf ("merge://%s", tny_folder_get_id (self));
 }
 
 static TnyFolderCaps
@@ -1467,9 +1469,7 @@
 	TnyMergeFolder *self = (TnyMergeFolder *) instance;
 	TnyMergeFolderPriv *priv = TNY_MERGE_FOLDER_GET_PRIVATE (self);
 
-	/* The get_id_func() DBC contract does not allow this to be NULL or "": */
-	priv->id = g_strdup ("unknown_mergefolder");
-	
+	priv->id = NULL;
 	priv->mothers = tny_simple_list_new ();
 	priv->lock = g_new0 (GStaticRecMutex, 1);
 	g_static_rec_mutex_init (priv->lock);


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