- /* Save document to temp filename */
- local_uri = g_filename_to_uri (tmp_filename, NULL, NULL);
-
- ev_document_doc_mutex_lock ();
- ev_document_save (ev_window->priv->document, local_uri, &error);
- ev_document_doc_mutex_unlock ();
-
- close (fd);
-
- if (!error) {
- /* If original document was compressed,
- * compress it again before saving
- */
- if (g_object_get_data (G_OBJECT (ev_window->priv->document),
- "uri-uncompressed")) {
- EvCompressionType ctype = EV_COMPRESSION_NONE;
- const gchar *ext;
- gchar *uri_comp;
-
- ext = g_strrstr (ev_window->priv->uri, ".gz");
- if (ext && g_ascii_strcasecmp (ext, ".gz") == 0)
- ctype = EV_COMPRESSION_GZIP;
-
- ext = g_strrstr (ev_window->priv->uri, ".bz2");
- if (ext && g_ascii_strcasecmp (ext, ".bz2") == 0)
- ctype = EV_COMPRESSION_BZIP2;
-
- uri_comp = ev_file_compress (local_uri, ctype, &error);
- g_free (local_uri);
- ev_tmp_filename_unlink (tmp_filename);
-
- if (!uri_comp || error) {
- local_uri = NULL;
- } else {
- local_uri = uri_comp;
- }
- }
- }
-
- g_free (tmp_filename);
-
- if (error) {
- gchar *msg;