After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705599 - Automatically extract downloaded archives
Automatically extract downloaded archives
Status: RESOLVED OBSOLETE
Product: epiphany
Classification: Core
Component: Downloads
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks: 708577
 
 
Reported: 2013-08-07 08:00 UTC by Ting-Wei Lan
Modified: 2018-08-03 20:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0000-Add-some-extensions-of-compressed-files.patch (828 bytes, patch)
2013-08-07 08:00 UTC, Ting-Wei Lan
none Details | Review
0001-Add-gsettings-key-extract-downloaded-archives.patch (3.85 KB, patch)
2013-08-07 08:01 UTC, Ting-Wei Lan
none Details | Review
0002-Add-libarchive-to-dependencies.patch (1.32 KB, patch)
2013-08-07 08:01 UTC, Ting-Wei Lan
none Details | Review
0004-Add-a-checkbutton-to-toggle-the-automatical-extracti.patch (2.81 KB, patch)
2013-08-07 08:02 UTC, Ting-Wei Lan
none Details | Review
0011-Integrate-autoarchive-functions-into-Epiphany-downlo.patch (14.63 KB, patch)
2013-08-07 08:02 UTC, Ting-Wei Lan
none Details | Review
0013-Show-error-message-in-download-panel-if-extraction-f.patch (1.51 KB, patch)
2013-08-07 08:03 UTC, Ting-Wei Lan
none Details | Review
0015-Click-Show-in-folder-when-extracting-should-not-dest.patch (1.46 KB, patch)
2013-08-07 08:03 UTC, Ting-Wei Lan
none Details | Review
0014-Add-seek-and-skip-callback-functions-for-libarchive.patch (791 bytes, patch)
2013-08-07 08:03 UTC, Ting-Wei Lan
none Details | Review
0015-Click-Show-in-folder-when-extracting-should-not-dest.patch (1.46 KB, patch)
2013-08-07 08:04 UTC, Ting-Wei Lan
none Details | Review
0016-Allow-users-to-click-Open-if-extraction-has-failed.patch (2.11 KB, patch)
2013-08-07 08:04 UTC, Ting-Wei Lan
none Details | Review
0017-Remove-all-things-related-to-autoarchive-which-becom.patch (1.76 KB, patch)
2013-08-07 08:04 UTC, Ting-Wei Lan
none Details | Review
0018-Use-new-libgnome-autoar-API.patch (761 bytes, patch)
2013-08-07 08:05 UTC, Ting-Wei Lan
none Details | Review
0019-Add-cancellable-support-to-download-panel-when-extra.patch (9.73 KB, patch)
2013-08-07 08:05 UTC, Ting-Wei Lan
none Details | Review
Do not assume downloaded files are saved in ephy_file_get_downloads_dir (). (1.25 KB, patch)
2013-10-13 14:07 UTC, Ting-Wei Lan
none Details | Review
Add archives extraction support using gnome-autoar (21.68 KB, patch)
2014-08-11 15:14 UTC, Ting-Wei Lan
reviewed Details | Review

Description Ting-Wei Lan 2013-08-07 08:00:18 UTC
This is part of Google Summer of Code 2013 project.
https://wiki.gnome.org/SummerOfCode2013/Projects/TingWeiLan_GnomeArchives

If downloaded files are archives, Epiphany will try to extract the archives into a single file or a single top-level directory. This feature can be disabled by users in the preferences dialog.

In order to make this feature shared between applications, I have written a shared library called libgnome-autoar, which is available at:
http://www.tfcis.org/~lantw44/cgit/cgit.cgi/gsoc2013-libgnome-autoar/

Patches in this bug report will cause Epiphany to depend on libgnome-autoar.
Comment 1 Ting-Wei Lan 2013-08-07 08:00:57 UTC
Created attachment 251019 [details] [review]
0000-Add-some-extensions-of-compressed-files.patch
Comment 2 Ting-Wei Lan 2013-08-07 08:01:25 UTC
Created attachment 251020 [details] [review]
0001-Add-gsettings-key-extract-downloaded-archives.patch
Comment 3 Ting-Wei Lan 2013-08-07 08:01:48 UTC
Created attachment 251022 [details] [review]
0002-Add-libarchive-to-dependencies.patch
Comment 4 Ting-Wei Lan 2013-08-07 08:02:17 UTC
Created attachment 251023 [details] [review]
0004-Add-a-checkbutton-to-toggle-the-automatical-extracti.patch
Comment 5 Ting-Wei Lan 2013-08-07 08:02:32 UTC
Created attachment 251024 [details] [review]
0011-Integrate-autoarchive-functions-into-Epiphany-downlo.patch
Comment 6 Ting-Wei Lan 2013-08-07 08:03:08 UTC
Created attachment 251025 [details] [review]
0013-Show-error-message-in-download-panel-if-extraction-f.patch
Comment 7 Ting-Wei Lan 2013-08-07 08:03:26 UTC
Created attachment 251026 [details] [review]
0015-Click-Show-in-folder-when-extracting-should-not-dest.patch
Comment 8 Ting-Wei Lan 2013-08-07 08:03:47 UTC
Created attachment 251027 [details] [review]
0014-Add-seek-and-skip-callback-functions-for-libarchive.patch
Comment 9 Ting-Wei Lan 2013-08-07 08:04:10 UTC
Created attachment 251028 [details] [review]
0015-Click-Show-in-folder-when-extracting-should-not-dest.patch
Comment 10 Ting-Wei Lan 2013-08-07 08:04:32 UTC
Created attachment 251029 [details] [review]
0016-Allow-users-to-click-Open-if-extraction-has-failed.patch
Comment 11 Ting-Wei Lan 2013-08-07 08:04:50 UTC
Created attachment 251030 [details] [review]
0017-Remove-all-things-related-to-autoarchive-which-becom.patch
Comment 12 Ting-Wei Lan 2013-08-07 08:05:15 UTC
Created attachment 251031 [details] [review]
0018-Use-new-libgnome-autoar-API.patch
Comment 13 Ting-Wei Lan 2013-08-07 08:05:31 UTC
Created attachment 251032 [details] [review]
0019-Add-cancellable-support-to-download-panel-when-extra.patch
Comment 14 Claudio Saavedra 2013-08-19 13:52:39 UTC
+apinheiro from the release team.

Without reviewing this yet, a few comments on its possibility for integration.

(In reply to comment #0)
> In order to make this feature shared between applications, I have written a
> shared library called libgnome-autoar, which is available at:
> http://www.tfcis.org/~lantw44/cgit/cgit.cgi/gsoc2013-libgnome-autoar/

I think you should be hosting your library in git.gnome.org if we're going to make the applications depend on it. Talk with your mentor about this.
 
> Patches in this bug report will cause Epiphany to depend on libgnome-autoar.

I am not sure what's the procedure nowadays to add new dependencies. Probably we need to propose this as a new feature for 3.12 in desktop-devel-list, and then the dependency would need to get some sort of approval. Only then we can make epiphany depend on it.
Comment 15 Claudio Saavedra 2013-08-19 13:59:01 UTC
(In reply to comment #14)
> +apinheiro from the release team.
> 
> I think you should be hosting your library in git.gnome.org if we're going to
> make the applications depend on it. Talk with your mentor about this.

Another important point is that the library should remain maintained through time. Are you intending to maintain it after the GSoC project is over?
Comment 16 Ting-Wei Lan 2013-08-29 03:13:04 UTC
(In reply to comment #14)
> Without reviewing this yet, a few comments on its possibility for integration.
> 
> (In reply to comment #0)
> > In order to make this feature shared between applications, I have written a
> > shared library called libgnome-autoar, which is available at:
> > http://www.tfcis.org/~lantw44/cgit/cgit.cgi/gsoc2013-libgnome-autoar/
> 
> I think you should be hosting your library in git.gnome.org if we're going to
> make the applications depend on it. Talk with your mentor about this.
> 

gnome-autoar is hosted in git.gnome.org now.
https://git.gnome.org/gnome-autoar/
Comment 17 Ting-Wei Lan 2013-10-13 14:07:07 UTC
Created attachment 257171 [details] [review]
Do not assume downloaded files are saved in ephy_file_get_downloads_dir ().
Comment 18 Ting-Wei Lan 2014-01-07 14:39:24 UTC
Some patches have to be modified because they conflict with the master branch.
Comment 19 Michael Catanzaro 2014-07-18 19:19:17 UTC
Hey Ting-Wei, who was your GSoC mentor?
Comment 20 Ting-Wei Lan 2014-08-11 14:55:56 UTC
My GSoC mentor was Cosimo Cecchi.
Comment 21 Ting-Wei Lan 2014-08-11 15:14:58 UTC
Created attachment 283113 [details] [review]
Add archives extraction support using gnome-autoar

I have merged all old patches into this single patch file. It should work on current master branch.
Comment 22 Michael Catanzaro 2014-08-16 12:58:45 UTC
(In reply to comment #14)
> I am not sure what's the procedure nowadays to add new dependencies. Probably
> we need to propose this as a new feature for 3.12 in desktop-devel-list, and
> then the dependency would need to get some sort of approval. Only then we can
> make epiphany depend on it.

We don't need any permission as long as it's in gnome-suites-core or gnome-suites-core-deps, but it's not so we can't use it. So the next step would be to get this library into the GNOME modulesets.

I don't want to hide my disappointment that yet another GSoC project has been basically left to waste. This is a big recurring problem.
Comment 23 Michael Catanzaro 2015-06-16 14:01:23 UTC
Review of attachment 283113 [details] [review]:

Hm, this has been on the unreviewed patches list for too long. Sorry. :(

First of all, there are some issues with gnome-autoar that would need to be addressed before we merge this:

* Most importantly, it looks like gnome-autoar has never been released, so first step is to make a release. If you haven't done this before, maybe your GSoC mentor can help.
* Since gnome-autoar is not in any GNOME modulesets, we can't depend on it. Please first work with the release team to get gnome-autoar accepted into gnome-suites-core or gnome-suites-core-deps.
* Please also get some gtkdoc up on developer.gnome.org. (I'm not sure what the process is for this.)

Next, please get a GNOME designer to approve the design in this bug (the new preference and the automatic extraction user experience). I will do a preliminary review of just the code; probably one of the maintainers will want to do so as well.

::: embed/ephy-download.c
@@ +439,3 @@
+ **/
+AutoarExtract *
+ephy_download_get_autoar_extract (EphyDownload *download)

Is this useful anywhere except the signal handler for EphyDownload::archive? Can we just pass it as a parameter for that signal instead? Then we wouldn't need it in the private struct.

@@ +599,3 @@
+
+  settings = g_settings_new (AUTOAR_PREF_DEFAULT_GSCHEMA_ID);
+  arpref = autoar_pref_new_with_gsettings (settings);

I am not sure about this autoar API... wouldn't it be good to have a simple autoar_pref_new() that uses the right gsettings schema by default?

@@ +605,3 @@
+
+  if (!autoar_pref_check_file_name_file (arpref, destination) &&
+      !autoar_pref_check_mime_type_file (arpref, destination)) {

Also not sure about this API. It feels like this is code that will be the same in every app that uses gnome-autoar, doesn't it? Maybe there should be a function to Do The Right Thing:

autoar_is_archive (destination);

And that would create an AutoarPref using the right gsettings schema, and return true if autoar_pref_check_file_name_file || autoar_pref_check_mime_type_file checks out.

@@ +613,3 @@
+  }
+
+  g_assert ((destination_dir = g_file_get_parent (destination)) != NULL);

Don't put important code inside a g_assert, since if you put -DG_DISABLE_ASSERT in CFLAGS then this code will disappear.

@@ +623,3 @@
+  g_signal_emit_by_name (download, "archive", cancellable);
+
+  autoar_extract_start_async (arextract, cancellable);

How do we know when it has finished? Shouldn't this require a GAsyncReadyCallback?

@@ +631,3 @@
+  g_object_unref (destination_dir);
+
+  return;

Don't put an empty return at the end of the void functions.

@@ +653,3 @@
+    g_object_unref (priv->arextract);
+    priv->arextract = NULL;
+  }

This entire conditional can be replaced with g_clear_object() (it's null-safe).  (But I think you can just get rid of priv->arextract, as mentioned before.)

@@ +880,3 @@
 
+  if (g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_EXTRACT_DOWNLOADED_ARCHIVES))
+    ephy_download_do_extract_archive (download);

But since the extraction is asynchronous, it's not going to have completed before we call ephy_download_do_download_action(), right? Is it right to run that code in this case?

::: embed/ephy-download.h
@@ +61,3 @@
                                char *suggested_filename);
   void (* completed)  (EphyDownload *download);
+  void (* archive)    (EphyDownload *download);

I guess "archive" can be used as a verb, but it's not immediately clear what this signal is for. Hopefully you can find a better name for it. "archive_extraction_started" would work, but that's a bit verbose....

::: lib/widgets/ephy-download-widget.c
@@ +340,2 @@
 static void
+widget_archive_decide_cb (AutoarExtract *arextract,

My nit for this function is just that it's feeling quite cramped. Try adding blank lines after the variable declarations, after the LOG statements, and before the g_frees.

@@ +369,3 @@
+
+  progress = completed_size * 100 / widget->priv->total_size;
+  label = g_strdup_printf (_("Extracting: %u%%"), progress);

Needs a translator comment; please explain to the translator what the %u%% does, or that is sure to be mangled in some translation -> crash maybe.

@@ +382,3 @@
+  char *errmsg;
+
+  errmsg = g_strdup_printf (_("Finished (extraction error: %s)"), error->message);

Please add a comment above, for the translators. I would ask a designer about using "Finished" for an error.

@@ +389,3 @@
+
+  g_object_unref (widget->priv->arextract);
+  widget->priv->arextract = NULL;

g_clear_object()

@@ +397,3 @@
+{
+  revert_download_icon_and_text (widget);
+  update_download_label_and_tooltip (widget, _("Finished (extraction cancelled)"));

Needs a translator comment.

@@ +408,3 @@
+  update_download_label_and_tooltip (widget, _("Finished"));
+  g_object_unref (widget->priv->arextract);
+  widget->priv->arextract = NULL;

g_clear_object()

@@ +418,3 @@
+  AutoarExtract *arextract = ephy_download_get_autoar_extract (ephy_download);
+  if (widget->priv->arextract != NULL)
+    g_object_unref (widget->priv->arextract);

g_clear_object()

@@ +421,3 @@
+  widget->priv->arextract = g_object_ref (arextract);
+  if (widget->priv->arcancel != NULL)
+    g_object_unref (widget->priv->arcancel);

g_clear_object()

@@ +428,3 @@
+  g_signal_connect (arextract, "cancelled", G_CALLBACK (widget_archive_cancelled_cb), widget);
+  g_signal_connect (arextract, "completed", G_CALLBACK (widget_archive_completed_cb), widget);
+  update_download_label_and_tooltip (widget, _("Preparing for extraction…"));

Translator comment

@@ +443,3 @@
   if (ephy_download_do_download_action (widget->priv->download,
+                                        EPHY_DOWNLOAD_ACTION_BROWSE_TO) &&
+     (widget->priv->arextract == NULL))

Looks like the whitespace is messed up herer.

@@ +654,3 @@
+    g_signal_handlers_disconnect_by_func (arextract, widget_archive_completed_cb, widget);
+    g_object_unref (widget->priv->arextract);
+    widget->priv->arextract = NULL;

Use g_clear_object() here as well.

@@ +659,3 @@
+  if (widget->priv->arcancel != NULL) {
+    g_object_unref (widget->priv->arcancel);
+    widget->priv->arcancel = NULL;

And here (replace the entire conditional).
Comment 24 GNOME Infrastructure Team 2018-08-03 20:01:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/epiphany/issues/202.