[evolution-patches] [Contacts] Fix for Bug 237297



hi,

This is the patch for following bug:
http://bugzilla.gnome.org/show_bug.cgi?id=237297

The File under in the Contact Editor displays in this format LAST-NAME, FIRST-NAME SECOND-NAME when
First Name, Last Name and Middle Name is entered in the Full Name...

Thanks,
M Victor Aloysius J
Index: e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.245
diff -u -r1.245 e-contact-editor.c
--- e-contact-editor.c	10 Dec 2005 09:52:23 -0000	1.245
+++ e-contact-editor.c	6 Jan 2006 22:32:49 -0000
@@ -356,13 +356,20 @@
 	case 0: /* Fall Through */
 	case 1:
 		return TRUE;
-	case 2:
+        case 2:
+                if(name) {
+                        if (name->additional && *name->additional)
+                                return TRUE; 
+                        else
+                                return FALSE;
+                }
+	case 3:
 		if (company && *company)
 			return TRUE;
 		else
 			return FALSE;
-	case 3: /* Fall Through */
-	case 4:
+	case 4: /* Fall Through */
+	case 5:
 		if (company && *company && name && ((name->given && *name->given) || (name->family && *name->family)))
 			return TRUE;
 		else
@@ -377,6 +384,7 @@
 {
 	char *string;
 	char *strings[4], **stringptr;
+        char *midstring[4], **midstrptr; 
 	char *substring;
 	switch (style) {
 	case 0:
@@ -401,11 +409,29 @@
 		*stringptr = NULL;
 		string = g_strjoinv(" ", strings);
 		break;
-	case 2:
+        case 2:
+                midstrptr=midstring;  
+                if(name){
+                        if (name->family && *name->family)
+			        *(midstrptr++) = name->family;
+                       if (name->given && *name->given)
+			        *(midstrptr++) = name->given;
+                 }
+                *midstrptr = NULL;
+                stringptr = strings;
+                *(stringptr++) = g_strjoinv(", ", midstring);
+               	if (name) {
+			if (name->additional && *name->additional)
+				*(stringptr++) = name->additional;
+		}
+		*stringptr = NULL;
+               	string = g_strjoinv(" ", strings);
+               	break; 
+	case 3:
 		string = g_strdup(company);
 		break;
-	case 3: /* Fall Through */
-	case 4:
+	case 4: /* Fall Through */
+	case 5:
 		stringptr = strings;
 		if (name) {
 			if (name->family && *name->family)
@@ -417,7 +443,7 @@
 		substring = g_strjoinv(", ", strings);
 		if (!(company && *company))
 			company = "";
-		if (style == 3)
+		if (style == 4)
 			string = g_strdup_printf("%s (%s)", substring, company);
 		else
 			string = g_strdup_printf("%s (%s)", company, substring);
@@ -448,7 +474,7 @@
 	filestring = g_strdup (gtk_entry_get_text (file_as));
 
 	style = -1;
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < 6; i++) {
 		trystring = name_to_style (name, company, i);
 		if (!strcmp(trystring, filestring)) {
 			g_free(trystring);
@@ -484,7 +510,7 @@
 
 	widget = glade_xml_get_widget (editor->gui, "combo-file-as");
 
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < 6; i++) {
 		if (style_makes_sense (editor->name, company, i)) {
 			char *u;
 			u = name_to_style (editor->name, company, i);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.2025
diff -u -r1.2025 ChangeLog
--- ChangeLog	21 Dec 2005 07:18:46 -0000	1.2025
+++ ChangeLog	6 Jan 2006 22:36:36 -0000
@@ -1,3 +1,9 @@
+2006-12-7 M Victor Aloysius J <victoraloy gmail com>
+
+       * gui/contact-editor/e-contact-editor.c (style_makes_sense): 
+         (name_to_style):Added feature for missing middle name.             
+         Fixes #237297 
+
 2005-12-21  Not Zed  <NotZed Ximian com>
  
  	* gui/component/addressbook-component.c (impl_createView): changed



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