diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/planner-eds.c | 4 | ||||
-rw-r--r-- | src/service.c | 34 | ||||
-rw-r--r-- | src/timezone-geoclue.c | 16 |
3 files changed, 32 insertions, 22 deletions
diff --git a/src/planner-eds.c b/src/planner-eds.c index 1c0ffc5..f121a32 100644 --- a/src/planner-eds.c +++ b/src/planner-eds.c @@ -113,7 +113,7 @@ on_subtask_done (gpointer gsubdata) /* poke the task */ data = g_task_get_task_data (task); - if (--data->subtask_count <= 0) + if (g_atomic_int_dec_and_test (&data->subtask_count)) on_all_subtasks_done (task); } @@ -247,7 +247,7 @@ my_get_appointments (IndicatorDatetimePlanner * planner, subdata->task = task; subdata->color = e_source_selectable_dup_color (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR)); - data->subtask_count++; + g_atomic_int_inc (&data->subtask_count); subtasks_added = TRUE; e_cal_client_generate_instances (client, begin, diff --git a/src/service.c b/src/service.c index c36e996..c46beeb 100644 --- a/src/service.c +++ b/src/service.c @@ -1637,7 +1637,7 @@ on_upcoming_appointments_ready (GObject * source, } static void -on_appointments_changed (IndicatorDatetimeService * self) +update_appointment_lists (IndicatorDatetimeService * self) { IndicatorDatetimePlanner * planner; GDateTime * calendar_date; @@ -1652,22 +1652,23 @@ on_appointments_changed (IndicatorDatetimeService * self) g_date_time_get_ymd (calendar_date, &y, &m, &d); begin = g_date_time_new_local (y, m, 1, 0, 0, 0); end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 0); - indicator_datetime_planner_get_appointments (planner, begin, end, - on_calendar_appointments_ready, - self); - g_date_time_unref (begin); - g_date_time_unref (end); + if (begin && end) + indicator_datetime_planner_get_appointments (planner, begin, end, + on_calendar_appointments_ready, + self); + g_clear_pointer (&begin, g_date_time_unref); + g_clear_pointer (&end, g_date_time_unref); /* get the upcoming appointments */ begin = g_date_time_ref (calendar_date); end = g_date_time_add_months (begin, 1); - indicator_datetime_planner_get_appointments (planner, begin, end, - on_upcoming_appointments_ready, - self); - g_date_time_unref (begin); - g_date_time_unref (end); - - g_date_time_unref (calendar_date); + if (begin && end) + indicator_datetime_planner_get_appointments (planner, begin, end, + on_upcoming_appointments_ready, + self); + g_clear_pointer (&begin, g_date_time_unref); + g_clear_pointer (&end, g_date_time_unref); + g_clear_pointer (&calendar_date, g_date_time_unref); } @@ -1907,7 +1908,7 @@ indicator_datetime_service_init (IndicatorDatetimeService * self) p->planner = indicator_datetime_planner_eds_new (); g_signal_connect_swapped (p->planner, "appointments-changed", - G_CALLBACK(on_appointments_changed), self); + G_CALLBACK(update_appointment_lists), self); /*** @@ -2041,8 +2042,5 @@ indicator_datetime_service_set_calendar_date (IndicatorDatetimeService * self, /* sync the menuitems and action states */ if (dirty) - { - update_calendar_action_state (self); - rebuild_appointments_section_soon (self); - } + update_appointment_lists (self); } diff --git a/src/timezone-geoclue.c b/src/timezone-geoclue.c index 239ac50..f7dcf5c 100644 --- a/src/timezone-geoclue.c +++ b/src/timezone-geoclue.c @@ -77,6 +77,18 @@ on_address_changed (GeoclueAddress * address G_GNUC_UNUSED, } } +/* The signal doesn't have the parameter for an error, so it ends up needing + a NULL inserted. */ +static void +on_address_changed_sig (GeoclueAddress * address G_GNUC_UNUSED, + int timestamp G_GNUC_UNUSED, + GHashTable * addy_data, + GeoclueAccuracy * accuracy G_GNUC_UNUSED, + gpointer gself) +{ + return on_address_changed(address, timestamp, addy_data, accuracy, NULL, gself); +} + static void on_address_created (GeoclueMasterClient * master G_GNUC_UNUSED, GeoclueAddress * address, @@ -95,7 +107,7 @@ on_address_created (GeoclueMasterClient * master G_GNUC_UNUSED, p->address = g_object_ref (address); geoclue_address_get_address_async (address, on_address_changed, gself); - g_signal_connect (address, "address-changed", G_CALLBACK(on_address_changed), gself); + g_signal_connect (address, "address-changed", G_CALLBACK(on_address_changed_sig), gself); } } @@ -161,7 +173,7 @@ geo_stop (IndicatorDatetimeTimezoneGeoclue * self) if (p->address != NULL) { - g_signal_handlers_disconnect_by_func (p->address, on_address_changed, self); + g_signal_handlers_disconnect_by_func (p->address, on_address_changed_sig, self); g_clear_object (&p->address); } |