mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-12 15:47:35 +00:00
new-call-box: clear entry on longpress
This commit is contained in:
parent
9f295a729b
commit
d7cd299d9c
2 changed files with 17 additions and 0 deletions
|
@ -40,6 +40,7 @@ struct _CallsNewCallBox
|
|||
GtkButton *backspace;
|
||||
HdyKeypad *keypad;
|
||||
GtkButton *dial;
|
||||
GtkGestureLongPress *long_press_back_gesture;
|
||||
|
||||
GList *dial_queue;
|
||||
};
|
||||
|
@ -76,6 +77,13 @@ get_origin (CallsNewCallBox *self)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
long_press_back_cb (CallsNewCallBox *self)
|
||||
{
|
||||
GtkEntry *entry = hdy_keypad_get_entry (self->keypad);
|
||||
gtk_editable_delete_text (GTK_EDITABLE (entry), 0, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
backspace_clicked_cb (CallsNewCallBox *self)
|
||||
{
|
||||
|
@ -291,6 +299,9 @@ dispose (GObject *object)
|
|||
remove_origins (self);
|
||||
}
|
||||
|
||||
if (self->long_press_back_gesture != NULL)
|
||||
g_object_unref (self->long_press_back_gesture);
|
||||
|
||||
G_OBJECT_CLASS (calls_new_call_box_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
@ -307,10 +318,12 @@ 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_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, backspace);
|
||||
gtk_widget_class_bind_template_child (widget_class, CallsNewCallBox, long_press_back_gesture);
|
||||
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_callback (widget_class, dial_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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,4 +146,8 @@
|
|||
</object>
|
||||
</child>
|
||||
</template>
|
||||
<object class="GtkGestureLongPress" id="long_press_back_gesture">
|
||||
<property name="widget">backspace</property>
|
||||
<signal name="pressed" handler="long_press_back_cb" object="CallsNewCallBox" swapped="true"/>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
Loading…
Reference in a new issue