new-call-box: clear entry on longpress

parent 9f295a72
Pipeline #63430 passed with stages
in 11 minutes and 27 seconds
......@@ -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>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment