From 7fc63c1160d6c07d301ad7b2ec95e597fdbdbf6b Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 13 Mar 2012 16:48:44 -0700 Subject: Patch for multi-import by heisenbug from lp:203070 (bzr r11081) --- src/file.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 8dac0f575..dbf8fc7d4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1148,6 +1148,9 @@ sp_file_import(Gtk::Window &parentWindow) return; } + typedef std::vector pathnames; + pathnames flist(importDialogInstance->getFilenames()); + // Get file name and extension type Glib::ustring fileName = importDialogInstance->getFilename(); Inkscape::Extension::Extension *selection = importDialogInstance->getSelectionType(); @@ -1155,16 +1158,39 @@ sp_file_import(Gtk::Window &parentWindow) delete importDialogInstance; importDialogInstance = NULL; - if (fileName.size() > 0) { + //# Iterate through filenames if more than 1 + if (flist.size() > 1) + { + for (unsigned int i = 0; i < flist.size(); i++) + { + fileName = flist[i]; + + Glib::ustring newFileName = Glib::filename_to_utf8(fileName); + if (!newFileName.empty()) + fileName = newFileName; + else + g_warning("ERROR CONVERTING IMPORT FILENAME TO UTF-8"); + +#ifdef INK_DUMP_FILENAME_CONV + g_message("Importing File %s\n", fileName.c_str()); +#endif + file_import(doc, fileName, selection); + } + + return; + } + + + if (!fileName.empty()) { Glib::ustring newFileName = Glib::filename_to_utf8(fileName); - if ( newFileName.size() > 0) + if (!newFileName.empty()) fileName = newFileName; else - g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" ); + g_warning("ERROR CONVERTING IMPORT FILENAME TO UTF-8"); - import_path = Glib::path_get_dirname (fileName); + import_path = Glib::path_get_dirname(fileName); import_path.append(G_DIR_SEPARATOR_S); prefs->setString("/dialogs/import/path", import_path); -- cgit v1.2.3