hsfm/src/HSFM-GUI-Gtk-MyView.html
travis-ci 2f9426b1dd Lastest docs updated
travis build: 21
commit: 244a58d8c2
auto-pushed to gh-pages
2016-06-01 22:20:10 +00:00

435 lines
67 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/HSFM/GUI/Gtk/MyView.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{--
<a name="line-2"></a>HSFM, a filemanager written in Haskell.
<a name="line-3"></a>Copyright (C) 2016 Julian Ospald
<a name="line-4"></a>
<a name="line-5"></a>This program is free software; you can redistribute it and/or
<a name="line-6"></a>modify it under the terms of the GNU General Public License
<a name="line-7"></a>version 2 as published by the Free Software Foundation.
<a name="line-8"></a>
<a name="line-9"></a>This program is distributed in the hope that it will be useful,
<a name="line-10"></a>but WITHOUT ANY WARRANTY; without even the implied warranty of
<a name="line-11"></a>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<a name="line-12"></a>GNU General Public License for more details.
<a name="line-13"></a>
<a name="line-14"></a>You should have received a copy of the GNU General Public License
<a name="line-15"></a>along with this program; if not, write to the Free Software
<a name="line-16"></a>Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<a name="line-17"></a>--}</span>
<a name="line-18"></a>
<a name="line-19"></a>
<a name="line-20"></a>
<a name="line-21"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>MyView</span> <span class='hs-keyword'>where</span>
<a name="line-22"></a>
<a name="line-23"></a>
<a name="line-24"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>MVar</span>
<a name="line-25"></a> <span class='hs-layout'>(</span>
<a name="line-26"></a> <span class='hs-varid'>newEmptyMVar</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>putMVar</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>tryTakeMVar</span>
<a name="line-29"></a> <span class='hs-layout'>)</span>
<a name="line-30"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Concurrent</span><span class='hs-varop'>.</span><span class='hs-conid'>STM</span>
<a name="line-31"></a> <span class='hs-layout'>(</span>
<a name="line-32"></a> <span class='hs-varid'>newTVarIO</span>
<a name="line-33"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>readTVarIO</span>
<a name="line-34"></a> <span class='hs-layout'>)</span>
<a name="line-35"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span>
<a name="line-36"></a> <span class='hs-layout'>(</span>
<a name="line-37"></a> <span class='hs-varid'>forM_</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>unless</span>
<a name="line-39"></a> <span class='hs-layout'>)</span>
<a name="line-40"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Foldable</span>
<a name="line-41"></a> <span class='hs-layout'>(</span>
<a name="line-42"></a> <span class='hs-varid'>for_</span>
<a name="line-43"></a> <span class='hs-layout'>)</span>
<a name="line-44"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Maybe</span>
<a name="line-45"></a> <span class='hs-layout'>(</span>
<a name="line-46"></a> <span class='hs-varid'>catMaybes</span>
<a name="line-47"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>fromJust</span>
<a name="line-48"></a> <span class='hs-layout'>)</span>
<a name="line-49"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>String</span>
<a name="line-50"></a> <span class='hs-layout'>(</span>
<a name="line-51"></a> <span class='hs-varid'>fromString</span>
<a name="line-52"></a> <span class='hs-layout'>)</span>
<a name="line-53"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Graphics</span><span class='hs-varop'>.</span><span class='hs-conid'>UI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span>
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-comment'>{-# SOURCE #-}</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Callbacks</span> <span class='hs-layout'>(</span><span class='hs-varid'>setViewCallbacks</span><span class='hs-layout'>)</span>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>HPath</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>P</span>
<a name="line-56"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>FileSystem</span><span class='hs-varop'>.</span><span class='hs-conid'>FileType</span>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Glib</span><span class='hs-varop'>.</span><span class='hs-conid'>GlibString</span><span class='hs-conid'>()</span>
<a name="line-58"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Data</span>
<a name="line-59"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Icons</span>
<a name="line-60"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>GUI</span><span class='hs-varop'>.</span><span class='hs-conid'>Gtk</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span>
<a name="line-61"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>HSFM</span><span class='hs-varop'>.</span><span class='hs-conid'>Utils</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span>
<a name="line-62"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Paths_hsfm</span>
<a name="line-63"></a> <span class='hs-layout'>(</span>
<a name="line-64"></a> <span class='hs-varid'>getDataFileName</span>
<a name="line-65"></a> <span class='hs-layout'>)</span>
<a name="line-66"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span><span class='hs-layout'>(</span><span class='hs-varid'>readFile</span><span class='hs-layout'>)</span>
<a name="line-67"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>INotify</span>
<a name="line-68"></a> <span class='hs-layout'>(</span>
<a name="line-69"></a> <span class='hs-varid'>addWatch</span>
<a name="line-70"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>initINotify</span>
<a name="line-71"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>killINotify</span>
<a name="line-72"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>EventVariety</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-73"></a> <span class='hs-layout'>)</span>
<a name="line-74"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>IO</span><span class='hs-varop'>.</span><span class='hs-conid'>Error</span>
<a name="line-75"></a> <span class='hs-layout'>(</span>
<a name="line-76"></a> <span class='hs-varid'>catchIOError</span>
<a name="line-77"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ioError</span>
<a name="line-78"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isUserError</span>
<a name="line-79"></a> <span class='hs-layout'>)</span>
<a name="line-80"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>System</span><span class='hs-varop'>.</span><span class='hs-conid'>Posix</span><span class='hs-varop'>.</span><span class='hs-conid'>FilePath</span>
<a name="line-81"></a> <span class='hs-layout'>(</span>
<a name="line-82"></a> <span class='hs-varid'>hiddenFile</span>
<a name="line-83"></a> <span class='hs-layout'>)</span>
<a name="line-84"></a>
<a name="line-85"></a>
<a name="line-86"></a>
<a name="line-87"></a><a name="newTab"></a><span class='hs-comment'>-- |Creates a new tab with its own view and refreshes the view.</span>
<a name="line-88"></a><span class='hs-definition'>newTab</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>FMView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Item</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>MyView</span>
<a name="line-89"></a><span class='hs-definition'>newTab</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>iofmv</span> <span class='hs-varid'>item</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-90"></a> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>createMyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>iofmv</span>
<a name="line-91"></a> <span class='hs-varid'>i</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>notebookAppendPage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>viewBox</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
<a name="line-92"></a> <span class='hs-layout'>(</span><span class='hs-varid'>maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromRel</span> <span class='hs-varop'>$</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span>
<a name="line-93"></a> <span class='hs-varid'>mpage</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>notebookGetNthPage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-varid'>i</span>
<a name="line-94"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>mpage</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>page</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>notebookSetTabReorderable</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
<a name="line-95"></a> <span class='hs-varid'>page</span>
<a name="line-96"></a> <span class='hs-conid'>True</span>
<a name="line-97"></a> <span class='hs-varid'>catchIOError</span> <span class='hs-layout'>(</span><span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>item</span><span class='hs-layout'>)</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>e</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-98"></a> <span class='hs-varid'>forM_</span> <span class='hs-varid'>mpage</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>page</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-99"></a> <span class='hs-varid'>file</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readFile</span> <span class='hs-varid'>getFileInfo</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromJust</span> <span class='hs-varop'>.</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>parseAbs</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromString</span> <span class='hs-varop'>$</span> <span class='hs-str'>"/"</span>
<a name="line-100"></a> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>file</span>
<a name="line-101"></a> <span class='hs-varid'>notebookSetTabLabelText</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-varid'>page</span> <span class='hs-str'>"/"</span>
<a name="line-102"></a> <span class='hs-varid'>unless</span> <span class='hs-layout'>(</span><span class='hs-varid'>isUserError</span> <span class='hs-varid'>e</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>ioError</span> <span class='hs-varid'>e</span><span class='hs-layout'>)</span>
<a name="line-103"></a>
<a name="line-104"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>myview</span>
<a name="line-105"></a>
<a name="line-106"></a>
<a name="line-107"></a><a name="createMyView"></a><span class='hs-comment'>-- |Constructs the initial MyView object with a few dummy models.</span>
<a name="line-108"></a><span class='hs-comment'>-- It also initializes the callbacks.</span>
<a name="line-109"></a><span class='hs-definition'>createMyView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span>
<a name="line-110"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>FMView</span>
<a name="line-111"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>MyView</span>
<a name="line-112"></a><span class='hs-definition'>createMyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>iofmv</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-113"></a> <span class='hs-varid'>inotify</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newEmptyMVar</span>
<a name="line-114"></a> <span class='hs-varid'>history</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newTVarIO</span> <span class='hs-layout'>(</span><span class='hs-conid'>[]</span><span class='hs-layout'>,</span><span class='hs-conid'>[]</span><span class='hs-layout'>)</span>
<a name="line-115"></a>
<a name="line-116"></a> <span class='hs-varid'>builder</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderNew</span>
<a name="line-117"></a> <span class='hs-varid'>builderAddFromFile</span> <span class='hs-varid'>builder</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>getDataFileName</span> <span class='hs-str'>"data/Gtk/builder.xml"</span>
<a name="line-118"></a>
<a name="line-119"></a> <span class='hs-comment'>-- create dummy models, so we don't have to use MVar</span>
<a name="line-120"></a> <span class='hs-varid'>rawModel</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newTVarIO</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>listStoreNew</span> <span class='hs-conid'>[]</span>
<a name="line-121"></a> <span class='hs-varid'>filteredModel</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newTVarIO</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>treeModelFilterNew</span> <span class='hs-varid'>x</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span>
<a name="line-122"></a> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varid'>rawModel</span>
<a name="line-123"></a> <span class='hs-varid'>sortedModel</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newTVarIO</span> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>treeModelSortNewWithModel</span>
<a name="line-124"></a> <span class='hs-varop'>=&lt;&lt;</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varid'>filteredModel</span>
<a name="line-125"></a> <span class='hs-varid'>cwd</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newEmptyMVar</span>
<a name="line-126"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>iofmv</span>
<a name="line-127"></a> <span class='hs-varid'>view</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>newTVarIO</span> <span class='hs-varid'>view'</span>
<a name="line-128"></a>
<a name="line-129"></a> <span class='hs-varid'>urlBar</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToEntry</span>
<a name="line-130"></a> <span class='hs-str'>"urlBar"</span>
<a name="line-131"></a> <span class='hs-varid'>rcMenu</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToMenu</span>
<a name="line-132"></a> <span class='hs-str'>"rcMenu"</span>
<a name="line-133"></a> <span class='hs-varid'>rcFileOpen</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-134"></a> <span class='hs-str'>"rcFileOpen"</span>
<a name="line-135"></a> <span class='hs-varid'>rcFileExecute</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-136"></a> <span class='hs-str'>"rcFileExecute"</span>
<a name="line-137"></a> <span class='hs-varid'>rcFileNewRegFile</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-138"></a> <span class='hs-str'>"rcFileNewRegFile"</span>
<a name="line-139"></a> <span class='hs-varid'>rcFileNewDir</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-140"></a> <span class='hs-str'>"rcFileNewDir"</span>
<a name="line-141"></a> <span class='hs-varid'>rcFileCut</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-142"></a> <span class='hs-str'>"rcFileCut"</span>
<a name="line-143"></a> <span class='hs-varid'>rcFileCopy</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-144"></a> <span class='hs-str'>"rcFileCopy"</span>
<a name="line-145"></a> <span class='hs-varid'>rcFileRename</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-146"></a> <span class='hs-str'>"rcFileRename"</span>
<a name="line-147"></a> <span class='hs-varid'>rcFilePaste</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-148"></a> <span class='hs-str'>"rcFilePaste"</span>
<a name="line-149"></a> <span class='hs-varid'>rcFileDelete</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-150"></a> <span class='hs-str'>"rcFileDelete"</span>
<a name="line-151"></a> <span class='hs-varid'>rcFileProperty</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-152"></a> <span class='hs-str'>"rcFileProperty"</span>
<a name="line-153"></a> <span class='hs-varid'>rcFileIconView</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-154"></a> <span class='hs-str'>"rcFileIconView"</span>
<a name="line-155"></a> <span class='hs-varid'>rcFileTreeView</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToImageMenuItem</span>
<a name="line-156"></a> <span class='hs-str'>"rcFileTreeView"</span>
<a name="line-157"></a> <span class='hs-varid'>upViewB</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToButton</span>
<a name="line-158"></a> <span class='hs-str'>"upViewB"</span>
<a name="line-159"></a> <span class='hs-varid'>homeViewB</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToButton</span>
<a name="line-160"></a> <span class='hs-str'>"homeViewB"</span>
<a name="line-161"></a> <span class='hs-varid'>refreshViewB</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToButton</span>
<a name="line-162"></a> <span class='hs-str'>"refreshViewB"</span>
<a name="line-163"></a> <span class='hs-varid'>scroll</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToScrolledWindow</span>
<a name="line-164"></a> <span class='hs-str'>"mainScroll"</span>
<a name="line-165"></a> <span class='hs-varid'>viewBox</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>builderGetObject</span> <span class='hs-varid'>builder</span> <span class='hs-varid'>castToBox</span>
<a name="line-166"></a> <span class='hs-str'>"viewBox"</span>
<a name="line-167"></a>
<a name="line-168"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>rcmenu</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MkRightClickMenu</span> <span class='hs-layout'>{</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>}</span>
<a name="line-169"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>MkMyView</span> <span class='hs-layout'>{</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>}</span>
<a name="line-170"></a>
<a name="line-171"></a> <span class='hs-comment'>-- set the bindings</span>
<a name="line-172"></a> <span class='hs-varid'>setViewCallbacks</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
<a name="line-173"></a>
<a name="line-174"></a> <span class='hs-comment'>-- add the treeview to the scroll container</span>
<a name="line-175"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>oview</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fmViewToContainer</span> <span class='hs-varid'>view'</span>
<a name="line-176"></a> <span class='hs-varid'>containerAdd</span> <span class='hs-varid'>scroll</span> <span class='hs-varid'>oview</span>
<a name="line-177"></a>
<a name="line-178"></a> <span class='hs-varid'>widgetShowAll</span> <span class='hs-varid'>viewBox</span>
<a name="line-179"></a>
<a name="line-180"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>myview</span>
<a name="line-181"></a>
<a name="line-182"></a>
<a name="line-183"></a><a name="switchView"></a><span class='hs-comment'>-- |Switch the existing view in `MyView` with the one that the</span>
<a name="line-184"></a><span class='hs-comment'>-- io action returns.</span>
<a name="line-185"></a><span class='hs-definition'>switchView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>FMView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-186"></a><span class='hs-definition'>switchView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>iofmv</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-187"></a> <span class='hs-varid'>cwd</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
<a name="line-188"></a>
<a name="line-189"></a> <span class='hs-varid'>oldpage</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>destroyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
<a name="line-190"></a>
<a name="line-191"></a> <span class='hs-comment'>-- create new view and tab page where the previous one was</span>
<a name="line-192"></a> <span class='hs-varid'>nview</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>createMyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>iofmv</span>
<a name="line-193"></a> <span class='hs-varid'>newpage</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>notebookInsertPage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>viewBox</span> <span class='hs-varid'>nview</span><span class='hs-layout'>)</span>
<a name="line-194"></a> <span class='hs-layout'>(</span><span class='hs-varid'>maybe</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varop'>$</span> <span class='hs-varid'>path</span> <span class='hs-varid'>cwd</span><span class='hs-layout'>)</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromRel</span>
<a name="line-195"></a> <span class='hs-varop'>$</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span> <span class='hs-varop'>$</span> <span class='hs-varid'>cwd</span><span class='hs-layout'>)</span> <span class='hs-varid'>oldpage</span>
<a name="line-196"></a> <span class='hs-varid'>notebookSetCurrentPage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-varid'>newpage</span>
<a name="line-197"></a>
<a name="line-198"></a> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>nview</span> <span class='hs-varid'>cwd</span>
<a name="line-199"></a>
<a name="line-200"></a>
<a name="line-201"></a><a name="destroyView"></a><span class='hs-comment'>-- |Destroys the current view by disconnecting the watcher</span>
<a name="line-202"></a><span class='hs-comment'>-- and destroying the active FMView container.</span>
<a name="line-203"></a><span class='hs-comment'>--</span>
<a name="line-204"></a><span class='hs-comment'>-- Everything that needs to be done in order to forget about a</span>
<a name="line-205"></a><span class='hs-comment'>-- view needs to be done here.</span>
<a name="line-206"></a><span class='hs-comment'>--</span>
<a name="line-207"></a><span class='hs-comment'>-- Returns the page in the tab list this view corresponds to.</span>
<a name="line-208"></a><span class='hs-definition'>destroyView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>MyView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>Int</span>
<a name="line-209"></a><span class='hs-definition'>destroyView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-210"></a> <span class='hs-comment'>-- disconnect watcher</span>
<a name="line-211"></a> <span class='hs-varid'>mi</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>tryTakeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>inotify</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
<a name="line-212"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>mi</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>killINotify</span> <span class='hs-varid'>i</span>
<a name="line-213"></a>
<a name="line-214"></a> <span class='hs-varid'>page</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>notebookGetCurrentPage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
<a name="line-215"></a>
<a name="line-216"></a> <span class='hs-comment'>-- destroy old view and tab page</span>
<a name="line-217"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>view</span> <span class='hs-varid'>myview</span>
<a name="line-218"></a> <span class='hs-varid'>widgetDestroy</span> <span class='hs-layout'>(</span><span class='hs-varid'>fmViewToContainer</span> <span class='hs-varid'>view'</span><span class='hs-layout'>)</span>
<a name="line-219"></a> <span class='hs-varid'>notebookRemovePage</span> <span class='hs-layout'>(</span><span class='hs-varid'>notebook</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span> <span class='hs-varid'>page</span>
<a name="line-220"></a>
<a name="line-221"></a> <span class='hs-varid'>return</span> <span class='hs-varid'>page</span>
<a name="line-222"></a>
<a name="line-223"></a>
<a name="line-224"></a><a name="createIconView"></a><span class='hs-comment'>-- |Createss an IconView.</span>
<a name="line-225"></a><span class='hs-definition'>createIconView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>FMView</span>
<a name="line-226"></a><span class='hs-definition'>createIconView</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-227"></a> <span class='hs-varid'>iconv</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>iconViewNew</span>
<a name="line-228"></a> <span class='hs-varid'>iconViewSetSelectionMode</span> <span class='hs-varid'>iconv</span> <span class='hs-conid'>SelectionMultiple</span>
<a name="line-229"></a> <span class='hs-varid'>iconViewSetColumns</span> <span class='hs-varid'>iconv</span> <span class='hs-layout'>(</span><span class='hs-comment'>-</span><span class='hs-num'>1</span><span class='hs-layout'>)</span>
<a name="line-230"></a> <span class='hs-varid'>iconViewSetSpacing</span> <span class='hs-varid'>iconv</span> <span class='hs-num'>2</span>
<a name="line-231"></a> <span class='hs-varid'>iconViewSetMargin</span> <span class='hs-varid'>iconv</span> <span class='hs-num'>0</span>
<a name="line-232"></a> <span class='hs-comment'>{- set iconv [ iconViewItemOrientation := OrientationHorizontal ] -}</span>
<a name="line-233"></a> <span class='hs-comment'>{- set iconv [ iconViewOrientation := OrientationHorizontal ] -}</span>
<a name="line-234"></a>
<a name="line-235"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FMIconView</span> <span class='hs-varid'>iconv</span>
<a name="line-236"></a>
<a name="line-237"></a>
<a name="line-238"></a><a name="createTreeView"></a><span class='hs-comment'>-- |Creates a TreeView.</span>
<a name="line-239"></a><span class='hs-definition'>createTreeView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>FMView</span>
<a name="line-240"></a><span class='hs-definition'>createTreeView</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-241"></a> <span class='hs-comment'>-- create the final view</span>
<a name="line-242"></a> <span class='hs-varid'>treeView</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewNew</span>
<a name="line-243"></a> <span class='hs-comment'>-- set selection mode</span>
<a name="line-244"></a> <span class='hs-varid'>tvs</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewGetSelection</span> <span class='hs-varid'>treeView</span>
<a name="line-245"></a> <span class='hs-varid'>treeSelectionSetMode</span> <span class='hs-varid'>tvs</span> <span class='hs-conid'>SelectionMultiple</span>
<a name="line-246"></a>
<a name="line-247"></a> <span class='hs-comment'>-- set drag and drop</span>
<a name="line-248"></a> <span class='hs-varid'>tl</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>targetListNew</span>
<a name="line-249"></a> <span class='hs-varid'>atom</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>atomNew</span> <span class='hs-layout'>(</span><span class='hs-str'>"HSFM"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
<a name="line-250"></a> <span class='hs-varid'>targetListAdd</span> <span class='hs-varid'>tl</span> <span class='hs-varid'>atom</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>TargetSameApp</span><span class='hs-keyglyph'>]</span> <span class='hs-num'>0</span>
<a name="line-251"></a> <span class='hs-varid'>treeViewEnableModelDragDest</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>tl</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ActionCopy</span><span class='hs-keyglyph'>]</span>
<a name="line-252"></a> <span class='hs-varid'>treeViewEnableModelDragSource</span> <span class='hs-varid'>treeView</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Button1</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>tl</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>ActionCopy</span><span class='hs-keyglyph'>]</span>
<a name="line-253"></a>
<a name="line-254"></a> <span class='hs-comment'>-- create final tree model columns</span>
<a name="line-255"></a> <span class='hs-varid'>renderTxt</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>cellRendererTextNew</span>
<a name="line-256"></a> <span class='hs-varid'>renderPix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>cellRendererPixbufNew</span>
<a name="line-257"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>ct</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>cellText</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>CellRendererTextClass</span> <span class='hs-varid'>cr</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Attr</span> <span class='hs-varid'>cr</span> <span class='hs-conid'>String</span>
<a name="line-258"></a> <span class='hs-varid'>cp</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>cellPixbuf</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>CellRendererPixbufClass</span> <span class='hs-varid'>self</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=&gt;</span> <span class='hs-conid'>Attr</span> <span class='hs-varid'>self</span> <span class='hs-conid'>Pixbuf</span>
<a name="line-259"></a>
<a name="line-260"></a> <span class='hs-comment'>-- filename column</span>
<a name="line-261"></a> <span class='hs-varid'>cF</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewColumnNew</span>
<a name="line-262"></a> <span class='hs-varid'>treeViewColumnSetTitle</span> <span class='hs-varid'>cF</span> <span class='hs-layout'>(</span><span class='hs-str'>"Filename"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
<a name="line-263"></a> <span class='hs-varid'>treeViewColumnSetResizable</span> <span class='hs-varid'>cF</span> <span class='hs-conid'>True</span>
<a name="line-264"></a> <span class='hs-varid'>treeViewColumnSetClickable</span> <span class='hs-varid'>cF</span> <span class='hs-conid'>True</span>
<a name="line-265"></a> <span class='hs-varid'>treeViewColumnSetSortColumnId</span> <span class='hs-varid'>cF</span> <span class='hs-num'>1</span>
<a name="line-266"></a> <span class='hs-varid'>cellLayoutPackStart</span> <span class='hs-varid'>cF</span> <span class='hs-varid'>renderPix</span> <span class='hs-conid'>False</span>
<a name="line-267"></a> <span class='hs-varid'>cellLayoutPackStart</span> <span class='hs-varid'>cF</span> <span class='hs-varid'>renderTxt</span> <span class='hs-conid'>True</span>
<a name="line-268"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewAppendColumn</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>cF</span>
<a name="line-269"></a> <span class='hs-varid'>cellLayoutAddColumnAttribute</span> <span class='hs-varid'>cF</span> <span class='hs-varid'>renderPix</span> <span class='hs-varid'>cp</span> <span class='hs-varop'>$</span> <span class='hs-varid'>makeColumnIdPixbuf</span> <span class='hs-num'>0</span>
<a name="line-270"></a> <span class='hs-varid'>cellLayoutAddColumnAttribute</span> <span class='hs-varid'>cF</span> <span class='hs-varid'>renderTxt</span> <span class='hs-varid'>ct</span> <span class='hs-varop'>$</span> <span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>1</span>
<a name="line-271"></a>
<a name="line-272"></a> <span class='hs-comment'>-- date column</span>
<a name="line-273"></a> <span class='hs-varid'>cMD</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewColumnNew</span>
<a name="line-274"></a> <span class='hs-varid'>treeViewColumnSetTitle</span> <span class='hs-varid'>cMD</span> <span class='hs-layout'>(</span><span class='hs-str'>"Date"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
<a name="line-275"></a> <span class='hs-varid'>treeViewColumnSetResizable</span> <span class='hs-varid'>cMD</span> <span class='hs-conid'>True</span>
<a name="line-276"></a> <span class='hs-varid'>treeViewColumnSetClickable</span> <span class='hs-varid'>cMD</span> <span class='hs-conid'>True</span>
<a name="line-277"></a> <span class='hs-varid'>treeViewColumnSetSortColumnId</span> <span class='hs-varid'>cMD</span> <span class='hs-num'>2</span>
<a name="line-278"></a> <span class='hs-varid'>cellLayoutPackStart</span> <span class='hs-varid'>cMD</span> <span class='hs-varid'>renderTxt</span> <span class='hs-conid'>True</span>
<a name="line-279"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewAppendColumn</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>cMD</span>
<a name="line-280"></a> <span class='hs-varid'>cellLayoutAddColumnAttribute</span> <span class='hs-varid'>cMD</span> <span class='hs-varid'>renderTxt</span> <span class='hs-varid'>ct</span> <span class='hs-varop'>$</span> <span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>2</span>
<a name="line-281"></a>
<a name="line-282"></a> <span class='hs-comment'>-- permissions column</span>
<a name="line-283"></a> <span class='hs-varid'>cP</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewColumnNew</span>
<a name="line-284"></a> <span class='hs-varid'>treeViewColumnSetTitle</span> <span class='hs-varid'>cP</span> <span class='hs-layout'>(</span><span class='hs-str'>"Permission"</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
<a name="line-285"></a> <span class='hs-varid'>treeViewColumnSetResizable</span> <span class='hs-varid'>cP</span> <span class='hs-conid'>True</span>
<a name="line-286"></a> <span class='hs-varid'>treeViewColumnSetClickable</span> <span class='hs-varid'>cP</span> <span class='hs-conid'>True</span>
<a name="line-287"></a> <span class='hs-varid'>treeViewColumnSetSortColumnId</span> <span class='hs-varid'>cP</span> <span class='hs-num'>3</span>
<a name="line-288"></a> <span class='hs-varid'>cellLayoutPackStart</span> <span class='hs-varid'>cP</span> <span class='hs-varid'>renderTxt</span> <span class='hs-conid'>True</span>
<a name="line-289"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewAppendColumn</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>cP</span>
<a name="line-290"></a> <span class='hs-varid'>cellLayoutAddColumnAttribute</span> <span class='hs-varid'>cP</span> <span class='hs-varid'>renderTxt</span> <span class='hs-varid'>ct</span> <span class='hs-varop'>$</span> <span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>3</span>
<a name="line-291"></a>
<a name="line-292"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-conid'>FMTreeView</span> <span class='hs-varid'>treeView</span>
<a name="line-293"></a>
<a name="line-294"></a>
<a name="line-295"></a><a name="refreshView"></a><span class='hs-comment'>-- |Refreshes the View based on the given directory.</span>
<a name="line-296"></a><span class='hs-comment'>--</span>
<a name="line-297"></a><span class='hs-comment'>-- Throws:</span>
<a name="line-298"></a><span class='hs-comment'>--</span>
<a name="line-299"></a><span class='hs-comment'>-- - `userError` on inappropriate type</span>
<a name="line-300"></a><span class='hs-definition'>refreshView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span>
<a name="line-301"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>MyView</span>
<a name="line-302"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Item</span>
<a name="line-303"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-304"></a><span class='hs-definition'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-conid'>SymLink</span> <span class='hs-layout'>{</span> <span class='hs-varid'>sdest</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>d</span><span class='hs-keyglyph'>@</span><span class='hs-conid'>Dir</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span>
<a name="line-305"></a> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>d</span>
<a name="line-306"></a><span class='hs-definition'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>item</span><span class='hs-keyglyph'>@</span><span class='hs-conid'>Dir</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-307"></a> <span class='hs-varid'>newRawModel</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>fileListStore</span> <span class='hs-varid'>item</span> <span class='hs-varid'>myview</span>
<a name="line-308"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>rawModel</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>newRawModel</span>
<a name="line-309"></a>
<a name="line-310"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>view</span> <span class='hs-varid'>myview</span>
<a name="line-311"></a>
<a name="line-312"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>tryTakeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>cwd</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
<a name="line-313"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>cwd</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>item</span>
<a name="line-314"></a>
<a name="line-315"></a> <span class='hs-comment'>-- get selected items</span>
<a name="line-316"></a> <span class='hs-varid'>tps</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getSelectedTreePaths</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
<a name="line-317"></a> <span class='hs-varid'>trs</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>catMaybes</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>mapM</span> <span class='hs-layout'>(</span><span class='hs-varid'>treeRowReferenceNew</span> <span class='hs-varid'>newRawModel</span><span class='hs-layout'>)</span> <span class='hs-varid'>tps</span>
<a name="line-318"></a>
<a name="line-319"></a> <span class='hs-varid'>constructView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span>
<a name="line-320"></a>
<a name="line-321"></a> <span class='hs-comment'>-- reselect selected items</span>
<a name="line-322"></a> <span class='hs-comment'>-- TODO: not implemented for icon view yet</span>
<a name="line-323"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>view'</span> <span class='hs-keyword'>of</span>
<a name="line-324"></a> <span class='hs-conid'>FMTreeView</span> <span class='hs-varid'>treeView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-325"></a> <span class='hs-varid'>tvs</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeViewGetSelection</span> <span class='hs-varid'>treeView</span>
<a name="line-326"></a> <span class='hs-varid'>ntps</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>mapM</span> <span class='hs-varid'>treeRowReferenceGetPath</span> <span class='hs-varid'>trs</span>
<a name="line-327"></a> <span class='hs-varid'>mapM_</span> <span class='hs-layout'>(</span><span class='hs-varid'>treeSelectionSelectPath</span> <span class='hs-varid'>tvs</span><span class='hs-layout'>)</span> <span class='hs-varid'>ntps</span>
<a name="line-328"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
<a name="line-329"></a><span class='hs-definition'>refreshView</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ioError</span> <span class='hs-varop'>$</span> <span class='hs-varid'>userError</span> <span class='hs-str'>"Inappropriate type!"</span>
<a name="line-330"></a>
<a name="line-331"></a>
<a name="line-332"></a><a name="constructView"></a><span class='hs-comment'>-- |Constructs the visible View with the current underlying mutable models,</span>
<a name="line-333"></a><span class='hs-comment'>-- which are retrieved from 'MyGUI'.</span>
<a name="line-334"></a><span class='hs-comment'>--</span>
<a name="line-335"></a><span class='hs-comment'>-- This sort of merges the components mygui and myview and fires up</span>
<a name="line-336"></a><span class='hs-comment'>-- the actual models.</span>
<a name="line-337"></a><span class='hs-definition'>constructView</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>MyGUI</span>
<a name="line-338"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>MyView</span>
<a name="line-339"></a> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>IO</span> <span class='hs-conid'>()</span>
<a name="line-340"></a><span class='hs-definition'>constructView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-341"></a> <span class='hs-varid'>settings'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>settings</span> <span class='hs-varid'>mygui</span>
<a name="line-342"></a>
<a name="line-343"></a> <span class='hs-comment'>-- pix stuff</span>
<a name="line-344"></a> <span class='hs-varid'>iT</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>iconThemeGetDefault</span>
<a name="line-345"></a> <span class='hs-varid'>folderPix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getIcon</span> <span class='hs-conid'>IFolder</span> <span class='hs-varid'>iT</span> <span class='hs-layout'>(</span><span class='hs-varid'>iconSize</span> <span class='hs-varid'>settings'</span><span class='hs-layout'>)</span>
<a name="line-346"></a> <span class='hs-varid'>folderSymPix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getSymlinkIcon</span> <span class='hs-conid'>IFolder</span> <span class='hs-varid'>iT</span> <span class='hs-layout'>(</span><span class='hs-varid'>iconSize</span> <span class='hs-varid'>settings'</span><span class='hs-layout'>)</span>
<a name="line-347"></a> <span class='hs-varid'>filePix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getIcon</span> <span class='hs-conid'>IFile</span> <span class='hs-varid'>iT</span> <span class='hs-layout'>(</span><span class='hs-varid'>iconSize</span> <span class='hs-varid'>settings'</span><span class='hs-layout'>)</span>
<a name="line-348"></a> <span class='hs-varid'>fileSymPix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getSymlinkIcon</span> <span class='hs-conid'>IFile</span> <span class='hs-varid'>iT</span> <span class='hs-layout'>(</span><span class='hs-varid'>iconSize</span> <span class='hs-varid'>settings'</span><span class='hs-layout'>)</span>
<a name="line-349"></a> <span class='hs-varid'>errorPix</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getIcon</span> <span class='hs-conid'>IError</span> <span class='hs-varid'>iT</span> <span class='hs-layout'>(</span><span class='hs-varid'>iconSize</span> <span class='hs-varid'>settings'</span><span class='hs-layout'>)</span>
<a name="line-350"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>Dir</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>folderPix</span>
<a name="line-351"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>FileLike</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filePix</span>
<a name="line-352"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>DirSym</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>folderSymPix</span>
<a name="line-353"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>FileLikeSym</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>fileSymPix</span>
<a name="line-354"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>Failed</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>errorPix</span>
<a name="line-355"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-conid'>BrokenSymlink</span><span class='hs-layout'>{</span><span class='hs-layout'>}</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>errorPix</span>
<a name="line-356"></a> <span class='hs-varid'>dirtreePix</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>errorPix</span>
<a name="line-357"></a>
<a name="line-358"></a>
<a name="line-359"></a> <span class='hs-varid'>view'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>view</span> <span class='hs-varid'>myview</span>
<a name="line-360"></a>
<a name="line-361"></a> <span class='hs-varid'>cdir</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>getCurrentDir</span> <span class='hs-varid'>myview</span>
<a name="line-362"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>cdirp</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>path</span> <span class='hs-varid'>cdir</span>
<a name="line-363"></a>
<a name="line-364"></a> <span class='hs-comment'>-- update urlBar</span>
<a name="line-365"></a> <span class='hs-varid'>entrySetText</span> <span class='hs-layout'>(</span><span class='hs-varid'>urlBar</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdirp</span><span class='hs-layout'>)</span>
<a name="line-366"></a>
<a name="line-367"></a> <span class='hs-varid'>rawModel'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-varop'>$</span> <span class='hs-varid'>rawModel</span> <span class='hs-varid'>myview</span>
<a name="line-368"></a>
<a name="line-369"></a> <span class='hs-comment'>-- filtering</span>
<a name="line-370"></a> <span class='hs-varid'>filteredModel'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelFilterNew</span> <span class='hs-varid'>rawModel'</span> <span class='hs-conid'>[]</span>
<a name="line-371"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>filteredModel</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>filteredModel'</span>
<a name="line-372"></a> <span class='hs-varid'>treeModelFilterSetVisibleFunc</span> <span class='hs-varid'>filteredModel'</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>iter</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-373"></a> <span class='hs-varid'>hidden</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>showHidden</span> <span class='hs-varop'>&lt;$&gt;</span> <span class='hs-varid'>readTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>settings</span> <span class='hs-varid'>mygui</span><span class='hs-layout'>)</span>
<a name="line-374"></a> <span class='hs-varid'>item</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelGetRow</span> <span class='hs-varid'>rawModel'</span> <span class='hs-varid'>iter</span> <span class='hs-varop'>&gt;&gt;=</span> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span><span class='hs-layout'>)</span>
<a name="line-375"></a> <span class='hs-keyword'>if</span> <span class='hs-varid'>hidden</span>
<a name="line-376"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>return</span> <span class='hs-conid'>True</span>
<a name="line-377"></a> <span class='hs-keyword'>else</span> <span class='hs-varid'>return</span> <span class='hs-varop'>.</span> <span class='hs-varid'>not</span> <span class='hs-varop'>.</span> <span class='hs-varid'>hiddenFile</span> <span class='hs-varop'>.</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromRel</span> <span class='hs-varop'>$</span> <span class='hs-varid'>item</span>
<a name="line-378"></a>
<a name="line-379"></a> <span class='hs-comment'>-- sorting</span>
<a name="line-380"></a> <span class='hs-varid'>sortedModel'</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelSortNewWithModel</span> <span class='hs-varid'>filteredModel'</span>
<a name="line-381"></a> <span class='hs-varid'>writeTVarIO</span> <span class='hs-layout'>(</span><span class='hs-varid'>sortedModel</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>sortedModel'</span>
<a name="line-382"></a> <span class='hs-varid'>treeSortableSetSortFunc</span> <span class='hs-varid'>sortedModel'</span> <span class='hs-num'>1</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>iter1</span> <span class='hs-varid'>iter2</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-383"></a> <span class='hs-varid'>cIter1</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelFilterConvertIterToChildIter</span> <span class='hs-varid'>filteredModel'</span> <span class='hs-varid'>iter1</span>
<a name="line-384"></a> <span class='hs-varid'>cIter2</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelFilterConvertIterToChildIter</span> <span class='hs-varid'>filteredModel'</span> <span class='hs-varid'>iter2</span>
<a name="line-385"></a> <span class='hs-varid'>item1</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelGetRow</span> <span class='hs-varid'>rawModel'</span> <span class='hs-varid'>cIter1</span>
<a name="line-386"></a> <span class='hs-varid'>item2</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>treeModelGetRow</span> <span class='hs-varid'>rawModel'</span> <span class='hs-varid'>cIter2</span>
<a name="line-387"></a> <span class='hs-varid'>return</span> <span class='hs-varop'>$</span> <span class='hs-varid'>compare</span> <span class='hs-varid'>item1</span> <span class='hs-varid'>item2</span>
<a name="line-388"></a> <span class='hs-varid'>treeSortableSetSortColumnId</span> <span class='hs-varid'>sortedModel'</span> <span class='hs-num'>1</span> <span class='hs-conid'>SortAscending</span>
<a name="line-389"></a>
<a name="line-390"></a> <span class='hs-comment'>-- set values</span>
<a name="line-391"></a> <span class='hs-varid'>treeModelSetColumn</span> <span class='hs-varid'>rawModel'</span> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdPixbuf</span> <span class='hs-num'>0</span><span class='hs-layout'>)</span>
<a name="line-392"></a> <span class='hs-varid'>dirtreePix</span>
<a name="line-393"></a> <span class='hs-varid'>treeModelSetColumn</span> <span class='hs-varid'>rawModel'</span> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>1</span><span class='hs-layout'>)</span>
<a name="line-394"></a> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>toFilePath</span> <span class='hs-varop'>.</span> <span class='hs-varid'>fromJust</span> <span class='hs-varop'>.</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>basename</span> <span class='hs-varop'>.</span> <span class='hs-varid'>path</span><span class='hs-layout'>)</span>
<a name="line-395"></a> <span class='hs-varid'>treeModelSetColumn</span> <span class='hs-varid'>rawModel'</span> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>2</span><span class='hs-layout'>)</span>
<a name="line-396"></a> <span class='hs-varid'>packModTime</span>
<a name="line-397"></a> <span class='hs-varid'>treeModelSetColumn</span> <span class='hs-varid'>rawModel'</span> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>3</span><span class='hs-layout'>)</span>
<a name="line-398"></a> <span class='hs-varid'>packPermissions</span>
<a name="line-399"></a>
<a name="line-400"></a> <span class='hs-comment'>-- update model of view</span>
<a name="line-401"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>view'</span> <span class='hs-keyword'>of</span>
<a name="line-402"></a> <span class='hs-conid'>FMTreeView</span> <span class='hs-varid'>treeView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-403"></a> <span class='hs-varid'>treeViewSetModel</span> <span class='hs-varid'>treeView</span> <span class='hs-varid'>sortedModel'</span>
<a name="line-404"></a> <span class='hs-varid'>treeViewSetRubberBanding</span> <span class='hs-varid'>treeView</span> <span class='hs-conid'>True</span>
<a name="line-405"></a> <span class='hs-conid'>FMIconView</span> <span class='hs-varid'>iconView</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-keyword'>do</span>
<a name="line-406"></a> <span class='hs-varid'>iconViewSetModel</span> <span class='hs-varid'>iconView</span> <span class='hs-layout'>(</span><span class='hs-conid'>Just</span> <span class='hs-varid'>sortedModel'</span><span class='hs-layout'>)</span>
<a name="line-407"></a> <span class='hs-varid'>iconViewSetPixbufColumn</span> <span class='hs-varid'>iconView</span>
<a name="line-408"></a> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdPixbuf</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ColumnId</span> <span class='hs-varid'>item</span> <span class='hs-conid'>Pixbuf</span><span class='hs-layout'>)</span>
<a name="line-409"></a> <span class='hs-varid'>iconViewSetTextColumn</span> <span class='hs-varid'>iconView</span>
<a name="line-410"></a> <span class='hs-layout'>(</span><span class='hs-varid'>makeColumnIdString</span> <span class='hs-num'>1</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>ColumnId</span> <span class='hs-varid'>item</span> <span class='hs-conid'>String</span><span class='hs-layout'>)</span>
<a name="line-411"></a>
<a name="line-412"></a> <span class='hs-comment'>-- add watcher</span>
<a name="line-413"></a> <span class='hs-varid'>mi</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>tryTakeMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>inotify</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span>
<a name="line-414"></a> <span class='hs-varid'>for_</span> <span class='hs-varid'>mi</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>killINotify</span> <span class='hs-varid'>i</span>
<a name="line-415"></a> <span class='hs-varid'>newi</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>initINotify</span>
<a name="line-416"></a> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>addWatch</span>
<a name="line-417"></a> <span class='hs-varid'>newi</span>
<a name="line-418"></a> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Move</span><span class='hs-layout'>,</span> <span class='hs-conid'>MoveIn</span><span class='hs-layout'>,</span> <span class='hs-conid'>MoveOut</span><span class='hs-layout'>,</span> <span class='hs-conid'>MoveSelf</span><span class='hs-layout'>,</span> <span class='hs-conid'>Create</span><span class='hs-layout'>,</span> <span class='hs-conid'>Delete</span><span class='hs-layout'>,</span> <span class='hs-conid'>DeleteSelf</span><span class='hs-keyglyph'>]</span>
<a name="line-419"></a> <span class='hs-layout'>(</span><span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>fromAbs</span> <span class='hs-varid'>cdirp</span><span class='hs-layout'>)</span>
<a name="line-420"></a> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-varid'>postGUIAsync</span> <span class='hs-varop'>$</span> <span class='hs-varid'>refreshView</span> <span class='hs-varid'>mygui</span> <span class='hs-varid'>myview</span> <span class='hs-varid'>cdir</span><span class='hs-layout'>)</span>
<a name="line-421"></a> <span class='hs-varid'>putMVar</span> <span class='hs-layout'>(</span><span class='hs-varid'>inotify</span> <span class='hs-varid'>myview</span><span class='hs-layout'>)</span> <span class='hs-varid'>newi</span>
<a name="line-422"></a>
<a name="line-423"></a> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
</pre></body>
</html>