[evolution-patches] searching labels broken, storing labels broken, #41972



This makes sure labels are stored as untranslated/uncostomisable tokens,
so searches/etc can work properly.  This is how 1.2 does it, so it was a
regression.

The last bit of the patch just removes some compile warnings.

 Z

Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2707
diff -u -3 -r1.2707 ChangeLog
--- mail/ChangeLog	28 Apr 2003 18:04:09 -0000	1.2707
+++ mail/ChangeLog	29 Apr 2003 05:20:47 -0000
@@ -1,3 +1,24 @@
+2003-04-29  Not Zed  <NotZed Ximian com>
+
+	** See bug #41972
+
+	* message-list.c (ml_tree_value_at): fix (void *) casts on trinary
+	ops.
+
+	* folder-browser.c (on_right_click): Store the label tag in the
+	label callback data, not the translated name.
+
+	* mail-config.c (label_defaults[]): Initialise with the tag
+	values.
+	(config_clear_labels): free tag field.
+	(config_cache_labels): setup the tag field based on the position
+	of the label name.
+	(mail_config_get_label_color_by_name): Lookup colour by the
+	untranslated TAG, not the translated/customisable tag.
+
+	* mail-config.h (MailConfigLabel): Add a tag field, we were using
+	the translated name as the label(!).
+
 2003-04-28  Ettore Perazzoli  <ettore ximian com>
 
 	* mail-session.c (mail_session_forget_passwords): Forget all
Index: mail/folder-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
retrieving revision 1.341
diff -u -3 -r1.341 folder-browser.c
--- mail/folder-browser.c	24 Apr 2003 19:09:04 -0000	1.341
+++ mail/folder-browser.c	29 Apr 2003 05:20:48 -0000
@@ -2099,7 +2099,7 @@
 		closure = g_new (struct _label_data, 1);
 		g_object_ref (fb);
 		closure->fb = fb;
-		closure->label = label->name;
+		closure->label = label->tag;
 		
 		g_ptr_array_add (closures, closure);
 		
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.273
diff -u -3 -r1.273 mail-config.c
--- mail/mail-config.c	28 Apr 2003 16:00:45 -0000	1.273
+++ mail/mail-config.c	29 Apr 2003 05:20:49 -0000
@@ -63,13 +63,13 @@
 
 #include "Mailer.h"
 
-
+/* Note, the first element of each MailConfigLabel must NOT be translated */
 MailConfigLabel label_defaults[5] = {
-	{ N_("Important"), "#ff0000" },  /* red */
-	{ N_("Work"),      "#ff8c00" },  /* orange */
-	{ N_("Personal"),  "#008b00" },  /* forest green */
-	{ N_("To Do"),     "#0000ff" },  /* blue */
-	{ N_("Later"),     "#8b008b" }   /* magenta */
+	{ "important", N_("Important"), "#ff0000" },  /* red */
+	{ "work",      N_("Work"),      "#ff8c00" },  /* orange */
+	{ "personal",  N_("Personal"),  "#008b00" },  /* forest green */
+	{ "todo",      N_("To Do"),     "#0000ff" },  /* blue */
+	{ "later",     N_("Later"),     "#8b008b" }   /* magenta */
 };
 
 typedef struct {
@@ -320,6 +320,7 @@
 	list = config->labels;
 	while (list != NULL) {
 		label = list->data;
+		g_free(label->tag);
 		g_free (label->name);
 		g_free (label->colour);
 		g_free (label);
@@ -347,10 +348,11 @@
 	while (list != NULL) {
 		buf = list->data;
 		
-		if ((colour = strrchr (buf, ':'))) {
+		if (num < 5 && (colour = strrchr (buf, ':'))) {
 			label = g_new (MailConfigLabel, 1);
 			
 			*colour++ = '\0';
+			label->tag = g_strdup(label_defaults[num].tag);
 			label->name = g_strdup (buf);
 			label->colour = g_strdup (colour);
 			
@@ -378,6 +380,7 @@
 	while (num < 5) {
 		/* complete the list with defaults */
 		label = g_new (MailConfigLabel, 1);
+		label->tag = g_strdup (label_defaults[num].tag);
 		label->name = g_strdup (_(label_defaults[num].name));
 		label->colour = g_strdup (label_defaults[num].colour);
 		
@@ -665,7 +668,7 @@
 	node = config->labels;
 	while (node != NULL) {
 		label = node->data;
-		if (!strcmp (label->name, name))
+		if (!strcmp (label->tag, name))
 			return label->colour;
 		node = node->next;
 	}
Index: mail/mail-config.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.h,v
retrieving revision 1.110
diff -u -3 -r1.110 mail-config.h
--- mail/mail-config.h	28 Apr 2003 16:00:47 -0000	1.110
+++ mail/mail-config.h	29 Apr 2003 05:20:49 -0000
@@ -82,6 +82,7 @@
 } MailConfigXMailerDisplayStyle;
 
 typedef struct {
+	char *tag;
 	char *name;
 	char *colour;
 } MailConfigLabel;
Index: mail/message-list.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-list.c,v
retrieving revision 1.337
diff -u -3 -r1.337 message-list.c
--- mail/message-list.c	14 Apr 2003 22:52:32 -0000	1.337
+++ mail/message-list.c	29 Apr 2003 05:20:50 -0000
@@ -950,17 +950,17 @@
 	}
 	case COL_FOLLOWUP_FLAG:
 		str = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
-		return (void *) str ? str : "";
+		return (void *)(str ? str : "");
 	case COL_ATTACHMENT:
 		return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
 	case COL_FROM:
 		str = camel_message_info_from (msg_info);
-		return (void *) str ? str : "";
+		return (void *)(str ? str : "");
 	case COL_FROM_NORM:
 		return (void *) get_normalised_string (message_list, msg_info, col);
 	case COL_SUBJECT:
 		str = camel_message_info_subject (msg_info);
-		return (void *) str ? str : "";
+		return (void *)(str ? str : "");
 	case COL_SUBJECT_NORM:
 		return (void *) get_normalised_string (message_list, msg_info, col);
 	case COL_SENT:
@@ -969,7 +969,7 @@
 		return GINT_TO_POINTER (msg_info->date_received);
 	case COL_TO:
 		str = camel_message_info_to (msg_info);
-		return (void *) str ? str : "";
+		return (void *)(str ? str : "");
 	case COL_TO_NORM:
 		return (void *) get_normalised_string (message_list, msg_info, col);
 	case COL_SIZE:


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