aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorBehnam Esfahbod <behnam@zwnj.org>2006-08-23 17:23:38 +0800
committerAndre Klapper <aklapper@src.gnome.org>2006-08-23 17:23:38 +0800
commit0e0dc0b15d17fe2d0c210a3829dc2eccffc4a5c9 (patch)
treeff4dda432aeaaf60a9efdd37c907667383a66e62 /widgets
parent6c0397b958bb747b8381a116f082671b0f4d9d02 (diff)
downloadgsoc2013-evolution-0e0dc0b15d17fe2d0c210a3829dc2eccffc4a5c9.tar.gz
gsoc2013-evolution-0e0dc0b15d17fe2d0c210a3829dc2eccffc4a5c9.tar.zst
gsoc2013-evolution-0e0dc0b15d17fe2d0c210a3829dc2eccffc4a5c9.zip
flip month view in RTL locale - fixes bug 342443. committed by Andre
2006-08-23 Behnam Esfahbod <behnam@zwnj.org> * e-calendar.c: * e-calendar-item.c: flip month view in RTL locale - fixes bug 342443. committed by Andre Klapper svn path=/trunk/; revision=32641
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog7
-rw-r--r--widgets/misc/e-calendar-item.c17
-rw-r--r--widgets/misc/e-calendar.c13
3 files changed, 29 insertions, 8 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 51f5f1245c..3aeb9d28b4 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-23 Behnam Esfahbod <behnam@zwnj.org>
+
+ * e-calendar.c:
+ * e-calendar-item.c:
+ flip month view in RTL locale - fixes bug 342443.
+ committed by Andre Klapper
+
2006-08-23 Matthew Barnes <mbarnes@redhat.com>
* e-multi-config-dialog.c:
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 17b830d608..77b041c5f9 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -1691,7 +1691,8 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
/* Calculate the top-left position of the entire month display. */
month_x = item->x1 + xthickness + calitem->x_offset
- + col * calitem->month_width - x;
+ + ( (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ ? (calitem->cols-1 - col) : col ) * calitem->month_width - x;
month_w = item->x2 - item->x1 - xthickness * 2;
month_w = MIN (month_w, calitem->month_width);
month_y = item->y1 + ythickness + row * calitem->month_height - y;
@@ -1807,6 +1808,8 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
day_index = calitem->week_start_day;
pango_layout_set_font_description (layout, font_desc);
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ text_x += (7-1) * calitem->cell_width;
gdk_gc_set_foreground (fg_gc, &style->text[GTK_STATE_ACTIVE]);
for (day = 0; day < 7; day++) {
layout_set_day_text (calitem, layout, day_index);
@@ -1814,7 +1817,8 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
text_x - calitem->day_widths [day_index],
text_y,
layout);
- text_x += calitem->cell_width;
+ text_x += (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ ? -calitem->cell_width : calitem->cell_width;
day_index++;
if (day_index == 7)
day_index = 0;
@@ -1999,7 +2003,10 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
for (dcol = 0; dcol < 7; dcol++) {
if (draw_day) {
- day_x = cells_x + dcol * calitem->cell_width;
+ day_x = cells_x +
+ ( (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ ? 7-1 - dcol : dcol ) * calitem->cell_width;
+
day_y = cells_y + drow * calitem->cell_height;
today = years[mon] == today_year
@@ -2866,6 +2873,8 @@ e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
if (row >= calitem->rows || col >= calitem->cols)
return FALSE;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ col = calitem->cols-1 - col;
*month_offset = row * calitem->cols + col;
@@ -2910,6 +2919,8 @@ e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
if (x < 0)
return FALSE;
day_col = x / calitem->cell_width;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ day_col = E_CALENDAR_COLS_PER_MONTH-1 - day_col;
if (day_col >= E_CALENDAR_COLS_PER_MONTH)
return FALSE;
}
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index fc1c21c74d..035dac8a36 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -355,8 +355,10 @@ e_calendar_size_allocate (GtkWidget *widget,
- E_CALENDAR_ARROW_BUTTON_Y_PAD * 2;
gnome_canvas_item_set (cal->prev_item,
- "x", xthickness * 2
- + E_CALENDAR_ARROW_BUTTON_X_PAD,
+ "x", (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ ? new_x2 + 1 - xthickness * 2 - E_CALENDAR_ARROW_BUTTON_X_PAD
+ - arrow_button_size
+ : xthickness * 2 + E_CALENDAR_ARROW_BUTTON_X_PAD,
"y", ythickness * 2
+ E_CALENDAR_ARROW_BUTTON_Y_PAD,
"width", arrow_button_size,
@@ -364,9 +366,10 @@ e_calendar_size_allocate (GtkWidget *widget,
NULL);
gnome_canvas_item_set (cal->next_item,
- "x", new_x2 + 1 - xthickness * 2
- - E_CALENDAR_ARROW_BUTTON_X_PAD
- - arrow_button_size,
+ "x", (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ ? xthickness * 2 + E_CALENDAR_ARROW_BUTTON_X_PAD
+ : new_x2 + 1 - xthickness * 2 - E_CALENDAR_ARROW_BUTTON_X_PAD
+ - arrow_button_size,
"y", ythickness * 2
+ E_CALENDAR_ARROW_BUTTON_Y_PAD,
"width", arrow_button_size,