aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/widgets')
-rw-r--r--main/src/ui/widgets/date_separator.vala10
1 files changed, 8 insertions, 2 deletions
diff --git a/main/src/ui/widgets/date_separator.vala b/main/src/ui/widgets/date_separator.vala
index 95729bce..b5d84a5b 100644
--- a/main/src/ui/widgets/date_separator.vala
+++ b/main/src/ui/widgets/date_separator.vala
@@ -40,8 +40,14 @@ public class Dino.Ui.ViewModel.CompatDateSeparatorModel : DateSeparatorModel {
private void update_time_label() {
date_label = get_relative_time(date);
- time_update_timeout = Timeout.add_seconds((int) get_next_time_change(), () => {
- if (time_update_timeout != 0) update_time_label();
+ time_update_timeout = set_update_time_label_timeout((int) get_next_time_change(), this);
+ }
+
+ private static uint set_update_time_label_timeout(int interval, CompatDateSeparatorModel model_) {
+ WeakRef model_weak = WeakRef(model_);
+ return Timeout.add_seconds(interval, () => {
+ CompatDateSeparatorModel? model = (CompatDateSeparatorModel) model_weak.get();
+ if (model != null && model.time_update_timeout != 0) model.update_time_label();
return false;
});
}