diff options
author | Benjamin Otte <otte@redhat.com> | 2018-03-08 23:24:30 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-04-26 17:59:41 +0200 |
commit | 6fb92a0ab9cb96aa8cea23fd43946aa4f9fed0d0 (patch) | |
tree | e3858af490757d7743cd8dc6f10714d17511bd18 /gtk/gtkeventcontrollerlegacy.c | |
parent | 31de97749ae2956ba4690317ae507680aec8ff56 (diff) | |
download | gtk+-6fb92a0ab9cb96aa8cea23fd43946aa4f9fed0d0.tar.gz |
legacycontroller: Port to new API model
We no longer set the widget on construction, but instead require an
explicit call to gtk_widget_add_controller().
This way, the reference handling becomes explicit and bindable.
Because gtk_widget_add_controller() is (transfer: full), we don't
even need to unref the controller after adding it.
And we don't need to keep track of it, because controllers get cleaned
up by GtkWidget.
Diffstat (limited to 'gtk/gtkeventcontrollerlegacy.c')
-rw-r--r-- | gtk/gtkeventcontrollerlegacy.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gtk/gtkeventcontrollerlegacy.c b/gtk/gtkeventcontrollerlegacy.c index 737312d874..ebe852249b 100644 --- a/gtk/gtkeventcontrollerlegacy.c +++ b/gtk/gtkeventcontrollerlegacy.c @@ -20,7 +20,7 @@ #include "config.h" #include "gtkeventcontrollerlegacyprivate.h" -G_DEFINE_TYPE (GtkEventControllerLegacy, _gtk_event_controller_legacy, +G_DEFINE_TYPE (GtkEventControllerLegacy, gtk_event_controller_legacy, GTK_TYPE_EVENT_CONTROLLER) static gboolean @@ -33,7 +33,7 @@ gtk_event_controller_legacy_handle_event (GtkEventController *controller, } static void -_gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass) +gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass) { GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass); @@ -41,16 +41,13 @@ _gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass) } static void -_gtk_event_controller_legacy_init (GtkEventControllerLegacy *controller) +gtk_event_controller_legacy_init (GtkEventControllerLegacy *controller) { } GtkEventController * -_gtk_event_controller_legacy_new (GtkWidget *widget) +gtk_event_controller_legacy_new (void) { - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - return g_object_new (GTK_TYPE_EVENT_CONTROLLER_LEGACY, - "widget", widget, NULL); } |