mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 12:25:31 +00:00
Merge branch 'dial-pad-number-property' into 'master'
calls-new-call-box: Allow entering of "+" symbol Closes #12 See merge request Librem5/calls!64
This commit is contained in:
commit
950c207aff
2 changed files with 94 additions and 23 deletions
|
@ -36,7 +36,9 @@ struct _CallsNewCallBox
|
||||||
|
|
||||||
GtkListStore *origin_store;
|
GtkListStore *origin_store;
|
||||||
GtkComboBox *origin_box;
|
GtkComboBox *origin_box;
|
||||||
GtkSearchEntry *number_entry;
|
GtkEntry *number_entry;
|
||||||
|
GtkButton *backspace;
|
||||||
|
HdyDialer *dial_pad;
|
||||||
GtkButton *dial;
|
GtkButton *dial;
|
||||||
GtkLabel *status;
|
GtkLabel *status;
|
||||||
|
|
||||||
|
@ -84,22 +86,40 @@ get_origin (CallsNewCallBox *self)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dial_pad_symbol_clicked_cb (CallsNewCallBox *self,
|
backspace_clicked_cb (CallsNewCallBox *self)
|
||||||
gchar symbol,
|
|
||||||
HdyDialer *dialer)
|
|
||||||
{
|
{
|
||||||
calls_entry_append (GTK_ENTRY (self->number_entry), symbol);
|
const gchar *old;
|
||||||
|
size_t len;
|
||||||
|
gchar *new;
|
||||||
|
|
||||||
|
old = hdy_dialer_get_number (self->dial_pad);
|
||||||
|
g_assert (old != NULL);
|
||||||
|
|
||||||
|
len = strlen (old);
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
new = g_strndup (old, strlen (old) - 1);
|
||||||
|
hdy_dialer_set_number (self->dial_pad, new);
|
||||||
|
g_free (new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dial_pad_deleted_cb (CallsNewCallBox *self,
|
dial_pad_notify_number_cb (CallsNewCallBox *self,
|
||||||
HdyDialer *dialer)
|
GParamSpec *pspec,
|
||||||
|
GObject *gobject)
|
||||||
{
|
{
|
||||||
GtkEntryBuffer *buf = gtk_entry_get_buffer (GTK_ENTRY (self->number_entry));
|
const gchar *number;
|
||||||
guint len = gtk_entry_buffer_get_length (buf);
|
|
||||||
|
|
||||||
gtk_entry_buffer_delete_text (buf, len - 1, 1);
|
g_assert (strcmp(g_param_spec_get_name (pspec), "number") == 0);
|
||||||
|
|
||||||
|
number = hdy_dialer_get_number (self->dial_pad);
|
||||||
|
gtk_entry_set_text (self->number_entry, number);
|
||||||
|
gtk_widget_set_visible (GTK_WIDGET (self->backspace),
|
||||||
|
strlen (number) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,10 +328,27 @@ calls_new_call_box_init (CallsNewCallBox *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
constructed (GObject *object)
|
||||||
|
{
|
||||||
|
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||||
|
CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
|
||||||
|
PangoAttrList *attrs;
|
||||||
|
|
||||||
|
// Increase the size of the number entry text
|
||||||
|
attrs = pango_attr_list_new ();
|
||||||
|
pango_attr_list_insert (attrs, pango_attr_scale_new (1.2));
|
||||||
|
gtk_entry_set_attributes (self->number_entry, attrs);
|
||||||
|
pango_attr_list_unref (attrs);
|
||||||
|
|
||||||
|
parent_class->constructed (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dispose (GObject *object)
|
dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GObjectClass *parent_class = g_type_class_peek (GTK_TYPE_BOX);
|
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
|
||||||
CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
|
CallsNewCallBox *self = CALLS_NEW_CALL_BOX (object);
|
||||||
|
|
||||||
clear_dial_queue (self);
|
clear_dial_queue (self);
|
||||||
|
@ -332,6 +369,7 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
|
||||||
object_class->set_property = set_property;
|
object_class->set_property = set_property;
|
||||||
|
object_class->constructed = constructed;
|
||||||
object_class->dispose = dispose;
|
object_class->dispose = dispose;
|
||||||
|
|
||||||
|
|
||||||
|
@ -349,11 +387,13 @@ calls_new_call_box_class_init (CallsNewCallBoxClass *klass)
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_store);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_store);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_box);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, origin_box);
|
||||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, number_entry);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, number_entry);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, backspace);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, dial_pad);
|
||||||
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, status);
|
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, status);
|
||||||
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_pad_deleted_cb);
|
gtk_widget_class_bind_template_callback (widget_class, dial_pad_notify_number_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, dial_pad_symbol_clicked_cb);
|
gtk_widget_class_bind_template_callback (widget_class, backspace_clicked_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,47 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="number_entry">
|
<object class="GtkBox">
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="primary_icon_activatable">False</property>
|
|
||||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
|
||||||
<property name="primary_icon_sensitive">False</property>
|
|
||||||
<property name="input-purpose">phone</property>
|
|
||||||
<property name="input-hints">no-emoji|inhibit-osk</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="im-module">simple</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">horizontal</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="number_entry">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="input-purpose">phone</property>
|
||||||
|
<property name="input-hints">no-emoji|inhibit-osk</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="backspace">
|
||||||
|
<property name="always_show_image">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="relief">none</property>
|
||||||
|
<property name="visible">False</property>
|
||||||
|
<signal name="clicked" handler="backspace_clicked_cb" swapped="yes"/>
|
||||||
|
<style>
|
||||||
|
<class name="image-button"/>
|
||||||
|
</style>
|
||||||
|
<child internal-child="accessible">
|
||||||
|
<object class="AtkObject" id="a11y-backspace">
|
||||||
|
<property name="accessible-name" translatable="yes">Backspace through number</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">edit-clear-symbolic</property>
|
||||||
|
<property name="icon-size">2</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -69,8 +101,7 @@
|
||||||
<property name="show_action_buttons">False</property>
|
<property name="show_action_buttons">False</property>
|
||||||
<property name="width_request">300</property>
|
<property name="width_request">300</property>
|
||||||
<property name="hexpand">False</property>
|
<property name="hexpand">False</property>
|
||||||
<signal name="deleted" handler="dial_pad_deleted_cb" swapped="yes"/>
|
<signal name="notify::number" handler="dial_pad_notify_number_cb" swapped="yes"/>
|
||||||
<signal name="symbol-clicked" handler="dial_pad_symbol_clicked_cb" swapped="yes"/>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
Loading…
Reference in a new issue