From 83bcb4aa22e7a7c77a08b211f99f982b73400dc5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 8 Mar 2018 23:40:45 +0100 Subject: zoomgesture: Port to new API model --- demos/gtk-demo/gestures.c | 4 ++-- gtk/gtkgesturezoom.c | 6 +----- gtk/gtkgesturezoom.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/demos/gtk-demo/gestures.c b/demos/gtk-demo/gestures.c index 72248a9cc9..3e520ff51a 100644 --- a/demos/gtk-demo/gestures.c +++ b/demos/gtk-demo/gestures.c @@ -196,12 +196,12 @@ do_gestures (GtkWidget *do_widget) gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture)); /* Zoom */ - zoom = gesture = gtk_gesture_zoom_new (drawing_area); + zoom = gesture = gtk_gesture_zoom_new (); g_signal_connect (gesture, "scale-changed", G_CALLBACK (zoom_scale_changed), drawing_area); gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE); - g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture); + gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture)); } if (!gtk_widget_get_visible (window)) diff --git a/gtk/gtkgesturezoom.c b/gtk/gtkgesturezoom.c index 74e9025717..208daf74b2 100644 --- a/gtk/gtkgesturezoom.c +++ b/gtk/gtkgesturezoom.c @@ -218,7 +218,6 @@ gtk_gesture_zoom_class_init (GtkGestureZoomClass *klass) /** * gtk_gesture_zoom_new: - * @widget: a #GtkWidget * * Returns a newly created #GtkGesture that recognizes zoom * in/out gestures (usually known as pinch/zoom). @@ -226,12 +225,9 @@ gtk_gesture_zoom_class_init (GtkGestureZoomClass *klass) * Returns: a newly created #GtkGestureZoom **/ GtkGesture * -gtk_gesture_zoom_new (GtkWidget *widget) +gtk_gesture_zoom_new (void) { - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - return g_object_new (GTK_TYPE_GESTURE_ZOOM, - "widget", widget, NULL); } diff --git a/gtk/gtkgesturezoom.h b/gtk/gtkgesturezoom.h index 35a67d75b4..0a02852c58 100644 --- a/gtk/gtkgesturezoom.h +++ b/gtk/gtkgesturezoom.h @@ -43,7 +43,7 @@ GDK_AVAILABLE_IN_ALL GType gtk_gesture_zoom_get_type (void) G_GNUC_CONST; GDK_AVAILABLE_IN_ALL -GtkGesture * gtk_gesture_zoom_new (GtkWidget *widget); +GtkGesture * gtk_gesture_zoom_new (void); GDK_AVAILABLE_IN_ALL gdouble gtk_gesture_zoom_get_scale_delta (GtkGestureZoom *gesture); -- cgit v1.2.1