From 9209a7801c7f4070b8762c4aaaa3469bba38c241 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Wed, 27 Jul 2022 16:45:42 +0200 Subject: [PATCH] history-box: Allow transition from non-empty to empty history Since call records may be deleted, the transition from non-empty to empty is also possible. --- src/calls-history-box.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/calls-history-box.c b/src/calls-history-box.c index a626ca6..6f6139e 100644 --- a/src/calls-history-box.c +++ b/src/calls-history-box.c @@ -69,16 +69,11 @@ update (CallsHistoryBox *self) gchar *child_name; if (g_list_model_get_n_items (self->model) == 0) { + if (g_list_model_get_n_items (self->model) == 0) child_name = "empty"; - } else { + else child_name = "history"; - /* Transition should only ever be from empty to non-empty */ - if (self->model_changed_handler_id != 0) - calls_clear_signal (self->model, - &self->model_changed_handler_id); - } - gtk_stack_set_visible_child_name (GTK_STACK (self), child_name); } @@ -109,8 +104,6 @@ delete_call_cb (CallsCallRecord *record, } g_list_store_remove ((GListStore *) self->model, position); - - update (self); } @@ -223,6 +216,7 @@ dispose (GObject *object) g_clear_object (&self->slice_model); g_clear_object (&self->model); + g_clear_signal_handler (&self->model_changed_handler_id, self->model); G_OBJECT_CLASS (calls_history_box_parent_class)->dispose (object); }