| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | import System.Gnome.GConf |
|---|
| 16 | import Data.Maybe |
|---|
| 17 | |
|---|
| 18 | main :: IO () |
|---|
| 19 | main = do |
|---|
| 20 | gc <- gconfGetDefault :: IO GConf |
|---|
| 21 | let key = "/apps/nautilus/icon_view" |
|---|
| 22 | let val = ["size", "date_modified", "none"] |
|---|
| 23 | |
|---|
| 24 | putStrLn$ "setting value: "++show val |
|---|
| 25 | gconfSet gc key $ |
|---|
| 26 | GConfValueList (map GConfValueString val) |
|---|
| 27 | |
|---|
| 28 | v <- gconfGet gc key |
|---|
| 29 | putStrLn$ "result from reading: "++show (toStringList v) |
|---|
| 30 | |
|---|
| 31 | toStringList :: GConfValueDyn -> Maybe [String] |
|---|
| 32 | toStringList (GConfValueList ds) = |
|---|
| 33 | let vs = map fromGConfValueString ds |
|---|
| 34 | in if any (==Nothing) vs |
|---|
| 35 | then Nothing |
|---|
| 36 | else Just $ map fromJust vs |
|---|
| 37 | where |
|---|
| 38 | fromGConfValueString (GConfValueString s) = Just s |
|---|
| 39 | fromGConfValueString _ = Nothing |
|---|
| 40 | toStringList _ = Nothing |
|---|