[gnome-calendar] Fixed "New Event" click behavior when on year-view.



commit 703754e1647defba8f09e7fea0ab380233e1a058
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Thu Dec 6 11:39:17 2012 -0500

    Fixed "New Event" click behavior when on year-view.

 src/gcal-year-view.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 9db6be0..8c9484c 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -1398,8 +1398,9 @@ static void
 gcal_year_view_create_event_on_current_unit (GcalView *view)
 {
   GcalYearViewPrivate *priv;
-  gdouble h_block, v_block;
   gdouble x, y;
+  gint width, height;
+  gdouble start_grid_y;
   icaltimetype *start_span;
   icaltimetype *end_span;
 
@@ -1407,15 +1408,16 @@ gcal_year_view_create_event_on_current_unit (GcalView *view)
   g_return_if_fail (GCAL_IS_YEAR_VIEW (view));
   priv = GCAL_YEAR_VIEW (view)->priv;
 
-  h_block = (gdouble) gtk_widget_get_allocated_width (GTK_WIDGET (view)) / 6.0;
-  x = ((priv->date->month % 6 )- 1 + 0.5) * h_block;
-
-  v_block = (gdouble) gtk_widget_get_allocated_height (GTK_WIDGET (view)) / 2.0;
-  y = ((priv->date->month / 6 ) + 0.5) * v_block;
+  width = gtk_widget_get_allocated_width (GTK_WIDGET (view));
+  height = gtk_widget_get_allocated_height (GTK_WIDGET (view));
+  start_grid_y = gcal_year_view_get_start_grid_y (GTK_WIDGET (view));
 
   priv->start_mark_cell = priv->date->month - 1;
   priv->end_mark_cell = priv->start_mark_cell;
 
+  x = (width / 6) * (( priv->start_mark_cell % 6) + 0.5);
+  y = start_grid_y + ((height - start_grid_y) / 2) * (( priv->start_mark_cell / 6) + 0.5);
+
   gtk_widget_queue_draw (GTK_WIDGET (view));
 
   start_span = gcal_dup_icaltime (priv->date);



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