aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-17 09:16:17 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-17 09:16:17 -0500
commitd368216efb7bb5befbf8a41d99098ca130c610ab (patch)
tree4624c742d096c9457c7a53583c243e906ad3d4d0 /src
parent72f23220db542cb8e41e9492528e79082c916804 (diff)
downloadayatana-indicator-datetime-d368216efb7bb5befbf8a41d99098ca130c610ab.tar.gz
ayatana-indicator-datetime-d368216efb7bb5befbf8a41d99098ca130c610ab.tar.bz2
ayatana-indicator-datetime-d368216efb7bb5befbf8a41d99098ca130c610ab.zip
in service.c, use GDateTime internally instead of time_t
Diffstat (limited to 'src')
-rw-r--r--src/service.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/service.c b/src/service.c
index 55905aa..e9b4c1a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -119,7 +119,7 @@ struct _IndicatorDatetimeServicePrivate
/* Which year/month to show in the calendar,
and which day should get the cursor.
This value is reflected in the calendar action's state */
- time_t calendar_date;
+ GDateTime * calendar_date;
GSimpleActionGroup * actions;
GSimpleAction * header_action;
@@ -525,7 +525,7 @@ get_calendar_date (IndicatorDatetimeService * self)
priv_t * p = self->priv;
if (p->calendar_date)
- date = g_date_time_new_from_unix_local ((gint64)p->calendar_date);
+ date = g_date_time_ref (p->calendar_date);
else
date = indicator_datetime_service_get_localtime (self);
@@ -1240,8 +1240,7 @@ on_activate_planner (GSimpleAction * a G_GNUC_UNUSED,
if (p->planner != NULL)
{
- const time_t t = g_variant_get_int64 (param);
-
+ const gint64 t = g_variant_get_int64 (param);
if (t)
{
GDateTime * date_time = g_date_time_new_from_unix_local (t);
@@ -1262,14 +1261,16 @@ on_calendar_action_activated (GSimpleAction * action G_GNUC_UNUSED,
{
IndicatorDatetimeService * self = INDICATOR_DATETIME_SERVICE (gself);
priv_t * p = self->priv;
- const time_t calendar_date = (time_t) g_variant_get_int64 (state);
+ gint64 t = g_variant_get_int64 (state);
- if (p->calendar_date != calendar_date)
- {
- p->calendar_date = (time_t) g_variant_get_int64 (state);
- update_calendar_action_state (self);
- rebuild_appointments_section_soon (self);
- }
+ /* update calendar_date */
+ g_clear_pointer (&p->calendar_date, g_date_time_unref);
+ if (t)
+ p->calendar_date = g_date_time_new_from_unix_local (t);
+
+ /* sync the menuitems and action states */
+ update_calendar_action_state (self);
+ rebuild_appointments_section_soon (self);
}
@@ -1667,6 +1668,7 @@ my_finalize (GObject * o)
priv_t * p = self->priv;
g_clear_pointer (&p->skew_time, g_date_time_unref);
+ g_clear_pointer (&p->calendar_date, g_date_time_unref);
G_OBJECT_CLASS (indicator_datetime_service_parent_class)->finalize (o);
}