diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-02-27 23:49:20 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-02-27 23:49:20 +0000 |
| commit | 6c5b23c3d3eff317c770c52cf47ca9955be7caba (patch) | |
| tree | 91f6b3f9d70089226ef546a9c9a9580c7e59d4d2 /src/file.cpp | |
| parent | gseal fix (diff) | |
| parent | fixed crash! (diff) | |
| download | inkscape-6c5b23c3d3eff317c770c52cf47ca9955be7caba.tar.gz inkscape-6c5b23c3d3eff317c770c52cf47ca9955be7caba.zip | |
Merge Andrew's new OCAL dialog and clean headers. Please test
(bzr r11027)
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/src/file.cpp b/src/file.cpp index 536dc9ebb..0f1182e67 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1147,7 +1147,7 @@ sp_file_import(Gtk::Window &parentWindow) return; } - //# Get file name and extension type + // Get file name and extension type Glib::ustring fileName = importDialogInstance->getFilename(); Inkscape::Extension::Extension *selection = importDialogInstance->getSelectionType(); @@ -1362,8 +1362,8 @@ sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) export_path = export_path_local; // Show the Export To OCAL dialog - Inkscape::UI::Dialog::FileExportToOCALDialog *exportDialogInstance = - new Inkscape::UI::Dialog::FileExportToOCALDialog( + Inkscape::UI::Dialog::OCAL:ExportDialog *exportDialogInstance = + new Inkscape::UI::Dialog::OCAL:ExportDialog parentWindow, Inkscape::UI::Dialog::EXPORT_TYPES, (char const *) _("Select file to export to") @@ -1474,11 +1474,23 @@ sp_file_export_to_ocal(Gtk::Window &parentWindow) ## I M P O R T F R O M O C A L ######################*/ +Inkscape::UI::Dialog::OCAL::ImportDialog* import_ocal_dialog = NULL; + /** - * Display an ImportToOcal Dialog, and the selected document from OCAL + * Display an ImportFromOcal Dialog, and the selected document from OCAL */ +void on_import_from_ocal_response(Glib::ustring filename) +{ + SPDocument *doc = SP_ACTIVE_DOCUMENT; + + if (!filename.empty()) { + Inkscape::Extension::Extension *selection = import_ocal_dialog->get_selection_type(); + file_import(doc, filename, selection); + } +} + void -sp_file_import_from_ocal(Gtk::Window &parentWindow) +sp_file_import_from_ocal(Gtk::Window &parent_window) { static Glib::ustring import_path; @@ -1486,47 +1498,18 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) if (!doc) return; - Inkscape::UI::Dialog::FileImportFromOCALDialog *importDialogInstance = NULL; - - if (!importDialogInstance) { - importDialogInstance = new - Inkscape::UI::Dialog::FileImportFromOCALDialog( - parentWindow, - import_path, + if (import_ocal_dialog == NULL) { + import_ocal_dialog = new + Inkscape::UI::Dialog::OCAL::ImportDialog( + parent_window, Inkscape::UI::Dialog::IMPORT_TYPES, - (char const *)_("Import From Open Clip Art Library")); - } + (char const *)_("Import Clip Art")); - bool success = importDialogInstance->show(); - if (!success) { - delete importDialogInstance; - return; + import_ocal_dialog->signal_response().connect( + sigc::ptr_fun(&on_import_from_ocal_response)); } - - // Get file name and extension type - Glib::ustring fileName = importDialogInstance->getFilename(); - Inkscape::Extension::Extension *selection = importDialogInstance->getSelectionType(); - - delete importDialogInstance; - importDialogInstance = NULL; - - if (fileName.size() > 0) { - - Glib::ustring newFileName = Glib::filename_to_utf8(fileName); - - if ( newFileName.size() > 0) - fileName = newFileName; - else - g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" ); - - import_path = fileName; - if (import_path.size()>0) - import_path.append(G_DIR_SEPARATOR_S); - - file_import(doc, fileName, selection); - } - - return; + + import_ocal_dialog->show_all(); } /*###################### |
