From 48c63c5efbe6f51f26d7f3b4d465f3d759d1c591 Mon Sep 17 00:00:00 2001
From: Sam Anklesaria <sam@Tintin.local>
Date: Tue, 16 Jun 2009 15:50:48 -0500
Subject: [PATCH] misc ui.frp fixes

---
 extra/recipes/recipes.factor        | 13 +++++++------
 extra/ui/frp/signals/signals.factor |  4 +---
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/extra/recipes/recipes.factor b/extra/recipes/recipes.factor
index f9663403f5..3fa65d336d 100644
--- a/extra/recipes/recipes.factor
+++ b/extra/recipes/recipes.factor
@@ -32,21 +32,22 @@ STORED-TUPLE: recipe { title { VARCHAR 100 } } { votes INTEGER } { txt TEXT } {
       <frp-table*> :> tbl
       "okay" <frp-border-button> BUTTON -> :> ok
       "submit" <image-button> [ store-tuple ] >>value TOOLBAR -> :> submit
-      "love" <image-button> TOOLBAR -> [ 1 ] <$
-      "hate" <image-button> -> [ -1 ] <$ 2array <merge> :> votes
+      "love" <image-button> 1 >>value TOOLBAR ->
+      "hate" <image-button> -1 >>value -> 2array <merge> :> votes
       "back" <image-button> -> [ -30 ] <$
       "more" <image-button> -> [ 30 ] <$ 2array <merge> :> viewed
       <frp-field*> SEARCH ->% 1 :> search
       submit ok [ [ drop ] ] <$ 2array <merge> [ drop ] >>value :> quot
-      viewed 0 [ + ] <fold> search ok t <basic> "all" <frp-button> GENRES -> 3array <merge>
+      viewed 0 [ + ] <fold> search ok t <basic> "all" <frp-button> GENRES ->
+      tbl selected-value>> votes [ [ + ] curry change-votes modify-tuple ] 2$>-|
+        4array <merge>
         [ drop [ f ] [ "%" dup surround <pattern> ] if-empty top-recipes ] 3fmap-| :> updates
       updates [ top-genres UI[ <frp-button> GENRES ->? ] map <merge> ] bind*
         [ text>> T{ recipe } swap >>genre get-tuples ] fmap
       tbl swap updates 2array <merge> >>model
         [ [ title>> ] [ genre>> ] bi 2array ] >>quot
-        { "Title" "Genre" } >>column-titles dup <scroller> RECIPES ,% 1 actions>> :> val
-      val votes [ [ + ] curry change-votes store-tuple ] 2$>-| ,
-      val submit [ "" dup dup <recipe> ] <$ 2array <merge>
+        { "Title" "Genre" } >>column-titles dup <scroller> RECIPES ,% 1 actions>>
+      submit [ "" dup dup <recipe> ] <$ 2array <merge>
         { [ [ title>> ] fmap <frp-field> TITLE ->% .5 ]
           [ [ genre>> ] fmap <frp-field> GENRE ->% .5 ]
           [ [ txt>> ] fmap <frp-editor> BODY ->% 1 ]
diff --git a/extra/ui/frp/signals/signals.factor b/extra/ui/frp/signals/signals.factor
index e7b6374527..e48d477465 100644
--- a/extra/ui/frp/signals/signals.factor
+++ b/extra/ui/frp/signals/signals.factor
@@ -92,10 +92,8 @@ M: | models-changed drop ;
 M: | model-changed
     nip
     dup dependencies>> [ value>> ] all?
-    [ [ dup [ value>> ] product-value >>value notify-connections ] keep models-changed ]
+    [ [ dup [ value>> ] product-value swap set-model ] keep models-changed ]
     [ drop ] if ;
-M: | update-model
-    dup value>> swap [ set-model ] set-product-value ;
 M: | model-activated dup model-changed ;
 
 TUPLE: & < | ;