new-call-box: clear entry on longpress

This commit is contained in:
Evangelos Ribeiro Tzaras
2020-12-27 12:01:35 +01:00
parent 9f295a729b
commit d7cd299d9c
2 changed files with 17 additions and 0 deletions

View File

@@ -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);
}