diff options
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/file.cpp b/src/file.cpp index 69d6da610..436cd0ee0 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -359,7 +359,7 @@ static Inkscape::UI::Dialog::FileOpenDialog *openDialogInstance = NULL; * Can select single or multiple files for opening. */ void -sp_file_open_dialog(gpointer object, gpointer data) +sp_file_open_dialog(Gtk::Window &parentWindow, gpointer object, gpointer data) { //# Get the current directory for finding files @@ -385,6 +385,7 @@ sp_file_open_dialog(gpointer object, gpointer data) if (!openDialogInstance) { openDialogInstance = Inkscape::UI::Dialog::FileOpenDialog::create( + parentWindow, open_path, Inkscape::UI::Dialog::SVG_TYPES, (char const *)_("Select file to open")); @@ -496,7 +497,7 @@ sp_file_vacuum() * document; is true for normal save, false for temporary saves */ static bool -file_save(SPDocument *doc, const Glib::ustring &uri, +file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key, bool saveas, bool official) { if (!doc || uri.size()<1) //Safety check @@ -523,7 +524,7 @@ file_save(SPDocument *doc, const Glib::ustring &uri, g_free(safeUri); return FALSE; } catch (Inkscape::Extension::Output::no_overwrite &e) { - return sp_file_save_dialog(doc); + return sp_file_save_dialog(parentWindow, doc); } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Document saved.")); @@ -540,7 +541,7 @@ file_save(SPDocument *doc, const Glib::ustring &uri, * \param ascopy (optional) wether to set the documents->uri to the new filename or not */ bool -sp_file_save_dialog(SPDocument *doc, bool is_copy) +sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) { Inkscape::XML::Node *repr = sp_document_repr_root(doc); @@ -614,6 +615,7 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) } Inkscape::UI::Dialog::FileSaveDialog *saveDialog = Inkscape::UI::Dialog::FileSaveDialog::create( + parentWindow, save_loc, Inkscape::UI::Dialog::SVG_TYPES, (char const *) _("Select file to save to"), @@ -640,6 +642,7 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) Inkscape::Extension::Extension *selectionType = saveDialog->getSelectionType(); delete saveDialog; + saveDialog = 0; if (fileName.size() > 0) { @@ -650,7 +653,7 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) else g_warning( "Error converting save filename to UTF-8." ); - success = file_save(doc, fileName, selectionType, TRUE, !is_copy); + success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy); if (success) prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc)); @@ -670,7 +673,7 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) * Save a document, displaying a SaveAs dialog if necessary. */ bool -sp_file_save_document(SPDocument *doc) +sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) { bool success = true; @@ -681,11 +684,11 @@ sp_file_save_document(SPDocument *doc) if ( doc->uri == NULL || repr->attribute("inkscape:output_extension") == NULL ) { - return sp_file_save_dialog(doc, FALSE); + return sp_file_save_dialog(parentWindow, doc, FALSE); } else { fn = g_strdup(doc->uri); gchar const *ext = repr->attribute("inkscape:output_extension"); - success = file_save(doc, fn, Inkscape::Extension::db.get(ext), FALSE, TRUE); + success = file_save(parentWindow, doc, fn, Inkscape::Extension::db.get(ext), FALSE, TRUE); g_free((void *) fn); } } else { @@ -701,7 +704,7 @@ sp_file_save_document(SPDocument *doc) * Save a document. */ bool -sp_file_save(gpointer object, gpointer data) +sp_file_save(Gtk::Window &parentWindow, gpointer object, gpointer data) { if (!SP_ACTIVE_DOCUMENT) return false; @@ -709,7 +712,7 @@ sp_file_save(gpointer object, gpointer data) SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Saving document...")); sp_namedview_document_from_window(SP_ACTIVE_DESKTOP); - return sp_file_save_document(SP_ACTIVE_DOCUMENT); + return sp_file_save_document(parentWindow, SP_ACTIVE_DOCUMENT); } @@ -717,12 +720,12 @@ sp_file_save(gpointer object, gpointer data) * Save a document, always displaying the SaveAs dialog. */ bool -sp_file_save_as(gpointer object, gpointer data) +sp_file_save_as(Gtk::Window &parentWindow, gpointer object, gpointer data) { if (!SP_ACTIVE_DOCUMENT) return false; sp_namedview_document_from_window(SP_ACTIVE_DESKTOP); - return sp_file_save_dialog(SP_ACTIVE_DOCUMENT, FALSE); + return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, FALSE); } @@ -731,12 +734,12 @@ sp_file_save_as(gpointer object, gpointer data) * Save a copy of a document, always displaying a sort of SaveAs dialog. */ bool -sp_file_save_a_copy(gpointer object, gpointer data) +sp_file_save_a_copy(Gtk::Window &parentWindow, gpointer object, gpointer data) { if (!SP_ACTIVE_DOCUMENT) return false; sp_namedview_document_from_window(SP_ACTIVE_DESKTOP); - return sp_file_save_dialog(SP_ACTIVE_DOCUMENT, TRUE); + return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, TRUE); } @@ -879,7 +882,7 @@ static Inkscape::UI::Dialog::FileOpenDialog *importDialogInstance = NULL; * Display an Open dialog, import a resource if OK pressed. */ void -sp_file_import(GtkWidget *widget) +sp_file_import(Gtk::Window &parentWindow) { static Glib::ustring import_path; @@ -890,7 +893,8 @@ sp_file_import(GtkWidget *widget) if (!importDialogInstance) { importDialogInstance = Inkscape::UI::Dialog::FileOpenDialog::create( - import_path, + parentWindow, + import_path, Inkscape::UI::Dialog::IMPORT_TYPES, (char const *)_("Select file to import")); } |
