summaryrefslogtreecommitdiff
path: root/src/Gtk/Shares.icl
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gtk/Shares.icl')
-rw-r--r--src/Gtk/Shares.icl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Gtk/Shares.icl b/src/Gtk/Shares.icl
index 4ff107f..d02b1b0 100644
--- a/src/Gtk/Shares.icl
+++ b/src/Gtk/Shares.icl
@@ -45,3 +45,11 @@ singletonShared name setup =
setup >>= \val ->
setShared shr (Just val) >>|
pure val
+
+withShared :: a !((Shared a) -> GtkM b) -> GtkM b | shared a
+withShared default f =
+ updateShared inc temp_share_id >>= \id ->
+ let shared_value = share ("withShared"+++toString id) default in
+ f shared_value
+where
+ temp_share_id = share "withShared_temp_share_id" 0