evolution r34879 - in trunk/addressbook: . gui/widgets



Author: djihed
Date: Thu Jan 24 11:12:31 2008
New Revision: 34879
URL: http://svn.gnome.org/viewvc/evolution?rev=34879&view=rev

Log:
Fix contact cards of RTL

Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/widgets/e-minicard-label.c
   trunk/addressbook/gui/widgets/e-minicard.c

Modified: trunk/addressbook/gui/widgets/e-minicard-label.c
==============================================================================
--- trunk/addressbook/gui/widgets/e-minicard-label.c	(original)
+++ trunk/addressbook/gui/widgets/e-minicard-label.c	Thu Jan 24 11:12:31 2008
@@ -393,16 +393,21 @@
 e_minicard_label_resize_children(EMinicardLabel *e_minicard_label)
 {
 	double left_width;
+	double fieldnamewidth;
+	double fieldwidth;
+	gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
 	if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
 		left_width = e_minicard_label->max_field_name_length;
 	else
 		left_width = e_minicard_label->width / 2 - 4;
 
+	fieldnamewidth = (double) MAX ( left_width, 0 );
+	fieldwidth = (double) MAX ( e_minicard_label->width - 8 - left_width, 0 );
 	gnome_canvas_item_set( e_minicard_label->fieldname,
-			       "clip_width", (double) MAX ( left_width, 0 ),
+			       "clip_width", is_rtl ? fieldwidth : fieldnamewidth,
 			       NULL );
 	gnome_canvas_item_set( e_minicard_label->field,
-			       "clip_width", (double) MAX ( e_minicard_label->width - 8 - left_width, 0 ),
+			       "clip_width", is_rtl ? fieldnamewidth : fieldwidth,
 			       NULL );
 }
 

Modified: trunk/addressbook/gui/widgets/e-minicard.c
==============================================================================
--- trunk/addressbook/gui/widgets/e-minicard.c	(original)
+++ trunk/addressbook/gui/widgets/e-minicard.c	Thu Jan 24 11:12:31 2008
@@ -773,6 +773,7 @@
 	EMinicardField *minicard_field;
 	char *name;
 	char *string;
+ 	gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);	
 
 	group = GNOME_CANVAS_GROUP( e_minicard );
 
@@ -784,16 +785,16 @@
 	if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
 		gnome_canvas_item_set( new_item,
 				       "width", e_minicard->width - 4.0,
-				       "fieldname", string,
-			    	   "field", "",
+				       "fieldname", is_rtl ? "" : string,
+			    	       "field", is_rtl ? string : "",
 			 	      "max_field_name_length", left_width,
 			    	   "editable", FALSE /* e_minicard->editable */,
 			    	   NULL );
 	else
 		gnome_canvas_item_set( new_item,
 				       "width", e_minicard->width - 4.0,
-				       "fieldname", name,
-			    	   "field", string,
+				       "fieldname", is_rtl ? string : name,
+			    	   "field", is_rtl ? name : string,
 			 	      "max_field_name_length", left_width,
 			    	   "editable", FALSE /* e_minicard->editable */,
 			    	   NULL );
@@ -841,6 +842,7 @@
 	char *name;
 	GList *l, *le;
 	int count =0;
+	gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);	
 	GList *emails = e_contact_get (e_minicard->contact, E_CONTACT_EMAIL);
 	group = GNOME_CANVAS_GROUP( e_minicard );
 
@@ -848,7 +850,7 @@
 		const gchar *tmp;
 		char *email = NULL;
 		char *string = NULL;
-		char *full_string = NULL;
+		char *parsed_name = NULL;
 		gboolean parser_check;
 
 		tmp = get_email_location ((EVCardAttribute *) l->data);
@@ -857,10 +859,10 @@
 		else
 			name = g_strdup ("");
 
-		parser_check = eab_parse_qp_email ((const gchar *) le->data, &string, &email);
+		parser_check = eab_parse_qp_email ((const gchar *) le->data, &parsed_name, &email);
 		if (parser_check) {
 			/* if true, we had a quoted printable mail address */
-			full_string = g_strdup_printf ("%s <%s>", string, email);
+			string = g_strdup_printf ("%s <%s>", parsed_name, email);
 		} else {
 			/* we got a NON-quoted printable string */
 			string = g_strdup (le->data);
@@ -870,13 +872,12 @@
 
 		gnome_canvas_item_set( new_item,
 				       "width", e_minicard->width - 4.0,
-				       "fieldname", name,
-				       "field", parser_check ? full_string : string,
+				       "fieldname", is_rtl ? string : name,
+				       "field", is_rtl ? name : string,
 				       "max_field_name_length", left_width,
 				       "editable", FALSE /* e_minicard->editable */,
 				       NULL );
 
-
 #ifdef notyet
 		g_object_set(E_MINICARD_LABEL(new_item)->field,
 			     "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field),
@@ -895,7 +896,7 @@
 		count++;
 		g_free (name);
 		g_free (string);
-		g_free (full_string);
+		g_free (parsed_name);
 		g_free (email);
 	}
 	g_list_foreach (emails, (GFunc) g_free, NULL);



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