Is there a way to customize/override the default right click/context menu within a Gtk::FileChooser widget ?
Currently by default, we get a menu with the follwing options,
Thing is, in our application we do not want the user to open a filemanager from within file chooser. However, the context menu option defeats this. Also, we want to introduce few other things under this context menu.
Basically, we want to customize the entire conext menu for the requirement in hand.
This is more with respect to the programming with Gtkmm. We are not sure what we should do to make sure the user’s can’t access the local data directly. In a application scenario, we do not wants the users to access the local files over a filer manager and can be acheived with usual OS hardening methos, but this specific option in the file chooser widget in gtkmm defeats this when it allows the user to open a file manager from within its context menu while inside the file chooser.
You should not be using FileChooserWidget directly: you should use the GtkFileChooserNative object to run the native dialog of the platform. When running under Linux, the native dialog can be run by a separate process as part of the sandboxing mechanism, which means you can’t just inject your own code into it.
Adding random menu items to a standard file selector is not a great UI: it violates the principle of least astonishment; it makes those options undiscoverable; and it creates a behavioural difference between your app and any other app in the system. I strongly encourage you to rethink your approach.
Adding new items to a standard menu is not a good idea and i totally agree. But here we are talking about a specialized application where the user doesn’t have access to any other application. The primary intent here is to totally remove the right click menu from within the file chooser so that user cannot open the file browser and access everything.
Let me look into your suggestion. I will revert soon.