Skip to content

Commit

Permalink
Add default methods for attrDestroy and attrSubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Dretch committed Apr 18, 2020
1 parent e4094b0 commit 06ac8f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 0 additions & 3 deletions examples/CustomAttribute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 06ac8f1

Please sign in to comment.