[calls] history-box: Allow transition from non-empty to empty history



commit 9209a7801c7f4070b8762c4aaaa3469bba38c241
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Wed Jul 27 16:45:42 2022 +0200

    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 a626ca62..6f6139ed 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);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]