summaryrefslogtreecommitdiff
path: root/gtk/gtkmenu.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-03-10 18:29:57 +0100
committerCarlos Garnacho <carlosg@gnome.org>2018-04-26 17:59:42 +0200
commit74dbb057ed8fcacc609f9379e47fd804d47dfe04 (patch)
tree05b555a7fc3d8a079bb4ff1ef73e5c9b4af049ff /gtk/gtkmenu.c
parent1e6eb1f8b94ad10f30678285860dc24877bbbac3 (diff)
downloadgtk+-74dbb057ed8fcacc609f9379e47fd804d47dfe04.tar.gz
eventcontrollerscroll: Port to new API model
Diffstat (limited to 'gtk/gtkmenu.c')
-rw-r--r--gtk/gtkmenu.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 3cb683aa36..092897f288 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1086,6 +1086,7 @@ gtk_menu_init (GtkMenu *menu)
{
GtkMenuPrivate *priv;
GtkGesture *gesture;
+ GtkEventController *controller;
priv = gtk_menu_get_instance_private (menu);
@@ -1138,11 +1139,10 @@ gtk_menu_init (GtkMenu *menu)
g_signal_connect (gesture, "released", G_CALLBACK (gtk_menu_released_cb), menu);
gtk_widget_add_controller (GTK_WIDGET (menu), GTK_EVENT_CONTROLLER (gesture));
- priv->scroll_controller =
- gtk_event_controller_scroll_new (GTK_WIDGET (menu),
- GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
- g_signal_connect (priv->scroll_controller, "scroll",
+ controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
+ g_signal_connect (controller, "scroll",
G_CALLBACK (gtk_menu_scroll_controller_scroll), menu);
+ gtk_widget_add_controller (GTK_WIDGET (menu), controller);
priv->motion_controller =
gtk_event_controller_motion_new (GTK_WIDGET (menu));
@@ -1225,7 +1225,6 @@ gtk_menu_finalize (GObject *object)
gtk_widget_unparent (priv->top_arrow_widget);
gtk_widget_unparent (priv->bottom_arrow_widget);
- g_clear_object (&priv->scroll_controller);
g_clear_object (&priv->motion_controller);
g_clear_object (&priv->key_controller);