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 767083 - books: Hide the "Present" menu item in Books
books: Hide the "Present" menu item in Books
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: books
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Books Maintainers
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-05-31 17:26 UTC by Bastien Nocera
Modified: 2016-06-03 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
books: Hide the "Present" menu item in Books (4.11 KB, patch)
2016-05-31 17:26 UTC, Bastien Nocera
none Details | Review
books: Hide the "Present" menu item in Books (4.21 KB, patch)
2016-05-31 17:31 UTC, Bastien Nocera
none Details | Review
books: Hide the "Present" menu item in Books (4.16 KB, patch)
2016-06-02 13:41 UTC, Bastien Nocera
committed Details | Review
preview: Increase scope of presentCurrentId (958 bytes, patch)
2016-06-03 11:55 UTC, Alessandro Bono
committed Details | Review

Description Bastien Nocera 2016-05-31 17:26:01 UTC
.
Comment 1 Bastien Nocera 2016-05-31 17:26:06 UTC
Created attachment 328835 [details] [review]
books: Hide the "Present" menu item in Books

We're unlikely to make presentations with files from Books, so remove
the menu item.
Comment 2 Bastien Nocera 2016-05-31 17:31:01 UTC
Created attachment 328836 [details] [review]
books: Hide the "Present" menu item in Books

We're unlikely to make presentations with files from Books, so remove
the menu item.
Comment 3 Cosimo Cecchi 2016-06-02 08:29:05 UTC
Review of attachment 328836 [details] [review]:

Few small comments on the patch - looks good in general.

::: src/application.js
@@ +645,3 @@
+              accels: ['F5'] });
+            this._initActions();
+              window_mode: WindowMode.WindowMode.PREVIEW,

There should be no harm in calling this._initGettingStarted() before this._initActions() and this._initAppMenu().
So you could just have a block for the !isBooks case and call the other two methods later in a common code path.

::: src/preview.js
@@ +148,2 @@
         this._togglePresentation = Application.application.lookup_action('present-current');
+        if (!Application.application.isBooks) {

Is there any harm in connecting to the signal even if that particular detail will never be used?

@@ +920,3 @@
+        if (Application.application.isBooks) {
+            let section = builder.get_object('open-section');
+            section.remove(3);

Not a big fan of the hardcoding here; would it be possible to use a different menu definition for the isBooks case?
Comment 4 Bastien Nocera 2016-06-02 13:41:09 UTC
Created attachment 328956 [details] [review]
books: Hide the "Present" menu item in Books

We're unlikely to make presentations with files from Books, so remove
the menu item.
Comment 5 Bastien Nocera 2016-06-02 13:43:11 UTC
(In reply to Cosimo Cecchi from comment #3)
> Review of attachment 328836 [details] [review] [review]:
> 
> Few small comments on the patch - looks good in general.
> 
> ::: src/application.js
> @@ +645,3 @@
> +              accels: ['F5'] });
> +            this._initActions();
> +              window_mode: WindowMode.WindowMode.PREVIEW,
> 
> There should be no harm in calling this._initGettingStarted() before
> this._initActions() and this._initAppMenu().
> So you could just have a block for the !isBooks case and call the other two
> methods later in a common code path.

Done.

> ::: src/preview.js
> @@ +148,2 @@
>          this._togglePresentation =
> Application.application.lookup_action('present-current');
> +        if (!Application.application.isBooks) {
> 
> Is there any harm in connecting to the signal even if that particular detail
> will never be used?

You'll get a warning because the action doesn't exist (it's only added if !isBooks above in the patch).

> @@ +920,3 @@
> +        if (Application.application.isBooks) {
> +            let section = builder.get_object('open-section');
> +            section.remove(3);
> 
> Not a big fan of the hardcoding here; would it be possible to use a
> different menu definition for the isBooks case?

I remembered something I asked to implement in GMenu which solves this better. One-liner!
Comment 6 Cosimo Cecchi 2016-06-03 10:46:42 UTC
Review of attachment 328956 [details] [review]:

Thank you, looks good now.
Comment 7 Bastien Nocera 2016-06-03 11:12:50 UTC
Attachment 328956 [details] pushed as 34d7c0a - books: Hide the "Present" menu item in Books
Comment 8 Alessandro Bono 2016-06-03 11:54:24 UTC
I get the following error:
(org.gnome.Documents:12023): Gjs-WARNING **: JS ERROR: ReferenceError: presentCurrentId is not defined
PreviewView<._init/<@resource:///org/gnome/Documents/js/preview.js:171
main@resource:///org/gnome/Documents/js/main.js:47
run@resource:///org/gnome/gjs/modules/package.js:192
@/home/abono/jhbuild/install/bin/gnome-documents:6
Comment 9 Alessandro Bono 2016-06-03 11:55:58 UTC
Created attachment 329037 [details] [review]
preview: Increase scope of presentCurrentId
Comment 10 Bastien Nocera 2016-06-03 12:21:10 UTC
Review of attachment 329037 [details] [review]:

Looks like the cleanest option. Thanks
Comment 11 Bastien Nocera 2016-06-03 14:12:52 UTC
Attachment 329037 [details] pushed as a399a86 - preview: Increase scope of presentCurrentId