diff --git a/data/Gtk/builder.xml b/data/Gtk/builder.xml index 92ce68a..5cebac5 100644 --- a/data/Gtk/builder.xml +++ b/data/Gtk/builder.xml @@ -72,38 +72,6 @@ 2 - - - True - False - start - 5 - Modified: - - - - - - 0 - 3 - - - - - True - False - start - 5 - Accessed: - - - - - - 0 - 4 - - 350 @@ -136,6 +104,38 @@ 2 + + + True + False + start + 5 + Accessed: + + + + + + 0 + 7 + + + + + True + False + start + 5 + Modified: + + + + + + 0 + 6 + + 350 @@ -149,7 +149,7 @@ 1 - 3 + 6 @@ -163,11 +163,104 @@ 2 False + + 1 + 7 + + + + + True + False + start + 5 + File Type: + + + + + + 0 + 3 + + + + + True + True + 5 + 5 + 2 + 2 + False + + + 1 + 3 + + + + + True + True + 5 + 5 + 2 + 2 + False + 1 4 + + + True + False + start + 5 + Link Destination: + + + + + + 0 + 5 + + + + + True + False + start + 5 + Permissions: + + + + + + 0 + 4 + + + + + True + True + 5 + 5 + 2 + 2 + False + + + 1 + 5 + + True diff --git a/src/HSFM/FileSystem/FileType.hs b/src/HSFM/FileSystem/FileType.hs index 2c67d72..18f0795 100644 --- a/src/HSFM/FileSystem/FileType.hs +++ b/src/HSFM/FileSystem/FileType.hs @@ -607,3 +607,21 @@ packPermissions dt = fromFreeVar (pStr . fileMode) dt | otherwise = "-" hasFM fm = ffm `PF.intersectFileModes` fm == fm + +packFileType :: File a -> String +packFileType file = case file of + Dir {} -> "Directory" + RegFile {} -> "Regular File" + SymLink {} -> "Symbolic Link" + BlockDev {} -> "Block Device" + CharDev {} -> "Char Device" + NamedPipe {} -> "Named Pipe" + Socket {} -> "Socket" + _ -> "Unknown" + + +packLinkDestination :: File a -> Maybe ByteString +packLinkDestination file = case file of + SymLink { rawdest = dest } -> Just dest + _ -> Nothing + diff --git a/src/HSFM/GUI/Gtk/Data.hs b/src/HSFM/GUI/Gtk/Data.hs index 9e6218d..37838a7 100644 --- a/src/HSFM/GUI/Gtk/Data.hs +++ b/src/HSFM/GUI/Gtk/Data.hs @@ -106,12 +106,15 @@ data RightClickMenu = MkRightClickMenu { } data FilePropertyGrid = MkFilePropertyGrid { - fpropGrid :: !Grid - , fpropFnEntry :: !Entry - , fpropLocEntry :: !Entry - , fpropTsEntry :: !Entry - , fpropModEntry :: !Entry - , fpropAcEntry :: !Entry + fpropGrid :: !Grid + , fpropFnEntry :: !Entry + , fpropLocEntry :: !Entry + , fpropTsEntry :: !Entry + , fpropModEntry :: !Entry + , fpropAcEntry :: !Entry + , fpropFTEntry :: !Entry + , fpropPermEntry :: !Entry + , fpropLDEntry :: !Entry } diff --git a/src/HSFM/GUI/Gtk/Dialogs.hs b/src/HSFM/GUI/Gtk/Dialogs.hs index 4541346..c425f1e 100644 --- a/src/HSFM/GUI/Gtk/Dialogs.hs +++ b/src/HSFM/GUI/Gtk/Dialogs.hs @@ -267,6 +267,16 @@ showFilePropertyDialog [item] mygui _ = do entrySetText (fpropTsEntry fprop') (fromFreeVar (show . fileSize) item) entrySetText (fpropModEntry fprop') (packModTime item) entrySetText (fpropAcEntry fprop') (packAccessTime item) + entrySetText (fpropFTEntry fprop') (packFileType item) + entrySetText (fpropPermEntry fprop') (tail $ packPermissions item) + case packLinkDestination item of + (Just dest) -> do + widgetSetSensitive (fpropLDEntry fprop') True + entrySetText (fpropLDEntry fprop') dest + Nothing -> do + widgetSetSensitive (fpropLDEntry fprop') False + entrySetText (fpropLDEntry fprop') "( Not a symlink )" + cbox <- dialogGetActionArea dialog _ <- dialogAddButton dialog "Ok" (ResponseUser 0) diff --git a/src/HSFM/GUI/Gtk/MyGUI.hs b/src/HSFM/GUI/Gtk/MyGUI.hs index cf1ec8f..fb0f11e 100644 --- a/src/HSFM/GUI/Gtk/MyGUI.hs +++ b/src/HSFM/GUI/Gtk/MyGUI.hs @@ -126,6 +126,12 @@ createMyGUI = do "fpropModEntry" fpropAcEntry <- builderGetObject builder castToEntry "fpropAcEntry" + fpropFTEntry <- builderGetObject builder castToEntry + "fpropFTEntry" + fpropPermEntry <- builderGetObject builder castToEntry + "fpropPermEntry" + fpropLDEntry <- builderGetObject builder castToEntry + "fpropLDEntry" -- construct the gui object let menubar = MkMenuBar {..}