1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-13 16:07:36 +00:00

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.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-07-27 16:45:42 +02:00
parent a6faac2940
commit 9209a7801c

View file

@ -69,16 +69,11 @@ update (CallsHistoryBox *self)
gchar *child_name; gchar *child_name;
if (g_list_model_get_n_items (self->model) == 0) { if (g_list_model_get_n_items (self->model) == 0) {
if (g_list_model_get_n_items (self->model) == 0)
child_name = "empty"; child_name = "empty";
} else { else
child_name = "history"; 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); 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); 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->slice_model);
g_clear_object (&self->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); G_OBJECT_CLASS (calls_history_box_parent_class)->dispose (object);
} }