[epiphany] e-web-view: fix error pages for RTL locales



commit bd9610ccf02ee4122f10f770b36b7c3cbd183a76
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Sat Jul 30 01:26:12 2011 -0500

    e-web-view: fix error pages for RTL locales
    
    Remove hardcoded directions in the CSS definitions and make them simpler.
    
    Bug #314205
    
    Signed-off-by: Diego Escalante Urrelo <descalante igalia com>

 data/pages/error.html    |   72 +++++++++++++++++++++++++++------------------
 data/pages/recovery.html |   72 +++++++++++++++++++++++++++------------------
 embed/ephy-web-view.c    |    5 ++-
 3 files changed, 89 insertions(+), 60 deletions(-)
---
diff --git a/data/pages/error.html b/data/pages/error.html
index 0c6db3b..9aa39f6 100644
--- a/data/pages/error.html
+++ b/data/pages/error.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <!--
-  Copyright  2010 Vinicius Depizzol
+  Copyright  2010, 2011 Vinicius Depizzol
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -9,48 +9,56 @@
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 -->
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="%s" lang="%s">
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="%s" lang="%s" dir="%s">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>%s</title>
   <style type="text/css">
     body {
       margin: 0 auto;
-      padding: 7em;
       font: message-box;
-      display: table;
-      direction: %s;
     }
-    div#centeredContent {
-      display: table;
+
+    #container {
+      padding: 10% 12% 5%;
       margin: 0 auto;
+      max-width: 650px;
     }
-    div#centeredContent h1 {
-      display: table-row;
+
+    #main_icon {
+      float: left;
+      padding-right: 20px;
     }
-    div#centeredContent div {
-      display: table-row-group;
+
+    html[dir="rtl"] #main_icon {
+      padding-left: 20px;
+      padding-right: 0;
+      float: right;
     }
-    h1 {
-      font-size: 180%;
+
+    #content {
+      display: table-cell;
+      vertical-align: top;
     }
-    img {
-      vertical-align: middle;
-      float: left;
-      margin-right: 20px;
-      width: 50px;
-      height: 50px;
+
+    #content h1 {
+      margin-top: 0;
     }
-    p.buttonbox {
+
+    #content .buttonbox {
       text-align: right;
     }
+
+    html[dir="rtl"] #content .buttonbox {
+      text-align: left;
+    }
   </style>
   <script type="text/javascript">
     function load_anyway()
@@ -60,14 +68,20 @@
   </script>
 </head>
 <body>
-<img src="%s"/>
-<div id="centeredContent">
-  <div>
-    <h1 style="text-align:left;">%s</h1>
-    <p class="message">%s</p>
-    <p class="buttonbox">
-      <button onclick="javascript:load_anyway()">%s</button></p>
+  <div id="container">
+      <div id="main_icon">
+        <img src="%s" />
+      </div>
+      <div id="content">
+          <h1>%s</h1>
+          <div class="explanation">
+            %s
+          </div>
+
+          <div class="buttonbox">
+            <button onclick="javascript:load_anyway()">%s</button>
+          </div>
+      </div>
   </div>
-</div>
 </body>
 </html>
diff --git a/data/pages/recovery.html b/data/pages/recovery.html
index 0c6db3b..9aa39f6 100644
--- a/data/pages/recovery.html
+++ b/data/pages/recovery.html
@@ -1,6 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <!--
-  Copyright  2010 Vinicius Depizzol
+  Copyright  2010, 2011 Vinicius Depizzol
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -9,48 +9,56 @@
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 -->
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="%s" lang="%s">
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="%s" lang="%s" dir="%s">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>%s</title>
   <style type="text/css">
     body {
       margin: 0 auto;
-      padding: 7em;
       font: message-box;
-      display: table;
-      direction: %s;
     }
-    div#centeredContent {
-      display: table;
+
+    #container {
+      padding: 10% 12% 5%;
       margin: 0 auto;
+      max-width: 650px;
     }
-    div#centeredContent h1 {
-      display: table-row;
+
+    #main_icon {
+      float: left;
+      padding-right: 20px;
     }
-    div#centeredContent div {
-      display: table-row-group;
+
+    html[dir="rtl"] #main_icon {
+      padding-left: 20px;
+      padding-right: 0;
+      float: right;
     }
-    h1 {
-      font-size: 180%;
+
+    #content {
+      display: table-cell;
+      vertical-align: top;
     }
-    img {
-      vertical-align: middle;
-      float: left;
-      margin-right: 20px;
-      width: 50px;
-      height: 50px;
+
+    #content h1 {
+      margin-top: 0;
     }
-    p.buttonbox {
+
+    #content .buttonbox {
       text-align: right;
     }
+
+    html[dir="rtl"] #content .buttonbox {
+      text-align: left;
+    }
   </style>
   <script type="text/javascript">
     function load_anyway()
@@ -60,14 +68,20 @@
   </script>
 </head>
 <body>
-<img src="%s"/>
-<div id="centeredContent">
-  <div>
-    <h1 style="text-align:left;">%s</h1>
-    <p class="message">%s</p>
-    <p class="buttonbox">
-      <button onclick="javascript:load_anyway()">%s</button></p>
+  <div id="container">
+      <div id="main_icon">
+        <img src="%s" />
+      </div>
+      <div id="content">
+          <h1>%s</h1>
+          <div class="explanation">
+            %s
+          </div>
+
+          <div class="buttonbox">
+            <button onclick="javascript:load_anyway()">%s</button>
+          </div>
+      </div>
   </div>
-</div>
 </body>
 </html>
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7dbf2f5..798946c 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2033,9 +2033,10 @@ ephy_web_view_load_error_page (EphyWebView *view,
   ephy_web_view_set_title (view, page_title);
   _ephy_web_view_set_icon_address (view, NULL);
 
-  g_string_printf (html, template, lang, lang,
+  g_string_printf (html, template,
+                   lang, lang,
+                   ((gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) ? "rtl" : "ltr"),
                    page_title,
-                   gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL ? "rtl" : "ltr",
                    uri,
                    image_data,
                    msg_title, msg, button_label);



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