aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorDjihed Afifi <djihed@src.gnome.org>2008-01-24 19:12:31 +0800
committerDjihed Afifi <djihed@src.gnome.org>2008-01-24 19:12:31 +0800
commit32dc71eaec1260020454061a80ba83cc5a1e2aa4 (patch)
treeec679e356d5e2afcbb877a0452b89542f6f9dfbb /addressbook
parent8e8d332b85b56b98e1f7d8d977170403fe1a42d5 (diff)
downloadgsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar.gz
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar.bz2
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar.lz
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar.xz
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.tar.zst
gsoc2013-evolution-32dc71eaec1260020454061a80ba83cc5a1e2aa4.zip
Fix contact cards of RTL
svn path=/trunk/; revision=34879
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c9
-rw-r--r--addressbook/gui/widgets/e-minicard.c23
3 files changed, 28 insertions, 13 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index a192261e11..e6913d5f30 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-23 Djihed Afifi <djihed@gmail.com>
+
+ ** Fix for bug #391408
+
+ * gui/widgets/e-minicard-label.c:
+ (e_minicard_label_resize_children):
+ * gui/widgets/e-minicard.c: (add_field), (add_email_field):
+ Fix contact minicards for RTL languages.
+
2008-01-22 Milan Crha <mcrha@redhat.com>
** Fix for bug #503551
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index ab6e5471de..4ee982ab74 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -393,16 +393,21 @@ static void
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 );
}
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 02119d1c7e..700a4f78a8 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -773,6 +773,7 @@ add_field (EMinicard *e_minicard, EContactField field, gdouble left_width)
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 @@ add_field (EMinicard *e_minicard, EContactField field, gdouble left_width)
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 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
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 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
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 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
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 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
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 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
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);