summaryrefslogtreecommitdiff
path: root/gtk/gtkscalebutton.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/gtkscalebutton.c
parent1e6eb1f8b94ad10f30678285860dc24877bbbac3 (diff)
downloadgtk+-74dbb057ed8fcacc609f9379e47fd804d47dfe04.tar.gz
eventcontrollerscroll: Port to new API model
Diffstat (limited to 'gtk/gtkscalebutton.c')
-rw-r--r--gtk/gtkscalebutton.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 91f8dacf22..0ddfd9dc06 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -124,8 +124,6 @@ struct _GtkScaleButtonPrivate
gchar **icon_list;
GtkAdjustment *adjustment; /* needed because it must be settable in init() */
-
- GtkEventController *scroll_controller;
};
static void gtk_scale_button_constructed (GObject *object);
@@ -367,6 +365,7 @@ gtk_scale_button_init (GtkScaleButton *button)
{
GtkScaleButtonPrivate *priv;
GtkStyleContext *context;
+ GtkEventController *controller;
button->priv = priv = gtk_scale_button_get_instance_private (button);
@@ -385,12 +384,11 @@ gtk_scale_button_init (GtkScaleButton *button)
context = gtk_widget_get_style_context (GTK_WIDGET (button));
gtk_style_context_add_class (context, "scale");
- priv->scroll_controller =
- gtk_event_controller_scroll_new (GTK_WIDGET (button),
- 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_scale_button_scroll_controller_scroll),
button);
+ gtk_widget_add_controller (GTK_WIDGET (button), controller);
g_signal_connect (gtk_button_get_gesture (GTK_BUTTON (priv->plus_button)),
"pressed", G_CALLBACK (button_pressed_cb), button);
@@ -485,8 +483,6 @@ gtk_scale_button_finalize (GObject *object)
priv->adjustment = NULL;
}
- g_object_unref (priv->scroll_controller);
-
if (priv->autoscroll_timeout)
g_source_remove (priv->autoscroll_timeout);