GTK: improve file property dialog
Adds the following fields: * file type * permissions * link destination of symlink (if applicable)
This commit is contained in:
parent
064d5a1032
commit
d432c2146b
@ -72,38 +72,6 @@
|
|||||||
<property name="top_attach">2</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label4">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="margin_left">5</property>
|
|
||||||
<property name="label" translatable="yes">Modified:</property>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="weight" value="bold"/>
|
|
||||||
</attributes>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="margin_left">5</property>
|
|
||||||
<property name="label" translatable="yes">Accessed:</property>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="weight" value="bold"/>
|
|
||||||
</attributes>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">0</property>
|
|
||||||
<property name="top_attach">4</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="fpropLocEntry">
|
<object class="GtkEntry" id="fpropLocEntry">
|
||||||
<property name="width_request">350</property>
|
<property name="width_request">350</property>
|
||||||
@ -136,6 +104,38 @@
|
|||||||
<property name="top_attach">2</property>
|
<property name="top_attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label5">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="label" translatable="yes">Accessed:</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">7</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="label" translatable="yes">Modified:</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">6</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="fpropModEntry">
|
<object class="GtkEntry" id="fpropModEntry">
|
||||||
<property name="width_request">350</property>
|
<property name="width_request">350</property>
|
||||||
@ -149,7 +149,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">6</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
@ -163,11 +163,104 @@
|
|||||||
<property name="margin_bottom">2</property>
|
<property name="margin_bottom">2</property>
|
||||||
<property name="editable">False</property>
|
<property name="editable">False</property>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">7</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label6">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="label" translatable="yes">File Type:</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="fpropFTEntry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="fpropPermEntry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="top_attach">4</property>
|
<property name="top_attach">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="label" translatable="yes">Link Destination:</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label8">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="label" translatable="yes">Permissions:</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkEntry" id="fpropLDEntry">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
<property name="margin_top">2</property>
|
||||||
|
<property name="margin_bottom">2</property>
|
||||||
|
<property name="editable">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkImage" id="image1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -607,3 +607,21 @@ packPermissions dt = fromFreeVar (pStr . fileMode) dt
|
|||||||
| otherwise = "-"
|
| otherwise = "-"
|
||||||
hasFM fm = ffm `PF.intersectFileModes` fm == fm
|
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
|
||||||
|
|
||||||
|
@ -106,12 +106,15 @@ data RightClickMenu = MkRightClickMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data FilePropertyGrid = MkFilePropertyGrid {
|
data FilePropertyGrid = MkFilePropertyGrid {
|
||||||
fpropGrid :: !Grid
|
fpropGrid :: !Grid
|
||||||
, fpropFnEntry :: !Entry
|
, fpropFnEntry :: !Entry
|
||||||
, fpropLocEntry :: !Entry
|
, fpropLocEntry :: !Entry
|
||||||
, fpropTsEntry :: !Entry
|
, fpropTsEntry :: !Entry
|
||||||
, fpropModEntry :: !Entry
|
, fpropModEntry :: !Entry
|
||||||
, fpropAcEntry :: !Entry
|
, fpropAcEntry :: !Entry
|
||||||
|
, fpropFTEntry :: !Entry
|
||||||
|
, fpropPermEntry :: !Entry
|
||||||
|
, fpropLDEntry :: !Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,6 +267,16 @@ showFilePropertyDialog [item] mygui _ = do
|
|||||||
entrySetText (fpropTsEntry fprop') (fromFreeVar (show . fileSize) item)
|
entrySetText (fpropTsEntry fprop') (fromFreeVar (show . fileSize) item)
|
||||||
entrySetText (fpropModEntry fprop') (packModTime item)
|
entrySetText (fpropModEntry fprop') (packModTime item)
|
||||||
entrySetText (fpropAcEntry fprop') (packAccessTime 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
|
cbox <- dialogGetActionArea dialog
|
||||||
_ <- dialogAddButton dialog "Ok" (ResponseUser 0)
|
_ <- dialogAddButton dialog "Ok" (ResponseUser 0)
|
||||||
|
@ -126,6 +126,12 @@ createMyGUI = do
|
|||||||
"fpropModEntry"
|
"fpropModEntry"
|
||||||
fpropAcEntry <- builderGetObject builder castToEntry
|
fpropAcEntry <- builderGetObject builder castToEntry
|
||||||
"fpropAcEntry"
|
"fpropAcEntry"
|
||||||
|
fpropFTEntry <- builderGetObject builder castToEntry
|
||||||
|
"fpropFTEntry"
|
||||||
|
fpropPermEntry <- builderGetObject builder castToEntry
|
||||||
|
"fpropPermEntry"
|
||||||
|
fpropLDEntry <- builderGetObject builder castToEntry
|
||||||
|
"fpropLDEntry"
|
||||||
|
|
||||||
-- construct the gui object
|
-- construct the gui object
|
||||||
let menubar = MkMenuBar {..}
|
let menubar = MkMenuBar {..}
|
||||||
|
Loading…
Reference in New Issue
Block a user