1 | From 2d2b07e0db0da481bf8e48c285903837a3f968ff Mon Sep 17 00:00:00 2001 |
---|
2 | From: anubhav <anubhav@dev.seeta.in> |
---|
3 | Date: Sat, 2 Oct 2010 21:31:28 +0530 |
---|
4 | Subject: [PATCH] Mirror arrow icons when running in RTL mode(SL#306) |
---|
5 | |
---|
6 | This patch inserts a if condition in the intiallization of the the class of the |
---|
7 | toolbar.Which check for the direction of the language is right to left or |
---|
8 | left to right thus reverting the buttons of toolbar (in the case of rtl ) |
---|
9 | This patch handles the problem with edit toolbar and web toolbar in browse |
---|
10 | activity |
---|
11 | --- |
---|
12 | source/browse/edittoolbar.py | 15 +++++++++++---- |
---|
13 | webtoolbar.py | 13 ++++++++++--- |
---|
14 | 2 files changed, 21 insertions(+), 7 deletions(-) |
---|
15 | |
---|
16 | diff --git a/source/browse/edittoolbar.py b/source/browse/edittoolbar.py |
---|
17 | index 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) |
---|
56 | diff --git a/source/browse/webtoolbar.py b/source/browse/webtoolbar.py |
---|
57 | index 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 | -- |
---|
94 | 1.7.0.4 |
---|
95 | |
---|