[calls] new-call-box: Simplify HdyComboRow binding
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] new-call-box: Simplify HdyComboRow binding
- Date: Sat, 14 Aug 2021 19:22:46 +0000 (UTC)
commit 62711da7fcc788432ef1c5ee1b4cb66250d0c403
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Sat Jul 17 16:09:03 2021 +0200
new-call-box: Simplify HdyComboRow binding
src/calls-new-call-box.c | 38 ++++++++------------------------------
1 file changed, 8 insertions(+), 30 deletions(-)
---
diff --git a/src/calls-new-call-box.c b/src/calls-new-call-box.c
index c5fa1206..cdac2fd1 100644
--- a/src/calls-new-call-box.c
+++ b/src/calls-new-call-box.c
@@ -206,45 +206,23 @@ origin_count_changed_cb (CallsNewCallBox *self)
gtk_widget_set_sensitive (GTK_WIDGET (self->dial), n_items > 0);
if (n_items)
- hdy_combo_row_bind_name_model (self->origin_list, origins,
- get_origin_name, self, NULL);
- else
- hdy_combo_row_bind_name_model (self->origin_list,
- NULL, NULL, NULL, NULL);
-
- if (n_items)
- hdy_combo_row_set_selected_index (self->origin_list, 0);
-
- dial_queued (self);
+ dial_queued (self);
}
+
static void
-provider_changed_cb (CallsNewCallBox *self)
+calls_new_call_box_init (CallsNewCallBox *self)
{
GListModel *origins;
- g_assert (CALLS_IS_NEW_CALL_BOX (self));
+ gtk_widget_init_template (GTK_WIDGET (self));
origins = calls_manager_get_origins (calls_manager_get_default ());
- if (origins) {
- g_signal_connect_object (origins, "items-changed",
- G_CALLBACK (origin_count_changed_cb), self,
- G_CONNECT_SWAPPED);
-
- origin_count_changed_cb (self);
- }
-}
-
-static void
-calls_new_call_box_init (CallsNewCallBox *self)
-{
- gtk_widget_init_template (GTK_WIDGET (self));
+ hdy_combo_row_bind_name_model (self->origin_list, origins,
+ get_origin_name, self, NULL);
- g_signal_connect_swapped (calls_manager_get_default (),
- "notify::provider",
- G_CALLBACK (provider_changed_cb),
- self);
- provider_changed_cb (self);
+ g_signal_connect_swapped (origins, "items-changed",
+ G_CALLBACK (origin_count_changed_cb), self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]