[gitg] Fix RTL icon rendering in navigation tree view
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Fix RTL icon rendering in navigation tree view
- Date: Sat, 4 Jan 2014 20:45:21 +0000 (UTC)
commit e15b7546c51df7133dd4b8b45ec6a7b9c24cecb5
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sat Jan 4 21:44:57 2014 +0100
Fix RTL icon rendering in navigation tree view
gitg/history/gitg-history-navigation.vala | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/gitg/history/gitg-history-navigation.vala b/gitg/history/gitg-history-navigation.vala
index 436966c..fe92a1a 100644
--- a/gitg/history/gitg-history-navigation.vala
+++ b/gitg/history/gitg-history-navigation.vala
@@ -687,6 +687,8 @@ namespace GitgHistory
var stx = widget.get_style_context();
ensure_pixbuf(stx);
+ var rtl = (stx.get_state() & Gtk.StateFlags.DIR_RTL) != 0;
+
if (d_pixbuf == null)
{
base.render(ctx, widget, background_area, cell_area, state);
@@ -695,14 +697,32 @@ namespace GitgHistory
{
// render the text with an additional padding
Gdk.Rectangle area = cell_area;
- area.x += d_pixbuf.width + 3;
+
+ if (!rtl)
+ {
+ area.x += d_pixbuf.width + 3;
+ }
+ else
+ {
+ area.x -= d_pixbuf.width + 3;
+ }
base.render(ctx, widget, background_area, area, state);
// render the pixbuf
int yp = (cell_area.height - d_pixbuf.height) / 2;
+ int x;
+
+ if (!rtl)
+ {
+ x = cell_area.x;
+ }
+ else
+ {
+ x = cell_area.x + cell_area.width - d_pixbuf.width - 3;
+ }
- stx.render_icon(ctx, d_pixbuf, cell_area.x, cell_area.y + yp);
+ stx.render_icon(ctx, d_pixbuf, x, cell_area.y + yp);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]