[gnome-contacts] l18n: fix margin to work properly on RTL languages



commit ae32d60fc789977a5635a9d88f7213f4659a7104
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Mon Sep 16 10:09:07 2013 -0400

    l18n: fix margin to work properly on RTL languages

 src/contacts-accounts-list.vala          |   15 ++++++++++++---
 src/contacts-contact-editor.vala         |   20 ++++++++++++++++----
 src/contacts-contact-pane.vala           |   15 ++++++++++++---
 src/contacts-contact-sheet.vala          |   15 ++++++++++++---
 src/contacts-linked-accounts-dialog.vala |   10 ++++++++--
 5 files changed, 60 insertions(+), 15 deletions(-)
---
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index d09e678..83709d4 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -75,7 +75,10 @@ public class Contacts.AccountsList : Grid {
 
     var row_data = (row as Bin).get_child () as Grid;
     var checkmark = new Image.from_icon_name ("object-select-symbolic", IconSize.MENU);
-    checkmark.margin_right = 12;
+    if (checkmark.get_direction () == TextDirection.LTR)
+      checkmark.margin_right = 12;
+    else
+      checkmark.margin_left = 12;
     checkmark.set_valign (Align.CENTER);
     checkmark.set_halign (Align.END);
     checkmark.set_vexpand (true);
@@ -128,7 +131,10 @@ public class Contacts.AccountsList : Grid {
       var row_data = new Grid ();
       row_data.set_data ("store", persona_store);
       row_data.margin = 6;
-      row_data.margin_left = 5;
+      if (row_data.get_direction () == TextDirection.LTR)
+        row_data.margin_left = 5;
+      else
+        row_data.margin_right = 5;
       row_data.set_row_spacing (2);
       row_data.set_column_spacing (10);
 
@@ -166,7 +172,10 @@ public class Contacts.AccountsList : Grid {
 
     var local_data = new Grid ();
     local_data.margin = 6;
-    local_data.margin_left = 5;
+    if (local_data.get_direction () == TextDirection.LTR)
+      local_data.margin_left = 5;
+    else
+      local_data.margin_right = 5;
     local_data.set_column_spacing (10);
     local_data.set_data ("store", local_store);
     var provider_image = new Image.from_icon_name ("drive-harddisk-system-symbolic",
diff --git a/src/contacts-contact-editor.vala b/src/contacts-contact-editor.vala
index 83616d2..cf3b69d 100644
--- a/src/contacts-contact-editor.vala
+++ b/src/contacts-contact-editor.vala
@@ -268,7 +268,10 @@ public class Contacts.ContactEditor : Grid {
     var title_label = new Label (title);
     title_label.set_hexpand (false);
     title_label.set_halign (Align.START);
-    title_label.margin_right = 6;
+    if (title_label.get_direction () == TextDirection.LTR)
+      title_label.margin_right = 6;
+    else
+      title_label.margin_left = 6;
     attach (title_label, 0, row, 1, 1);
 
     var value_entry = new Entry ();
@@ -301,7 +304,10 @@ public class Contacts.ContactEditor : Grid {
     title_label.set_halign (Align.START);
     title_label.set_valign (Align.START);
     title_label.margin_top = 3;
-    title_label.margin_right = 6;
+    if (title_label.get_direction () == TextDirection.LTR)
+      title_label.margin_right = 6;
+    else
+      title_label.margin_left = 6;
     attach (title_label, 0, row, 1, 1);
 
     var sw = new ScrolledWindow (null, null);
@@ -338,7 +344,10 @@ public class Contacts.ContactEditor : Grid {
     var title_label = new Label (title);
     title_label.set_hexpand (false);
     title_label.set_halign (Align.START);
-    title_label.margin_right = 6;
+    if (title_label.get_direction () == TextDirection.LTR)
+      title_label.margin_right = 6;
+    else
+      title_label.margin_left = 6;
     attach (title_label, 0, row, 1, 1);
 
     var box = new Grid ();
@@ -687,7 +696,10 @@ public class Contacts.ContactEditor : Grid {
                                                      Contact.format_persona_store_name_for_contact (p)));
        store_name.set_halign (Align.START);
        store_name.xalign = 0.0f;
-       store_name.margin_left = 6;
+       if (store_name.get_direction () == TextDirection.LTR)
+         store_name.margin_left = 6;
+       else
+         store_name.margin_right = 6;
        attach (store_name, 0, i, 2, 1);
        last_store_position = ++i;
       }
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index cfe29b7..145dedb 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -174,7 +174,10 @@ public class Contacts.ContactPane : Notebook {
     var image_frame = new ContactFrame (Contact.SMALL_AVATAR_SIZE);
     image_frame.set_hexpand (false);
     image_frame.margin = 24;
-    image_frame.margin_right = 12;
+    if (image_frame.get_direction () == TextDirection.LTR)
+      image_frame.margin_right = 12;
+    else
+      image_frame.margin_left = 12;
     c.keep_widget_uptodate (image_frame,  (w) => {
        (w as ContactFrame).set_image (c.individual, c);
       });
@@ -220,7 +223,10 @@ public class Contacts.ContactPane : Notebook {
     bbox.set_halign (Align.END);
     bbox.set_hexpand (true);
     bbox.margin = 24;
-    bbox.margin_left = 12;
+    if (bbox.get_direction () == TextDirection.LTR)
+      bbox.margin_left = 12;
+    else
+      bbox.margin_right = 12;
     suggestion_grid.attach (bbox, 2, 0, 1, 2);
     suggestion_grid.show_all ();
   }
@@ -429,7 +435,10 @@ public class Contacts.ContactPane : Notebook {
 
     var tool_item = new ToolItem ();
     tool_item.add (add_detail_button);
-    tool_item.margin_right = 12;
+    if (tool_item.get_direction () == TextDirection.LTR)
+      tool_item.margin_right = 12;
+    else
+      tool_item.margin_left = 12;
     edit_toolbar.insert (tool_item, -1);
 
     tool_item = new ToolItem ();
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 25da4ed..4678a2b 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -61,7 +61,10 @@ public class Contacts.ContactSheet : Grid {
 
     /* FIXME: hardcode gap to match the button size */
     type_label.margin_top = 3;
-    value_label.margin_left = 6;
+    if (value_label.get_direction () == TextDirection.LTR)
+      value_label.margin_left = 6;
+    else
+      value_label.margin_right = 6;
     value_label.margin_top = 3;
     value_label.margin_bottom = 3;
 
@@ -90,7 +93,10 @@ public class Contacts.ContactSheet : Grid {
     name_label.set_hexpand (true);
     name_label.set_halign (Align.START);
     name_label.set_valign (Align.CENTER);
-    name_label.margin_left = 6;
+    if (name_label.get_direction () == TextDirection.LTR)
+      name_label.margin_left = 6;
+    else
+      name_label.margin_right = 6;
     name_label.set_ellipsize (Pango.EllipsizeMode.END);
     name_label.xalign = 0.0f;
 
@@ -117,7 +123,10 @@ public class Contacts.ContactSheet : Grid {
                                                      Contact.format_persona_store_name_for_contact (p)));
        store_name.set_halign (Align.START);
        store_name.xalign = 0.0f;
-       store_name.margin_left = 6;
+       if (store_name.get_direction () == TextDirection.LTR)
+         store_name.margin_left = 6;
+       else
+         store_name.margin_right = 6;
        attach (store_name, 0, i, 3, 1);
        last_store_position = ++i;
       }
diff --git a/src/contacts-linked-accounts-dialog.vala b/src/contacts-linked-accounts-dialog.vala
index 967d03e..3155af7 100644
--- a/src/contacts-linked-accounts-dialog.vala
+++ b/src/contacts-linked-accounts-dialog.vala
@@ -77,7 +77,10 @@ public class Contacts.LinkedAccountsDialog : Dialog {
       var image_frame = new ContactFrame (Contact.SMALL_AVATAR_SIZE);
       image_frame.set_hexpand (false);
       image_frame.margin = 6;
-      image_frame.margin_right = 12;
+      if (image_frame.get_direction () == TextDirection.LTR)
+       image_frame.margin_right = 12;
+      else
+       image_frame.margin_left = 12;
       contact.keep_widget_uptodate (image_frame,  (w) => {
          (w as ContactFrame).set_image (contact.individual, contact);
        });
@@ -101,7 +104,10 @@ public class Contacts.LinkedAccountsDialog : Dialog {
 
       var button = new Button.with_label (_("Remove"));
       button.margin = 6;
-      button.margin_left = 12;
+      if (button.get_direction () == TextDirection.LTR)
+       button.margin_left = 12;
+      else
+       button.margin_right = 12;
       button.set_valign (Align.CENTER);
       button.get_child ().margin = 6;
       row_grid.attach (button, 2, 0, 1, 2);


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