Integrate GtkFilePowerboxHook into Gtk
Status: in progress
Integrate GtkFilePowerboxHook into Gtk and produce a patch that can be submitted upstream.
The current GtkFilePowerboxHook uses an LD_PRELOADed library to replace the Gtk file chooser, but this does not work with applications such as Firefox which dlopen() Gtk to use the file chooser interface.
It would not be acceptable for Gtk to depend directly on Plash's C-level RPC interfaces, so instead there should be an intermediate library that Gtk can depend on. This would allow other RPC methods to be used for making powerbox requests, such as D-Bus. I have started such a library in scratch/powerbox-dbus.
Maybe the term "powerbox" is too generic and not descriptive enough. "Powerbox file chooser" is more specific, but "trusted path file chooser" might be a more obvious term for people who have not encountered the concept before. It is also more in line with the term "trusted path clipboard". So "libtpfilechooser" could be a better name than "libpowerbox".
This depends on StoryBuild1, which will create a libplash package (and a libplash-dev).
Questions
I should create a branch of Gtk to track these changes, but using what tool? Perhaps Git or Bazaar. It is possible to clone the whole history of Gtk using git-svn but the result is large. git-svn also lets you clone a partial history from SVN. This feature is planned for Bazaar (see HistoryHorizon) but it doesn't appear to be implemented yet.
It might be possible to keep the Gtk branch here: http://bzr-playground.gnome.org
Notes on getting started
Import recent Gtk history into git:
git-svn clone -r 19766 http://svn.gnome.org/svn/gtk+ -Ttrunk -ttags -bbranches
Using svn://svn.gnome.org/svn/gtk+ frequently gave "Malformed network data" errors so I switched to http.
Install dependencies in chroot: apt-get install gtk-doc-tools automake1.7 libtiff4-dev
Tasks
Add unit tests for existing GtkFilePowerboxHook (based on those in scratch/powerbox-dbus), which we can re-use for the new code
Investigate and fix failing unit test (test_multiple_requests).
In scratch/powerbox-dbus I changed the preload hook so that it would do gtk_widget_hide() when the request had completed, so that doing gtk_dialog_run() twice would send two powerbox requests. But gtk_dialog_run() does not close the window for you, so it's not clear that the hook should do that. It should be the caller's responsibility to do gtk_widget_hide().
Make sure the tests are run from BuildTools. Make the tests run from make check and/or debian/rules.
- Completeness:
- Extend the powerbox interface to support returning multiple selected files. This is useful for opening multiple files, e.g. in a music player. So far the file chooser functionality has been incomplete. If I'm going to submit something upstream it should be complete.
- Pass the requested directory pathname in the powerbox request.
Remove gtkfilechooserdialog.c's #include "x11/gdkx.h", because a dependence on X will not be acceptable. What do I replace it with, though?
- Why did I disable response_db()? (I am re-using work I did in 2007 and I didn't make enough notes about what I did then.)
- Split out libpowerbox/libtpfilechooser from gtk-powerbox-hook
Add the branch to BuildTools
- Build a Debian package. Re-use existing packaging from Debian/Ubuntu. I suspect the packaging uses a Gtk tarball, which could be awkward.
The Git repository is here: gtk-with-powerbox
