[calls] new-call-box: Set numeric input property based on selected origin
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] new-call-box: Set numeric input property based on selected origin
- Date: Sat, 14 Aug 2021 19:22:47 +0000 (UTC)
commit 3779aa10626080c8030605f872a6ca106e9f267f
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Wed Jul 21 01:06:37 2021 +0200
new-call-box: Set numeric input property based on selected origin
src/calls-new-call-box.c | 28 ++++++++++++++++++++++++++++
src/ui/new-call-box.ui | 1 +
2 files changed, 29 insertions(+)
---
diff --git a/src/calls-new-call-box.c b/src/calls-new-call-box.c
index a2ae6596..f7fda833 100644
--- a/src/calls-new-call-box.c
+++ b/src/calls-new-call-box.c
@@ -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
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, backspace_clicked_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] =
g_param_spec_boolean ("numeric-input-only",
diff --git a/src/ui/new-call-box.ui b/src/ui/new-call-box.ui
index b8a21f5f..920a0c93 100644
--- a/src/ui/new-call-box.ui
+++ b/src/ui/new-call-box.ui
@@ -22,6 +22,7 @@
<child>
<object class="HdyComboRow" id="origin_list">
<property name="visible">True</property>
+ <signal name="notify::selected-index" handler="notify_selected_index_cb" swapped="yes"/>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]