mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 07:37:35 +00:00
new-call-box: Press enter to place a call
Connect to the "activate" signal and take appropriate action for both numeric and non-numeric cases.
This commit is contained in:
parent
a21bc475e4
commit
b1c22e4310
2 changed files with 15 additions and 1 deletions
|
@ -103,6 +103,16 @@ get_origin (CallsNewCallBox *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
address_activate_cb (CallsNewCallBox *self)
|
||||||
|
{
|
||||||
|
CallsOrigin *origin = get_selected_origin (self);
|
||||||
|
const char *address = gtk_entry_get_text (self->address_entry);
|
||||||
|
|
||||||
|
if (origin && address && *address != '\0')
|
||||||
|
calls_origin_dial (origin, address);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_numeric (CallsNewCallBox *self,
|
set_numeric (CallsNewCallBox *self,
|
||||||
gboolean enable)
|
gboolean enable)
|
||||||
|
@ -130,6 +140,7 @@ notify_selected_index_cb (CallsNewCallBox *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
long_press_back_cb (CallsNewCallBox *self)
|
long_press_back_cb (CallsNewCallBox *self)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +203,7 @@ dial_result_clicked_cb (CallsNewCallBox *self)
|
||||||
CallsOrigin *origin = get_selected_origin (self);
|
CallsOrigin *origin = get_selected_origin (self);
|
||||||
const char *address = gtk_entry_get_text (self->address_entry);
|
const char *address = gtk_entry_get_text (self->address_entry);
|
||||||
|
|
||||||
if (origin)
|
if (origin && address && *address != '\0')
|
||||||
calls_origin_dial (origin, address);
|
calls_origin_dial (origin, address);
|
||||||
else
|
else
|
||||||
g_warning ("No suitable origin found. How was this even clicked?");
|
g_warning ("No suitable origin found. How was this even clicked?");
|
||||||
|
@ -335,6 +346,7 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, keypad);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, keypad);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, dial);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, dial);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, address_entry);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, address_entry);
|
||||||
|
gtk_widget_class_bind_template_callback (widget_class, address_activate_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, dial_clicked_cb);
|
gtk_widget_class_bind_template_callback (widget_class, dial_clicked_cb);
|
||||||
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);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
<property name="visible" bind-source="CallsNewCallBox" bind-property="numeric-input-only" bind-flags="sync-create|invert-boolean"/>
|
<property name="visible" bind-source="CallsNewCallBox" bind-property="numeric-input-only" bind-flags="sync-create|invert-boolean"/>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="placeholder-text" translatable="yes">Enter a VoIP address</property>
|
<property name="placeholder-text" translatable="yes">Enter a VoIP address</property>
|
||||||
|
<signal name="activate" handler="address_activate_cb" swapped="yes"/>
|
||||||
<style>
|
<style>
|
||||||
<class name="address-entry"/>
|
<class name="address-entry"/>
|
||||||
</style>
|
</style>
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0.5</property>
|
||||||
<property name="placeholder-text" translatable="yes">Enter a number</property>
|
<property name="placeholder-text" translatable="yes">Enter a number</property>
|
||||||
|
<signal name="activate" handler="dial_clicked_cb" swapped="yes"/>
|
||||||
<style>
|
<style>
|
||||||
<class name="phone-number-entry"/>
|
<class name="phone-number-entry"/>
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue