This commit merges all ad-hoc file dialog code, such as the feature where dialogs remember last location and format, and exposes it through a common interface. This commit also significantly improves Gtk dialog handling code.