[epiphany] web-view: Save as MHTML by default



commit 77626e20a6e4c312761e7f75184e26ae17a65552
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Jul 23 09:22:07 2017 -0500

    web-view: Save as MHTML by default
    
    Users almost always want MHTML rather than HTML of just the main
    resource only, so default to that. This fixes the weird case where the
    save as file chooser strangely switches to saving only the main resource
    if you make any change to the file extension. Now that will only happen
    if the file extension is set to .html.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785298

 embed/ephy-web-view.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 1d9eb2f..a511060 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3205,6 +3205,7 @@ ephy_web_view_save_main_resource_cb (GFile         *file,
                                 (GAsyncReadyCallback)web_resource_get_data_cb,
                                 output_stream);
 }
+
 /**
  * ephy_web_view_save:
  * @view: an #EphyWebView
@@ -3222,15 +3223,16 @@ ephy_web_view_save (EphyWebView *view, const char *uri)
 
   file = g_file_new_for_uri (uri);
 
-  if (g_str_has_suffix (uri, ".mhtml"))
-    webkit_web_view_save_to_file (WEBKIT_WEB_VIEW (view), file, WEBKIT_SAVE_MODE_MHTML,
-                                  NULL, NULL, NULL);
-  else
+  if (g_str_has_suffix (uri, ".html")) {
     g_file_replace_async (file, NULL, FALSE,
                           G_FILE_CREATE_REPLACE_DESTINATION | G_FILE_CREATE_PRIVATE,
                           G_PRIORITY_DEFAULT, NULL,
                           (GAsyncReadyCallback)ephy_web_view_save_main_resource_cb,
                           view);
+  } else {
+    webkit_web_view_save_to_file (WEBKIT_WEB_VIEW (view), file, WEBKIT_SAVE_MODE_MHTML,
+                                  NULL, NULL, NULL);
+  }
   g_object_unref (file);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]