Hi all,<br><br>For a network manager of sorts I'm working on, I want to derive a SettingsWindowClass from the WindowClass present in Gtk2Hs:<br><br>I want (the) instance(s) of the SettingsWindowClass to have a field to store connection settings:<br>
<br>1) Is it safe to do it like this?<br><br><span style="font-family: courier new,monospace;">class WindowClass self $B"M(B SettingsWindowClass self where<br> settingsWindowGetSettings :: self $B"*(B IO [ConnectionSetting]<br> settingsWindowSetSettings :: self $B"*(B [ConnectionSetting] $B"*(B IO ()<br>
<br>newtype SettingsWindow = SettingsWindow (Window,[ConnectionSetting])<br><br>mkSettingsWindow = SettingsWindow<br>unSettingsWindow (SettingsWindow o) = o<br><br>settingsWindowNew :: IO SettingsWindow<br>settingsWindowNew = do<br>
win $B"+(B windowNew<br> return $ mkSettingsWindow (win,[])<br></span><br>2) Is this a common practice in gtk2hs usage?<br>3) And will GC properly free the memory allocated for the Window object? How is this ensured, do ForeignPtr's always call delete on the underlying C ptr when they get garbage collected?<br>
<br>Best Regards,<br>CS<br>