1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-12-04 20:07:36 +00:00

calls-call-record-row: migrate button-press-event to GtkGestureClick

https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkwidget-event-signals

Part-of: <https://gitlab.gnome.org/GNOME/calls/-/merge_requests/714>
This commit is contained in:
Anton Lazarev 2023-12-16 11:06:16 -08:00
parent 669568869c
commit b85d7efc4f

View file

@ -400,16 +400,17 @@ on_long_pressed (GtkGestureLongPress *gesture,
}
static gboolean
calls_call_record_row_button_press_event (GtkWidget *self,
GdkEventButton *event)
static void
calls_call_record_row_button_press_event (GtkGestureClick* controller,
gint n_press,
gdouble x,
gdouble y,
GtkWidget *self)
{
if (gdk_event_triggers_context_menu ((GdkEvent *) event)) {
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (controller));
if (gdk_event_triggers_context_menu (event)) {
context_menu (self, (GdkEvent *) event);
return TRUE;
}
return GTK_WIDGET_CLASS (calls_call_record_row_parent_class)->button_press_event (self, event);
}
@ -527,7 +528,6 @@ calls_call_record_row_class_init (CallsCallRecordRowClass *klass)
object_class->dispose = dispose;
widget_class->popup_menu = calls_call_record_row_popup_menu;
widget_class->button_press_event = calls_call_record_row_button_press_event;
props[PROP_RECORD] =
g_param_spec_object ("record",
@ -653,6 +653,10 @@ calls_call_record_row_init (CallsCallRecordRow *self)
act = g_action_map_lookup_action (self->action_map, "delete-call");
g_simple_action_set_enabled (G_SIMPLE_ACTION (act), TRUE);
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (calls_call_record_row_button_press_event), self);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_long_press_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
g_signal_connect (gesture, "pressed", G_CALLBACK (on_long_pressed), self);