summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-03-09 06:14:59 +0100
committerCarlos Garnacho <carlosg@gnome.org>2018-04-26 17:59:42 +0200
commit4ddc94b293504b56c0106b0177c36c8efd2d3a57 (patch)
treeb620c608c025e287685a04afa8429d5541e12274 /gtk/gtknotebook.c
parent71991270b047c66e7c14a65aaa70703527c978cf (diff)
downloadgtk+-4ddc94b293504b56c0106b0177c36c8efd2d3a57.tar.gz
multipressgesture: Port to new API model
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 80abd55d56..3ad8d16961 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -207,7 +207,6 @@ struct _GtkNotebookPrivate
guint switch_tab_timer;
GList *switch_tab;
- GtkGesture *press_gesture;
GtkEventController *motion_controller;
guint32 timer;
@@ -1042,6 +1041,7 @@ gtk_notebook_init (GtkNotebook *notebook)
{
GtkNotebookPrivate *priv;
GdkContentFormats *targets;
+ GtkGesture *gesture;
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
gtk_widget_set_has_surface (GTK_WIDGET (notebook), FALSE);
@@ -1111,11 +1111,12 @@ gtk_notebook_init (GtkNotebook *notebook)
gtk_widget_set_vexpand (priv->stack_widget, TRUE);
gtk_container_add (GTK_CONTAINER (priv->box), priv->stack_widget);
- priv->press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (notebook));
- gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->press_gesture), 0);
- gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->press_gesture), GTK_PHASE_CAPTURE);
- g_signal_connect (priv->press_gesture, "pressed", G_CALLBACK (gtk_notebook_gesture_pressed), notebook);
- g_signal_connect (priv->press_gesture, "released", G_CALLBACK (gtk_notebook_gesture_released), notebook);
+ gesture = gtk_gesture_multi_press_new ();
+ gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
+ g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_notebook_gesture_pressed), notebook);
+ g_signal_connect (gesture, "released", G_CALLBACK (gtk_notebook_gesture_released), notebook);
+ gtk_widget_add_controller (GTK_WIDGET (notebook), GTK_EVENT_CONTROLLER (gesture));
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (notebook));
g_signal_connect (priv->motion_controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
@@ -1608,7 +1609,6 @@ gtk_notebook_finalize (GObject *object)
GtkNotebook *notebook = GTK_NOTEBOOK (object);
GtkNotebookPrivate *priv = notebook->priv;
- g_clear_object (&priv->press_gesture);
g_clear_object (&priv->motion_controller);
gtk_widget_unparent (priv->box);