timeline: Respond well to subscriber removal

This commit is contained in:
Georges Basile Stavracas Neto
2020-04-01 23:10:01 -03:00
parent fa0173e174
commit aaab4af282
2 changed files with 11 additions and 7 deletions
+4 -1
View File
@@ -981,7 +981,6 @@ gcal_timeline_remove_subscriber (GcalTimeline *self,
GcalTimelineSubscriber *subscriber)
{
g_return_if_fail (GCAL_IS_TIMELINE (self));
g_return_if_fail (GCAL_IS_TIMELINE_SUBSCRIBER (subscriber));
GCAL_ENTRY;
@@ -993,6 +992,10 @@ gcal_timeline_remove_subscriber (GcalTimeline *self,
g_signal_handlers_disconnect_by_func (subscriber, on_subscriber_range_changed_cb, self);
g_hash_table_remove (self->subscribers, subscriber);
/* If all subscribers were removed, reset the complete counter */
if (g_hash_table_size (self->subscribers) == 0)
reset_completed_calendars (self);
update_range (self);
GCAL_EXIT;