From 06ac8f112aa29b0b17ddc79aef94d2785ec65860 Mon Sep 17 00:00:00 2001 From: Gareth Daniel Smith Date: Tue, 24 Mar 2020 18:15:19 +0000 Subject: [PATCH] Add default methods for attrDestroy and attrSubscribe --- examples/CustomAttribute.hs | 3 --- .../src/GI/Gtk/Declarative/Attributes/Custom.hs | 4 ++++ .../src/GI/Gtk/Declarative/Attributes/Custom/Window.hs | 6 ------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/examples/CustomAttribute.hs b/examples/CustomAttribute.hs index 1f60985..14dac48 100644 --- a/examples/CustomAttribute.hs +++ b/examples/CustomAttribute.hs @@ -66,9 +66,6 @@ instance CustomAttribute Gtk.Box NumberInput where Gtk.spinButtonSetAdjustment spin adj Gtk.spinButtonSetDigits spin (digits newProps) return state - - attrDestroy _box _state _decl = - pure () attrSubscribe _box (NumberInputState spin) (NumberInput _props onInputChanged) cb = do case onInputChanged of diff --git a/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom.hs b/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom.hs index 92ddae7..21affa5 100644 --- a/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom.hs +++ b/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom.hs @@ -100,9 +100,13 @@ class (Typeable decl, Typeable (AttrState decl), Functor decl) => CustomAttribut -- | Called when the associated widget is removed from the widget tree. attrDestroy :: widget -> AttrState decl -> decl event -> IO () + attrDestroy _widget _state _decl = + pure () -- | Attach event handlers to this attribute. attrSubscribe :: widget -> AttrState decl -> decl event -> (event -> IO ()) -> IO Subscription + attrSubscribe _widget _state _decl _cb = + mempty -- | Runs the create action for each custom attribute. createCustomAttributes diff --git a/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom/Window.hs b/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom/Window.hs index 0157263..d95ba85 100644 --- a/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom/Window.hs +++ b/gi-gtk-declarative/src/GI/Gtk/Declarative/Attributes/Custom/Window.hs @@ -73,9 +73,3 @@ instance (Typeable a, Eq a) => CustomAttribute Gtk.Window (PresentWindow a) wher when (a /= b) $ Gtk.windowPresent window' pure PresentWindowState - - attrDestroy _window PresentWindowState (PresentWindow _) = - mempty - - attrSubscribe _window PresentWindowState (PresentWindow _) _cb = - mempty