[gnome-calendar] window: update subscriptions after active-date notification



commit ef774ad2c2096019648a263e49b36b7f12cbc88a
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Sun Feb 15 09:20:21 2015 -0500

    window: update subscriptions after active-date
     notification
    
    Some views need to update itself when the dates changes,
    e.g. WeekView. This allows to update the state of the view and be ready
    properly for the components update.

 src/gcal-window.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 5c41074..75ed5d7 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -276,13 +276,18 @@ update_active_date (GcalWindow   *window,
 
   time_t range_start, range_end;
   icaltimetype date;
+  icaltimetype *previous_date;
   icaltimezone* default_zone;
 
   priv = gcal_window_get_instance_private (window);
   default_zone = gcal_manager_get_system_timezone (priv->manager);
 
+  previous_date = priv->active_date;
+  priv->active_date = new_date;
+  g_object_notify (G_OBJECT (window), "active-date");
+
   /* year_view */
-  if (priv->active_date->year != new_date->year)
+  if (previous_date->year != new_date->year)
     {
       date = *new_date;
       date.day = 1;
@@ -303,7 +308,7 @@ update_active_date (GcalWindow   *window,
     }
 
   /* month_view */
-  if (priv->active_date->month != new_date->month || priv->active_date->year != new_date->year)
+  if (previous_date->month != new_date->month || previous_date->year != new_date->year)
     {
       date = *new_date;
       date.day = 1;
@@ -321,8 +326,7 @@ update_active_date (GcalWindow   *window,
       gcal_manager_set_subscriber (priv->manager, E_CAL_DATA_MODEL_SUBSCRIBER (priv->month_view), 
range_start, range_end);
     }
 
-    g_free (priv->active_date);
-    priv->active_date = new_date;
+  g_free (previous_date);
 }
 
 static gboolean
@@ -391,7 +395,6 @@ date_updated (GtkButton  *button,
     }
 
   update_active_date (user_data, new_date);
-  g_object_notify (user_data, "active-date");
 }
 
 static void


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