mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 07:37:35 +00:00
new-call-box: Simplify HdyComboRow binding
This commit is contained in:
parent
c7731b189a
commit
62711da7fc
1 changed files with 9 additions and 31 deletions
|
@ -206,45 +206,23 @@ origin_count_changed_cb (CallsNewCallBox *self)
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (self->dial), n_items > 0);
|
gtk_widget_set_sensitive (GTK_WIDGET (self->dial), n_items > 0);
|
||||||
|
|
||||||
if (n_items)
|
if (n_items)
|
||||||
hdy_combo_row_bind_name_model (self->origin_list, origins,
|
dial_queued (self);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
provider_changed_cb (CallsNewCallBox *self)
|
|
||||||
{
|
|
||||||
GListModel *origins;
|
|
||||||
|
|
||||||
g_assert (CALLS_IS_NEW_CALL_BOX (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
|
static void
|
||||||
calls_new_call_box_init (CallsNewCallBox *self)
|
calls_new_call_box_init (CallsNewCallBox *self)
|
||||||
{
|
{
|
||||||
|
GListModel *origins;
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
g_signal_connect_swapped (calls_manager_get_default (),
|
origins = calls_manager_get_origins (calls_manager_get_default ());
|
||||||
"notify::provider",
|
hdy_combo_row_bind_name_model (self->origin_list, origins,
|
||||||
G_CALLBACK (provider_changed_cb),
|
get_origin_name, self, NULL);
|
||||||
self);
|
|
||||||
provider_changed_cb (self);
|
g_signal_connect_swapped (origins, "items-changed",
|
||||||
|
G_CALLBACK (origin_count_changed_cb), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue