diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2009-08-09 14:23:52 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2009-08-09 14:23:52 +0000 |
| commit | 606ebb35498c3d750bb2906954195baaa0fbcad6 (patch) | |
| tree | a4b40cd970efc83525392a6a8164e2e6789029b8 /src/extension/system.h | |
| parent | Adding a Tinfoil bump, removing NR from Non realistic shaders names (diff) | |
| download | inkscape-606ebb35498c3d750bb2906954195baaa0fbcad6.tar.gz inkscape-606ebb35498c3d750bb2906954195baaa0fbcad6.zip | |
Fix remaining glitches in the behaviour of the Save dialogs (w.r.t. remembering the last file type and folder). As part of the cleanup inkscape:output_extension was removed, too.
(bzr r8454)
Diffstat (limited to 'src/extension/system.h')
| -rw-r--r-- | src/extension/system.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/extension/system.h b/src/extension/system.h index 6c23b2f0d..b6740e109 100644 --- a/src/extension/system.h +++ b/src/extension/system.h @@ -21,13 +21,64 @@ namespace Inkscape { namespace Extension { +/** + * Used to distinguish between the various invocations of the save dialogs (and thus to determine + * the file type and save path offered in the dialog) + */ +enum FileSaveMethod { + FILE_SAVE_METHOD_SAVE_AS, + FILE_SAVE_METHOD_SAVE_COPY, + FILE_SAVE_METHOD_EXPORT, + // Fallback for special cases (e.g., when saving a document for the first time or after saving + // it in a lossy format) + FILE_SAVE_METHOD_INKSCAPE_SVG, + // For saving temporary files; we return the same data as for FILE_SAVE_METHOD_SAVE_AS + FILE_SAVE_METHOD_TEMPORARY, +}; + SPDocument *open(Extension *key, gchar const *filename); void save(Extension *key, SPDocument *doc, gchar const *filename, - bool setextension, bool check_overwrite, bool official); + bool setextension, bool check_overwrite, bool official, + Inkscape::Extension::FileSaveMethod save_method); Print *get_print(gchar const *key); Extension *build_from_file(gchar const *filename); Extension *build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp); +/** + * Determine the desired default file extension depending on the given file save method. + * The returned string is guaranteed to be non-empty. + * + * @param method the file save method of the dialog + * @return the corresponding default file extension + */ +Glib::ustring get_file_save_extension (FileSaveMethod method); + +/** + * Determine the desired default save path depending on the given FileSaveMethod. + * The returned string is guaranteed to be non-empty. + * + * @param method the file save method of the dialog + * @param doc the file's document + * @return the corresponding default save path + */ +Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method); + +/** + * Write the given file extension back to prefs so that it can be used later on. + * + * @param extension the file extension which should be written to prefs + * @param method the file save mathod of the dialog + */ +void store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method); + +/** + * Write the given path back to prefs so that it can be used later on. + * + * @param path the path which should be written to prefs + * @param method the file save mathod of the dialog + */ +void store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method); + } } /* namespace Inkscape::Extension */ #endif /* INKSCAPE_EXTENSION_SYSTEM_H__ */ |
