Virtual desktop underlay for Wayland and X11
git clone https://github.com/m-col/xanadu
Files | Refs | Readme | License

Commit e99307bed668e0a4690c86d45cd90057a89f5963
Parent: b346d443616d0abc8f162de2bf1f77dc53bc4f71
Author: mcol <mcol@posteo.net>
Date: 2021-10-31 15:25:51 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-10-31 15:25:51 +0000

Clean up getIcon

src/Icons.hs Modified

@@ -59,15 +59,12 @@
         (Just icon') -> Gtk.listStoreSet listStore iter [0, 1] [value, icon']
 
 getIcon :: Gtk.IconTheme -> Item -> MaybeT IO GValue
-getIcon iconTheme item =
-    if (itemIsDir item)
-        then
-            Gtk.iconThemeLoadIcon iconTheme "folder" 32 [] >>= liftIO . Gtk.toGValue
-        else do
-            contentType <- Gio.contentTypeGuess (Just . pack $ itemPath item) Nothing
-            iconName <- MaybeT $ Gio.contentTypeGetGenericIconName . fst $ contentType
-            pixbuf <- Gtk.iconThemeLoadIcon iconTheme iconName 32 []
-            liftIO . Gtk.toGValue $ pixbuf
+getIcon iconTheme item
+    | itemIsDir item = liftIO . Gtk.toGValue =<< Gtk.iconThemeLoadIcon iconTheme "folder" 32 []
+    | otherwise = do
+        (contentType, _) <- Gio.contentTypeGuess (Just . pack $ itemPath item) Nothing
+        iconName <- MaybeT . Gio.contentTypeGetGenericIconName $ contentType
+        liftIO . Gtk.toGValue =<< Gtk.iconThemeLoadIcon iconTheme iconName 32 []
 
 data Item = Item
     { itemPath :: FilePath