Recent

Author Topic: File Properties Dialog on Linux  (Read 7711 times)

LazProgger

  • Full Member
  • ***
  • Posts: 103
File Properties Dialog on Linux
« on: June 29, 2016, 11:17:23 pm »
The Internet is full of code examples explaining how to show the file property dialog under Windows for a given file path.

But what about Linux? How can I display the file properties dialog of a file on Linux (the dialog that is shown when right clicking a file and selecting "Properties" from the context menu)?
« Last Edit: June 29, 2016, 11:27:38 pm by LazProgger »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: File Properties Dialog on Linux
« Reply #1 on: June 29, 2016, 11:58:09 pm »
Windows Explorer will display details from the version information resource if the executable (.exe, .dll) has that kind of resource. On Mac, cmd+I will display similar information from the app bundle's Info.plist file.

But on Linux, I'm not sure there is any kind of standard for that. On Ubuntu, the "Files" app has File | Properties, but I don't see that it displays anything like version info or copyright for any executable that I tested. Perhaps if the app has a .desktop file, it might show something.

See the Lazarus .desktop file for an example.



Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: File Properties Dialog on Linux
« Reply #2 on: June 30, 2016, 08:06:08 am »
Indeed it has no standard on Linux executables as details like that usually goes to .desktop files, which is quite standard. The interpretation, however, is still file manager specific. I don't think ROX FM will ever display such information while Dolphin already does without the need to ask.

LazProgger

  • Full Member
  • ***
  • Posts: 103
Re: File Properties Dialog on Linux
« Reply #3 on: June 30, 2016, 12:18:16 pm »
Maybe I did not express myself correctly. I am not interested in a dialog showing executable information.

I just want to show the default file properties dialog that can be called with every file type on Windows and Linux with right clicking the file and clicking on "Properties". I have attached an example of this dialog from Windows and Linux.

On Windows you can use ShellExecute to show it. Isn't there any Linux API call that can show this dialog?
« Last Edit: June 30, 2016, 12:26:07 pm by LazProgger »

mig-31

  • Sr. Member
  • ****
  • Posts: 305
Re: File Properties Dialog on Linux
« Reply #4 on: June 30, 2016, 12:29:44 pm »
Hi,

Look to DoubleCommander sourse code. It has this kind of dialog.

There is easy to get file info: permitions, date of creation, modified and so on by using functions from Unix unit and display it on Form with BorderStyle :=[bsDialog]
« Last Edit: June 30, 2016, 12:35:05 pm by mig-31 »
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

LazProgger

  • Full Member
  • ***
  • Posts: 103
Re: File Properties Dialog on Linux
« Reply #5 on: June 30, 2016, 12:35:14 pm »
Hi,

I think you should create it by yourself. There is easy to get file info: permitions, date of creation, modified and so on by using functions from Unix unit and display it on Form with BorderStyle :=[bsDialog] .

Yes I know, I can do this. However, I would prefer the original dialog.

One reason is that there are packages on Linux that are expanding that dialog with additional information and when building an own dialog, those information is away.
Another reason is that I want to have the look and feel of the underlying operating system the users are used to (I am also not creating my own OpenDialog although I could write my own one).

mig-31

  • Sr. Member
  • ****
  • Posts: 305
Re: File Properties Dialog on Linux
« Reply #6 on: June 30, 2016, 12:55:26 pm »
Look to DoubleCommander.
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

LazProgger

  • Full Member
  • ***
  • Posts: 103
Re: File Properties Dialog on Linux
« Reply #7 on: June 30, 2016, 05:08:38 pm »
Look to DoubleCommander.

Is that your default file properties dialog in the screenshot?

The buttons like "Set to all selected files" etc seems to indicate that this is only a double commander dialog.

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: File Properties Dialog on Linux
« Reply #8 on: June 30, 2016, 05:31:41 pm »
Yes I know, I can do this. However, I would prefer the original dialog.

One reason is that there are packages on Linux that are expanding that dialog with additional information and when building an own dialog, those information is away.
Another reason is that I want to have the look and feel of the underlying operating system the users are used to (I am also not creating my own OpenDialog although I could write my own one).
And what is the "original" dialog?

What widgetset are you using? gtk, gtk2, gtk3, qt?
And what Linux-variant are you using with what desktop environment are you using (like Gnome, KDE or other)?
What Filemanager are you using in that environment?

Linux is not a one fits all solution so calling the "original" dialog might not be as easy as it sounds.

LazProgger

  • Full Member
  • ***
  • Posts: 103
Re: File Properties Dialog on Linux
« Reply #9 on: June 30, 2016, 05:38:12 pm »

And what is the "original" dialog?

I am using GTK2 / Gnome. The file manager is Nautilus on Ubuntu.

What I mean with "original" is that in this constellation, I want to have the default dialog provided by Nautilus that is also used for the desktop. If someone is using another system, I want to have the dialog coming from this system. With "original" I mean the dialog that is shown by default on the corresponding system.

The same like the OpenDialog or SaveDialog, they are also looking different on each operating system.

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: File Properties Dialog on Linux
« Reply #10 on: June 30, 2016, 07:33:24 pm »
What I mean with "original" is that in this constellation, I want to have the default dialog provided by Nautilus that is also used for the desktop. If someone is using another system, I want to have the dialog coming from this system. With "original" I mean the dialog that is shown by default on the corresponding system.

The same like the OpenDialog or SaveDialog, they are also looking different on each operating system.
The problem is that the FileDialog comes from the widgetset (qt, gtk, winapi etc.) while the file-property dialog comes from nautilus. And as far as I know the widgetset qt also doesn't have a propery dialog. It doesn't even allow right click>properties on a file in it's widgetset.

Do you know of an instance (program, dialog or whatever) OUTSIDE nautilus, which can open the file-property screen of nautilus? (in which case we could check how they do it)

(I also haven't found a way to manipulate nautilus to show the dialog through api or command.)

LazProgger

  • Full Member
  • ***
  • Posts: 103
Re: File Properties Dialog on Linux
« Reply #11 on: July 01, 2016, 11:20:05 am »

Do you know of an instance (program, dialog or whatever) OUTSIDE nautilus, which can open the file-property screen of nautilus? (in which case we could check how they do it)

(I also haven't found a way to manipulate nautilus to show the dialog through api or command.)

Unfortunately, I don't know a program that can do that...

I have also searched the Internet for a command line argument with which you can call the Nautilus dialog with a file path, but I found no solution.

My first approach was to detect the default file manager of the system in order to call its dialog. But I could not find any example or list of arguments covering this.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: File Properties Dialog on Linux
« Reply #12 on: July 01, 2016, 12:41:52 pm »
On Windows you can use ShellExecute to show it. Isn't there any Linux API call that can show this dialog?
No, because there is not X11 standard dialog. X11 doesn't dictate a GUI toolkit - only a windowing environment. Each File Manager or X11 Desktop Environment (KDE, Gnome, Mate, Cinnamon, XFCE, JWM and a million others) implements their own ideas of this.

You best bet is to implement such a dialog yourself and call it on all platforms (or only on X11 based platforms). There are many open source projects (Object Pascal based) that have done this before, so you should be able to lift their code (license permitting), or implement it yourself - it's not that hard.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

TinyPortal © 2005-2018