diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/doxygen-main.dox | 5 | ||||
| -rw-r--r-- | src/extension/dbus/document-interface.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/svg.cpp | 83 | ||||
| -rw-r--r-- | src/file.cpp | 89 | ||||
| -rw-r--r-- | src/file.h | 7 | ||||
| -rw-r--r-- | src/ui/dialog/export.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-gtkmm.cpp | 50 |
7 files changed, 40 insertions, 209 deletions
diff --git a/src/doxygen-main.dox b/src/doxygen-main.dox index faa11cc9e..c714c2cbf 100644 --- a/src/doxygen-main.dox +++ b/src/doxygen-main.dox @@ -178,13 +178,8 @@ namespace XML {} * <a href="http://developer.gnome.org/doc/API/2.0/gobject/index.html">GObject</a> * <a href="http://developer.gnome.org/doc/API/2.0/atk/index.html">atk</a> * <a href="http://developer.gnome.org/doc/API/2.0/pango/index.html">pango</a> - * <a href="http://developer.gnome.org/doc/API/2.0/ORBit/index.html">ORBit</a> - * <a href="http://developer.gnome.org/doc/API/2.0/libbonobo/index.html">bonobo</a> - * <a href="http://developer.gnome.org/doc/API/2.0/bonobo-activation/index.html">bonobo-activation</a> * <a href="http://xmlsoft.org/XSLT/html/libxslt-lib.html#LIBXSLT-LIB">libxslt</a> * <a href="http://xmlsoft.org/html/index.html">libxml2</a> - * Legacy: - * <a href="http://developer.gnome.org/doc/API/2.0/gnome-vfs-2.0/">GnomeVFS</a> * * \subsection stdlinks External standards documentation * diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 435e347d0..513ec2f5c 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -968,10 +968,7 @@ document_interface_save_as (DocumentInterface *doc_interface, { // FIXME: Isn't there a verb we can use for this instead? SPDocument * doc = doc_interface->target.getDocument(); - #ifdef WITH_GNOME_VFS - const Glib::ustring file(filename); - return file_save_remote(doc, file, NULL, TRUE, TRUE); - #endif + if (!doc || strlen(filename)<1) { //Safety check return false; } diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 9cde90519..b05a7c19b 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -17,21 +17,20 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif + +#include <vector> +#include <giomm/file.h> + #include "sp-object.h" #include "svg.h" #include "file.h" #include "extension/system.h" #include "extension/output.h" -#include <vector> #include "xml/attribute-record.h" #include "xml/simple-document.h" #include "sp-root.h" #include "document.h" -#ifdef WITH_GNOME_VFS -# include <libgnomevfs/gnome-vfs.h> -#endif - namespace Inkscape { namespace Extension { namespace Internal { @@ -157,80 +156,42 @@ Svg::init(void) "</output>\n" "</inkscape-extension>", new Svg()); -#ifdef WITH_GNOME_VFS - gnome_vfs_init(); -#endif - - return; } -#ifdef WITH_GNOME_VFS -#define BUF_SIZE 8192 - -static gchar * -_load_uri (const gchar *uri) -{ - GnomeVFSHandle *handle = NULL; - GnomeVFSFileSize bytes_read; - - gsize bytesRead = 0; - gsize bytesWritten = 0; - GError* error = NULL; - gchar* uri_local = g_filename_from_utf8( uri, -1, &bytesRead, &bytesWritten, &error); - - if ( uri_local == NULL ) { - g_warning( "Error converting filename to locale encoding."); - } - - GnomeVFSResult result = gnome_vfs_open (&handle, uri_local, GNOME_VFS_OPEN_READ); - - if (result != GNOME_VFS_OK) { - g_warning("%s", gnome_vfs_result_to_string(result)); - } - - std::vector<gchar> doc; - while (result == GNOME_VFS_OK) { - gchar buffer[BUF_SIZE]; - result = gnome_vfs_read (handle, buffer, BUF_SIZE, &bytes_read); - doc.insert(doc.end(), buffer, buffer+bytes_read); - } - - return g_strndup(&doc[0], doc.size()); -} -#endif - - /** \return A new document just for you! \brief This function takes in a filename of a SVG document and turns it into a SPDocument. \param mod Module to use - \param uri The path to the file (UTF-8) + \param uri The path or URI to the file (UTF-8) This function is really simple, it just calls sp_document_new... */ SPDocument * Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) { -#ifdef WITH_GNOME_VFS - if (!gnome_vfs_initialized() || gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) { - // Use built-in loader instead of VFS for this - return SPDocument::createNewDoc(uri, TRUE); - } - gchar * buffer = _load_uri(uri); - if (buffer == NULL) { - g_warning("Error: Could not open file '%s' with VFS\n", uri); - return NULL; + auto file = Gio::File::create_for_uri(uri); + const auto path = file->get_path(); + + if (!file->get_uri_scheme().empty()) { + if (path.empty()) { + try { + char *contents; + gsize length; + file->load_contents(contents, length); + return SPDocument::createNewDocFromMem(contents, length, 1); + } catch (Gio::Error &e) { + g_warning("Could not load contents of non-local URI %s\n", uri); + return NULL; + } + } else { + uri = path.c_str(); + } } - SPDocument * doc = SPDocument::createNewDocFromMem(buffer, strlen(buffer), 1); - g_free(buffer); - return doc; -#else return SPDocument::createNewDoc(uri, TRUE); -#endif } /** diff --git a/src/file.cpp b/src/file.cpp index 549ed7d6e..320016a41 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -71,10 +71,6 @@ using Inkscape::DocumentUndo; using Inkscape::IO::Resource::TEMPLATES; using Inkscape::IO::Resource::USER; -#ifdef WITH_GNOME_VFS -# include <libgnomevfs/gnome-vfs.h> -#endif - #ifdef WITH_DBUS #include "extension/dbus/dbus-init.h" #endif @@ -687,91 +683,6 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, return true; } -/* - * Used only for remote saving using VFS and a specific uri. Gets the file at the /tmp. - */ -bool -file_save_remote(SPDocument */*doc*/, - #ifdef WITH_GNOME_VFS - const Glib::ustring &uri, - #else - const Glib::ustring &/*uri*/, - #endif - Inkscape::Extension::Extension */*key*/, bool /*saveas*/, bool /*official*/) -{ -#ifdef WITH_GNOME_VFS - -#define BUF_SIZE 8192 - gnome_vfs_init(); - - GnomeVFSHandle *from_handle = NULL; - GnomeVFSHandle *to_handle = NULL; - GnomeVFSFileSize bytes_read; - GnomeVFSFileSize bytes_written; - GnomeVFSResult result; - guint8 buffer[8192]; - - gchar* uri_local = g_filename_from_utf8( uri.c_str(), -1, NULL, NULL, NULL); - - if ( uri_local == NULL ) { - g_warning( "Error converting filename to locale encoding."); - } - - // Gets the temp file name. - Glib::ustring fileName = Glib::get_tmp_dir (); - fileName.append(G_DIR_SEPARATOR_S); - fileName.append((gnome_vfs_uri_extract_short_name(gnome_vfs_uri_new(uri_local)))); - - // Open the temp file to send. - result = gnome_vfs_open (&from_handle, fileName.c_str(), GNOME_VFS_OPEN_READ); - - if (result != GNOME_VFS_OK) { - g_warning("Could not find the temp saving."); - return false; - } - - gnome_vfs_create (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE, FALSE, GNOME_VFS_PERM_USER_ALL); - result = gnome_vfs_open (&to_handle, uri_local, GNOME_VFS_OPEN_WRITE); - - if (result != GNOME_VFS_OK) { - g_warning("file creating: %s", gnome_vfs_result_to_string(result)); - return false; - } - - while (1) { - - result = gnome_vfs_read (from_handle, buffer, 8192, &bytes_read); - - if ((result == GNOME_VFS_ERROR_EOF) &&(!bytes_read)){ - gnome_vfs_close (from_handle); - gnome_vfs_close (to_handle); - return true; - } - - if (result != GNOME_VFS_OK) { - g_warning("%s", gnome_vfs_result_to_string(result)); - return false; - } - result = gnome_vfs_write (to_handle, buffer, bytes_read, &bytes_written); - if (result != GNOME_VFS_OK) { - g_warning("%s", gnome_vfs_result_to_string(result)); - return false; - } - - - if (bytes_read != bytes_written){ - return false; - } - - } - return true; -#else - // in case we do not have GNOME_VFS - return false; -#endif - -} - /** * Check if a string ends with another string. diff --git a/src/file.h b/src/file.h index 9cd22d744..c86f065d3 100644 --- a/src/file.h +++ b/src/file.h @@ -86,13 +86,6 @@ void sp_file_revert_dialog (); ## S A V E ######################*/ -/* - * Added to make only the remote savings. - */ - -bool file_save_remote(SPDocument *doc, const Glib::ustring &uri, - Inkscape::Extension::Extension *key, bool saveas, bool official); - /** * */ diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 56f3a29c0..d878b50a4 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -27,10 +27,6 @@ #include <gtkmm/grid.h> #include <gtkmm/spinbutton.h> -#ifdef WITH_GNOME_VFS -# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized -#endif - #include <glibmm/i18n.h> #include <glibmm/miscutils.h> @@ -1300,11 +1296,7 @@ void Export::onBrowse () _("_Save"), GTK_RESPONSE_ACCEPT, NULL ); -#ifdef WITH_GNOME_VFS - if (gnome_vfs_initialized()) { - gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fs), false); - } -#endif + gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(fs), false); sp_transientize (fs); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index b69e9ce97..64f6c98c6 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -31,10 +31,6 @@ #include "path-prefix.h" #include "preferences.h" -#ifdef WITH_GNOME_VFS -#include <libgnomevfs/gnome-vfs.h> -#endif - #include <gtkmm/expander.h> #include <glibmm/convert.h> @@ -663,11 +659,9 @@ void FileDialogBaseGtk::_updatePreviewCallback() Glib::ustring fileName = get_preview_filename(); bool enabled = previewCheckbox.get_active(); -#ifdef WITH_GNOME_VFS - if (fileName.empty() && gnome_vfs_initialized()) { + if (fileName.empty()) { fileName = get_preview_uri(); } -#endif if (enabled && !fileName.empty()) { svgPreview.set(fileName, _dialogType); @@ -698,11 +692,7 @@ FileOpenDialogImplGtk::FileOpenDialogImplGtk(Gtk::Window &parentWindow, const Gl set_select_multiple(true); } -#ifdef WITH_GNOME_VFS - if (gnome_vfs_initialized()) { - set_local_only(false); - } -#endif + set_local_only(false); /* Initalize to Autodetect */ extension = NULL; @@ -883,10 +873,11 @@ bool FileOpenDialogImplGtk::show() extension = extensionMap[gtk_file_filter_get_name(filter)]; } myFilename = get_filename(); -#ifdef WITH_GNOME_VFS - if (myFilename.empty() && gnome_vfs_initialized()) + + if (myFilename.empty()) { myFilename = get_uri(); -#endif + } + cleanup(true); return true; } else { @@ -928,10 +919,10 @@ std::vector<Glib::ustring> FileOpenDialogImplGtk::getFilenames() for (auto it : result_tmp) result.push_back(it); -#ifdef WITH_GNOME_VFS - if (result.empty() && gnome_vfs_initialized()) + if (result.empty()) { result = get_uris(); -#endif + } + return result; } @@ -963,11 +954,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk(Gtk::Window &parentWindow, const Gl /* One file at a time */ set_select_multiple(false); -#ifdef WITH_GNOME_VFS - if (gnome_vfs_initialized()) { - set_local_only(false); - } -#endif + set_local_only(false); /* Initalize to Autodetect */ extension = NULL; @@ -1310,11 +1297,11 @@ void FileSaveDialogImplGtk::updateNameAndExtension() { // Pick up any changes the user has typed in. Glib::ustring tmp = get_filename(); -#ifdef WITH_GNOME_VFS - if (tmp.empty() && gnome_vfs_initialized()) { + + if (tmp.empty()) { tmp = get_uri(); } -#endif + if (!tmp.empty()) { myFilename = tmp; } @@ -1449,11 +1436,7 @@ FileExportDialogImpl::FileExportDialogImpl(Gtk::Window &parentWindow, const Glib /* One file at a time */ set_select_multiple(false); -#ifdef WITH_GNOME_VFS - if (gnome_vfs_initialized()) { - set_local_only(false); - } -#endif + set_local_only(false); /* Initalize to Autodetect */ extension = NULL; @@ -1634,11 +1617,10 @@ bool FileExportDialogImpl::show() extension = type.extension; } myFilename = get_filename(); -#ifdef WITH_GNOME_VFS - if (myFilename.empty() && gnome_vfs_initialized()) { + + if (myFilename.empty()) { myFilename = get_uri(); } -#endif /* |
