Let users specify 0..n folders or file they wish to open on the command line. If no folder/file is specified, then Thunar will open a single window with the current directory. Files will be processed using thunar_file_launch().
Created attachment 423 patch for thunar/main.c This patch will only open each folder specified on the command line in separate windows. Files are not (yet) processed.
Your patch has several issues: realpath() cannot be used in this context, as it cannot handle file:-URIs, getcwd() shouldn't be used, GLib offers a replacement (g_get_current_directory() or something like that), modifying argv isn't a good idea, either allocate a temporary nargv or use a different code path, etc. What I forgot to mention in the initial description is that the code should also re-use an existing Thunar instance if possible (-> D-BUS, see Terminal for an example), so the whole thing requires adding and moving around some code. I appreciate your work on this, but let me finish some basics first, before we continue to solve this issue. ;-)
Mostly done with revision 19782. 2006-02-08 Benedikt Meurer <benny@xfce.org> * thunar/thunar-application.{c,h}: Add a "daemon" property, which determines whether Thunar will exit once the last window is closed. Remove the D-BUS service here. Add process_filenames() method, to process the list of filenames given on the command line. Bug #1384. * thunar/main.c: Attach the D-BUS here. * Makefile.am, org.xfce.Thunar.service.in: Add Thunar specific service file. * thunar/thunar-dbus-service-infos.xml, thunar/thunar-dbus-service.c: Add the org.xfce.Thunar interface here, with currently only a LaunchFiles() method, which can process Thunar command line parameters in a remote instance. Bug #1384. * thunar/thunar-dbus-client.{c,h}, thunar/Makefile.am: Add convenience wrapper for the D-BUS LaunchFiles() of the org.xfce.Thunar interface, which is used on startup to first try to reuse an existing instance. This way new folder windows will popup instantly if an instance of Thunar is already running. * org.xfce.Thunar.service.in, org.xfce.FileManager.service.in, thunar/main.c: Add --daemon option and use it when starting from the message bus. Pass all additional parameters as file names to a run- ning remote instance or to ThunarApplication as fallback. Bug #1384. * examples/xfce-file-manager.py, examples/Makefile.am: Add a simple example how to communicate with the file manager using the D-BUS Python bindings.