Ticket #306: 30001-Mirror-arrow-icons-when-running-in-RTL-mode-SL-306.txt

File 30001-Mirror-arrow-icons-when-running-in-RTL-mode-SL-306.txt, 3.6 KB (added by seeta, 13 years ago)
Line 
1From 2d2b07e0db0da481bf8e48c285903837a3f968ff Mon Sep 17 00:00:00 2001
2From: anubhav <anubhav@dev.seeta.in>
3Date: Sat, 2 Oct 2010 21:31:28 +0530
4Subject: [PATCH] Mirror arrow icons when running in RTL mode(SL#306)
5
6This patch inserts a if condition in the intiallization of the the class of the
7toolbar.Which check for the direction of the language is right to left or
8left to right thus reverting the buttons of toolbar (in the case of rtl )
9This patch handles the problem with edit toolbar and web toolbar in browse
10activity
11---
12 source/browse/edittoolbar.py |   15 +++++++++++----
13 webtoolbar.py  |   13 ++++++++++---
14 2 files changed, 21 insertions(+), 7 deletions(-)
15
16diff --git a/source/browse/edittoolbar.py b/source/browse/edittoolbar.py
17index 4658683..122475b 100644
18--- a/source/browse/edittoolbar.py
19+++ b/source/browse/edittoolbar.py
20@@ -33,9 +33,16 @@ class EditToolbar(activity.EditToolbar):
21 
22     def __init__(self, act):
23         activity.EditToolbar.__init__(self)
24-
25+       
26+        if gtk.widget_get_default_direction() == gtk.TEXT_DIR_RTL:
27+           self.nextbutton = 'go-previous-paired'
28+           self.previousbutton = 'go-next-paired'
29+                     
30+        else :
31+           self.nextbutton = 'go-previous-paired'
32+           self.previousbutton = 'go-next-paired'
33         self._activity = act
34-
35+   
36         self.undo.connect('clicked', self.__undo_cb)
37         self.redo.connect('clicked', self.__redo_cb)
38         self.copy.connect('clicked', self.__copy_cb)
39@@ -88,14 +95,14 @@ class EditToolbar(activity.EditToolbar):
40         self.insert(search_item, -1)
41         search_item.show()
42 
43-        self._prev = ToolButton('go-previous-paired')
44+        self._prev = ToolButton(self.previousbutton)
45         self._prev.set_tooltip(_('Previous'))
46         self._prev.props.sensitive = False
47         self._prev.connect('clicked', self.__find_previous_cb)
48         self.insert(self._prev, -1)
49         self._prev.show()
50 
51-        self._next = ToolButton('go-next-paired')
52+        self._next = ToolButton(self.nextbutton)
53         self._next.set_tooltip(_('Next'))
54         self._next.props.sensitive = False
55         self._next.connect('clicked', self.__find_next_cb)
56diff --git a/source/browse/webtoolbar.py b/source/browse/webtoolbar.py
57index 69a3c8e..7263eb9 100644
58--- a/source/browse/webtoolbar.py
59+++ b/source/browse/webtoolbar.py
60@@ -234,7 +234,14 @@ class PrimaryToolbar(ToolbarBox):
61         self._activity = act
62 
63         self._tabbed_view = tabbed_view
64-
65+        if gtk.widget_get_default_direction() == gtk.TEXT_DIR_RTL:
66+           self.nextbutton = 'go-previous-paired'
67+           self.previousbutton = 'go-next-paired'
68+                     
69+        else :
70+           self.nextbutton = 'go-next-paired'
71+           self.previousbutton = 'go-previous-paired'
72+           
73         self._loading = False
74 
75         activity_button = ActivityToolbarButton(self._activity)
76@@ -256,14 +263,14 @@ class PrimaryToolbar(ToolbarBox):
77         self.toolbar.insert(entry_item, -1)
78         entry_item.show()
79 
80-        self._back = ToolButton('go-previous-paired')
81+        self._back = ToolButton(self.previousbutton)
82         self._back.set_tooltip(_('Back'))
83         self._back.props.sensitive = False
84         self._back.connect('clicked', self._go_back_cb)
85         self.toolbar.insert(self._back, -1)
86         self._back.show()
87 
88-        self._forward = ToolButton('go-next-paired')
89+        self._forward = ToolButton(self.nextbutton)
90         self._forward.set_tooltip(_('Forward'))
91         self._forward.props.sensitive = False
92         self._forward.connect('clicked', self._go_forward_cb)
93--
941.7.0.4
95