[Fencommits] fenfire-hs: suggest loading uri if there's no info about it

Tuukka Hastrup Tuukka.Hastrup at iki.fi
Thu Mar 15 18:53:24 EET 2007


Thu Mar 15 18:53:07 EET 2007  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * suggest loading uri if there's no info about it
diff -rN -u old-fenfire-hs/Fenfire/Main.hs new-fenfire-hs/Fenfire/Main.hs
--- old-fenfire-hs/Fenfire/Main.hs	2007-03-15 18:53:24.000000000 +0200
+++ new-fenfire-hs/Fenfire/Main.hs	2007-03-15 18:53:24.000000000 +0200
@@ -128,6 +128,26 @@
                          when (saved) action
                      _              -> return ()
 
+confirmFix :: (?vs :: ViewSettings, ?pw :: Window,
+                ?views :: Views, ?uriMaker :: URIMaker) => 
+               String -> Bool -> HandlerAction FenState -> 
+               HandlerAction FenState -> HandlerAction FenState
+confirmFix _ False _ action = action
+confirmFix title True fixaction action = do
+    response <- liftIO $ do
+        dialog <- makeDialog title
+            [(stockCancel, ResponseCancel),
+             (stockNo,     ResponseReject),
+             (stockYes,    ResponseAccept)]
+            ResponseAccept
+
+        response' <- dialogRun dialog
+        widgetHide dialog
+        return response'
+    case response of ResponseReject -> action
+                     ResponseAccept -> action >> fixaction
+                     _              -> return ()
+
 confirmRevert :: (?vs :: ViewSettings, ?pw :: Window) => 
                Bool -> HandlerAction FenState -> 
                HandlerAction FenState
@@ -262,8 +282,14 @@
                                        (interpretNode uri') state
                            _     -> unhandledEvent
         "goto" -> confirmString "Go to node"
-                      (showNode (graphNamespaces graph) node) $ \s ->
-                          putRotation (Rotation (interpretNode s) 0)
+                      (showNode (graphNamespaces graph) node) $ \s -> do
+                          let node' = interpretNode s
+                              rot' = Rotation node' 0
+                              noinfo = all Map.null [getConns graph node' dir 
+                                                         | dir <- [Pos,Neg]] 
+                          confirmFix "Load info about node"
+                              noinfo (handleAction "loadIRI")
+                              $ putRotation rot'
         "undo" | (graph',path'):undos <- fsUndo state -> do
                    put state {fsGraph=graph', fsPath=path', 
                               fsUndo=undos, fsRedo=(graph,path):fsRedo state}
diff -rN -u old-fenfire-hs/Fenfire.fhs new-fenfire-hs/Fenfire.fhs
--- old-fenfire-hs/Fenfire.fhs	2007-03-15 18:53:24.000000000 +0200
+++ new-fenfire-hs/Fenfire.fhs	2007-03-15 18:53:24.000000000 +0200
@@ -148,7 +148,7 @@
 tryRotate :: (?vs :: ViewSettings, ?graph :: Graph) =>
           Rotation -> Int -> Maybe Rotation
 tryRotate rot dir = listToMaybe $ catMaybes 
-    [rotate rot dir' | dir' <- reverse $ map (signum dir*) [1..abs dir]]
+    [rotate rot dir' | dir' <- reverse $ map (signum dir *) [1..abs dir]]
 
 tryMove :: (?vs :: ViewSettings, ?graph :: Graph) =>
            Rotation -> Dir -> Maybe Rotation




More information about the Fencommits mailing list