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 740978 - Blacklist "open in archive manager" from menus
Blacklist "open in archive manager" from menus
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: books
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Books Maintainers
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-12-01 14:02 UTC by Bastien Nocera
Modified: 2015-03-25 13:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
application: Use recommended app as the external viewer (1.11 KB, patch)
2014-12-16 12:04 UTC, Bastien Nocera
needs-work Details | Review
application: Use recommended app as the external viewer (1.33 KB, patch)
2014-12-16 13:33 UTC, Bastien Nocera
needs-work Details | Review
application: Use recommended app as the external viewer (1.25 KB, patch)
2014-12-16 14:11 UTC, Bastien Nocera
committed Details | Review
application: Don't open docs without a recommended app (1.23 KB, patch)
2014-12-16 14:11 UTC, Bastien Nocera
accepted-commit_now Details | Review
documents: Fix opening docs with broken defaults (2.71 KB, patch)
2014-12-19 19:18 UTC, Bastien Nocera
needs-work Details | Review
documents: Fix opening docs with broken defaults (2.81 KB, patch)
2014-12-29 16:24 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-12-01 14:02:09 UTC
This is a useless thing to do with epub and CBZ/CBR files.
Comment 1 Bastien Nocera 2014-12-16 12:04:12 UTC
Created attachment 292803 [details] [review]
application: Use recommended app as the external viewer

This avoids ZIP-based documents from being opened with the Archive
Manager. This is especially important for ePubs and CBZ files.
Comment 2 Debarshi Ray 2014-12-16 13:30:48 UTC
Review of attachment 292803 [details] [review]:

::: src/documents.js
@@ +662,3 @@
+            apps = Gio.app_info_get_recommended_for_type (this.mimeType);
+            if (apps.length > 0)
+                defaultApp = apps[0];

Would be good to retain the app_info_supports_uris check.
Comment 3 Bastien Nocera 2014-12-16 13:33:39 UTC
Created attachment 292830 [details] [review]
application: Use recommended app as the external viewer

This avoids ZIP-based documents from being opened with the Archive
Manager. This is especially important for ePubs and CBZ files.
Comment 4 Debarshi Ray 2014-12-16 13:45:20 UTC
Review of attachment 292830 [details] [review]:

::: src/documents.js
@@ +661,3 @@
+        if (this.mimeType) {
+            let apps = Gio.app_info_get_recommended_for_type (this.mimeType);
+            if (apps.length > 0) {

The if can be dropped because the for loop below makes it redundant.
Comment 5 Bastien Nocera 2014-12-16 14:11:35 UTC
Created attachment 292832 [details] [review]
application: Use recommended app as the external viewer

This avoids ZIP-based documents from being opened with the Archive
Manager. This is especially important for ePubs and CBZ files.
Comment 6 Bastien Nocera 2014-12-16 14:11:41 UTC
Created attachment 292833 [details] [review]
application: Don't open docs without a recommended app

When a document type doesn't have a recommended application (or no
external application at all), don't try to force open it.

This prevents selected but unhandled files from being opened if one
of the selected files can be opened (eg. one ePub + one PDF should only
open the PDF file, and ePub shouldn't get opened in file-roller).
Comment 7 Debarshi Ray 2014-12-19 17:12:59 UTC
Review of attachment 292832 [details] [review]:

Perfect. Minor nitpick: the subject of the commit message should probably have "documents: " as prefix instead of "application: ".
Comment 8 Debarshi Ray 2014-12-19 18:32:56 UTC
Review of attachment 292833 [details] [review]:

Looks good to me, apart from the subject that should probably be prefixed with "selections: " instead of "application: ".

One thing that we are missing is removing the "open" entry from the gear / hamburger menu if there is no default application.

::: src/selections.js
@@ +894,3 @@
                 let doc = Application.documentManager.getItemById(urn);
+                if (doc.defaultAppName)
+                    doc.open(widget.get_screen(), Gtk.get_current_event_time());

Maybe we should move the check inside the open method? Just a thought. Not a blocker.
Comment 9 Bastien Nocera 2014-12-19 18:43:38 UTC
(In reply to comment #8)
> Review of attachment 292833 [details] [review]:
> 
> Looks good to me, apart from the subject that should probably be prefixed with
> "selections: " instead of "application: ".

Sure.

> One thing that we are missing is removing the "open" entry from the gear /
> hamburger menu if there is no default application.

I think that the code in _getPreviewMenu() (preview.js) already does that. I don't think we have any documents of that type for which we can do previews but no external apps handle them, do we?

> ::: src/selections.js
> @@ +894,3 @@
>                  let doc = Application.documentManager.getItemById(urn);
> +                if (doc.defaultAppName)
> +                    doc.open(widget.get_screen(),
> Gtk.get_current_event_time());
> 
> Maybe we should move the check inside the open method? Just a thought. Not a
> blocker.

I've done that now. And changed the prefix to documents for the commit subject.
Comment 10 Debarshi Ray 2014-12-19 18:56:48 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > One thing that we are missing is removing the "open" entry from the gear /
> > hamburger menu if there is no default application.
> 
> I think that the code in _getPreviewMenu() (preview.js) already does that. I
> don't think we have any documents of that type for which we can do previews but
> no external apps handle them, do we?

Yes, ignore me. I was thinking of epubs, but then we can't even preview them, so that is OK.

One thing though, even if the button and menu entry says "Open with Document Viewer" for CBZs, it still opens in file-roller if you actually click it. We need to fix the open method.
Comment 11 Bastien Nocera 2014-12-19 19:18:40 UTC
Created attachment 293086 [details] [review]
documents: Fix opening docs with broken defaults

For local and OwnCloud documents, remember the application with which
we'll be opening the document, and which matches the label we were already
setting.

For other sources, continue using Gtk.show_uri()
Comment 12 Cosimo Cecchi 2014-12-24 09:13:00 UTC
Review of attachment 293086 [details] [review]:

::: src/documents.js
@@ +590,3 @@
             return;
 
+        //Without a defaultApp, launch in the web browser,

Please add a space after "//"

@@ +594,2 @@
         try {
+            if (!this.defaultApp)

Can you flip this so that the positive test comes first?

@@ +940,1 @@
             this.defaultAppName = defaultApp.get_name();

Should be this.defaultApp here too
Comment 13 Bastien Nocera 2014-12-29 16:24:20 UTC
Created attachment 293446 [details] [review]
documents: Fix opening docs with broken defaults

For local and OwnCloud documents, remember the application with which
we'll be opening the document, and which matches the label we were already
setting.

For other sources, continue using Gtk.show_uri()
Comment 14 Debarshi Ray 2015-01-15 14:27:11 UTC
Review of attachment 293446 [details] [review]:

Looks good to me. Thanks, Bastien.
Comment 15 Bastien Nocera 2015-01-15 14:36:41 UTC
Attachment 293446 [details] pushed as f44fbfa - documents: Fix opening docs with broken defaults
Comment 16 Bastien Nocera 2015-03-25 13:50:58 UTC
Reassigning to new default assignee.