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

new-call-box: Set numeric input property based on selected origin

This commit is contained in:
Evangelos Ribeiro Tzaras 2021-07-21 01:06:37 +02:00
parent db848b2c9f
commit 3779aa1062
2 changed files with 29 additions and 0 deletions

View file

@ -103,6 +103,33 @@ get_origin (CallsNewCallBox *self,
} }
static void
set_numeric (CallsNewCallBox *self,
gboolean enable)
{
if (enable == self->numeric_input_only)
return;
g_debug ("Numeric input %sabled", enable ? "en" : "dis");
self->numeric_input_only = enable;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_NUMERIC_INPUT_ONLY]);
}
static void
notify_selected_index_cb (CallsNewCallBox *self)
{
CallsOrigin *origin = get_selected_origin (self);
gboolean numeric_input = TRUE;
if (origin)
g_object_get (origin, "numeric-addresses", &numeric_input, NULL);
set_numeric (self, numeric_input);
}
static void static void
long_press_back_cb (CallsNewCallBox *self) long_press_back_cb (CallsNewCallBox *self)
{ {
@ -312,6 +339,7 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
gtk_widget_class_bind_template_callback (widget_class, dial_result_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, dial_result_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, backspace_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, backspace_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, long_press_back_cb); gtk_widget_class_bind_template_callback (widget_class, long_press_back_cb);
gtk_widget_class_bind_template_callback (widget_class, notify_selected_index_cb);
props[PROP_NUMERIC_INPUT_ONLY] = props[PROP_NUMERIC_INPUT_ONLY] =
g_param_spec_boolean ("numeric-input-only", g_param_spec_boolean ("numeric-input-only",

View file

@ -22,6 +22,7 @@
<child> <child>
<object class="HdyComboRow" id="origin_list"> <object class="HdyComboRow" id="origin_list">
<property name="visible">True</property> <property name="visible">True</property>
<signal name="notify::selected-index" handler="notify_selected_index_cb" swapped="yes"/>
</object> </object>
</child> </child>
</object> </object>