Permalink
Browse files

Clear selection before clearing list

This prevents a crash when 2 or more items are removed
  • Loading branch information...
1 parent 5c8571c commit 0746eaf107bc106ce2a368f4c360079f4af5af96 @jgoerzen committed Mar 28, 2007
Showing with 7 additions and 7 deletions.
  1. +5 −5 Actions.hs
  2. +1 −1 MacroList.hs
  3. +1 −1 gmacro.hs
View
@@ -20,19 +20,19 @@ initActions b list model macdir window xml = do
onClicked (closebt b) (widgetDestroy window)
onClicked (connectbt b) (connect list model macdir)
onClicked (disconnectbt b) (disconnectMacro list model macdir)
- onClicked (newbt b) (record model macdir xml)
+ onClicked (newbt b) (record list model macdir xml)
onClicked (removebt b) (remove list model macdir window)
connect list model macdir = do
items <- getSelectedItems list model
let (name, shortcut) = head items
Metacity.bindMacro name "<Ctrl><Alt>t"
- loadList model macdir
+ loadList list model macdir
disconnectMacro list model macdir = do
items <- getSelectedItems list model
mapM_ removebind items
- loadList model macdir
+ loadList list model macdir
where removebind (name, _) = Metacity.removeBinding name
remove list model macdir window = do
@@ -50,7 +50,7 @@ remove list model macdir window = do
-- disconnectMacro will loadList itself
_ -> return ()
where rmit item = removeFile (macdir ++ "/" ++ item)
-record model macdir xml = do
+record list model macdir xml = do
recordwin <- xmlGetWidget xml castToWindow "recording"
finishedbt <- xmlGetWidget xml castToButton "recdonebt"
@@ -83,5 +83,5 @@ record model macdir xml = do
waitForProcess xmacroph
widgetHide recordwin
- loadList model macdir
+ loadList list model macdir
View
@@ -72,7 +72,7 @@ getSelectedItems list model = do
where row2data [i] = MV.listStoreGetValue model i
{- | Load the files into the list -}
-loadList model macdir = do
+loadList list model macdir = do
dir <- getAppUserDataDirectory "gmacro"
files' <- getDirectoryContents dir
let files = filter (\f -> f /= "." && f /= "..") files'
View
@@ -23,7 +23,7 @@ main = do
buttons <- initButtons xml window
(list, model) <- initList xml buttons
- loadList model macdir
+ loadList list model macdir
initActions buttons list model macdir window xml

0 comments on commit 0746eaf

Please sign in to comment.