[gnome-calendar/gnome-3-24] week-grid: fix event creation on RTL languages



commit 4c7b79be9c8daf430f13e90c62a1e4bfb25e2152
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Mar 28 23:57:17 2017 -0300

    week-grid: fix event creation on RTL languages
    
    On RTL languages, the calcs to detect the start and end
    of the new event were wrong, leading to the weird behavior
    it currently has.
    
    Fix that by correctly calculating the start and end cells
    on RTL languages.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777429

 src/views/gcal-week-grid.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/views/gcal-week-grid.c b/src/views/gcal-week-grid.c
index 3b7284e..126a33b 100644
--- a/src/views/gcal-week-grid.c
+++ b/src/views/gcal-week-grid.c
@@ -913,8 +913,15 @@ gcal_week_grid_button_release (GtkWidget      *widget,
     }
   else
     {
-      start = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + minute);
-      end = g_date_time_add_minutes (week_start, MAX_MINUTES - column * MINUTES_PER_DAY + (end_cell + 1) * 
30);
+      guint rtl_start_cell, rtl_end_cell, rtl_column;
+
+      /* Fix the minute */
+      rtl_column = 6 - column;
+      rtl_start_cell = start_cell + (rtl_column - column) * 48;
+      rtl_end_cell = (rtl_column * MINUTES_PER_DAY + minute) / 30;
+
+      start = g_date_time_add_minutes (week_start, rtl_start_cell * 30);
+      end = g_date_time_add_minutes (week_start, (rtl_end_cell + 1) * 30);
     }
 
   x = round ((column + 0.5) * (alloc.width / 7.0));


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