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 761752 - no chess engine installed is a poor initial experience
no chess engine installed is a poor initial experience
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: Sahil Sareen
gnome-chess-maint
Depends on:
Blocks:
 
 
Reported: 2016-02-09 10:14 UTC by Jakub Steiner
Modified: 2016-05-08 06:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
poor initial experience in GNOME Continuous (1.32 MB, image/png)
2016-02-09 10:14 UTC, Jakub Steiner
  Details
better initial user experience using gtkinfobar (806.43 KB, image/png)
2016-02-09 10:21 UTC, Jakub Steiner
  Details
Use gtk infobar if no chess engines installed (2.70 KB, patch)
2016-04-03 13:39 UTC, Sahil Sareen
none Details | Review
Better initial experience using GTK infobar (97.88 KB, image/png)
2016-04-03 13:41 UTC, Sahil Sareen
  Details
Use gtk infobar if no chess engines installed (4.02 KB, patch)
2016-05-07 10:41 UTC, Sahil Sareen
none Details | Review
Use gtk infobar if no chess engines installed (4.03 KB, patch)
2016-05-07 10:46 UTC, Sahil Sareen
accepted-commit_now Details | Review

Description Jakub Steiner 2016-02-09 10:14:05 UTC
When running in the GNOME Continuous snapshot, Chess lacks an engine to be able to play against AI. However limited, the game is still able to present itself a lot better. 

Instead of the shameful dialog as attached, I recommend using an infobar to inform about the missing component and an action button taking you to Software to install one.

We also should have a fully functional Chess in the Continuous image perhaps.
Comment 1 Jakub Steiner 2016-02-09 10:14:50 UTC
Created attachment 320692 [details]
poor initial experience in GNOME Continuous
Comment 2 Jakub Steiner 2016-02-09 10:21:29 UTC
Created attachment 320693 [details]
better initial user experience using gtkinfobar
Comment 3 Sahil Sareen 2016-02-09 11:23:44 UTC
+1 Jakub

I'd suggest using the same message as before as I find it easier to understand.
Comment 4 Michael Catanzaro 2016-02-09 15:12:06 UTC
I noticed this in Continuous the other day. Should be easy to switch to an infobar, want to give it a try, Sahil?

The Install button is a bit more difficult, though; you'll have to use the PackageKit D-Bus API (I think it's provided by GNOME Software nowadays) to install /usr/bin/gnuchess. I think this is really optional, because users should never see this error ever; the distro is broken if gnome-chess doesn't Recommends some chess engine.

So let's break this into three steps:

 * Switch to the infobar
 * Add gnuchess to gnome-continuous
 * (Optional) Add Install button which uses PackageKit

But thinking to the future, I'm afraid we'll have to bundle some chess engine, as we won't have access to system engines with xdg-app.
Comment 5 Sahil Sareen 2016-02-09 16:50:39 UTC
(In reply to Michael Catanzaro from comment #4)
> I noticed this in Continuous the other day. Should be easy to switch to an
> infobar, want to give it a try, Sahil?

Sure! I'll take this up! :D
Comment 6 Sahil Sareen 2016-03-20 18:23:22 UTC
I couldn't find time before 3.20 for this, will do for the coming cycle.
Comment 7 Sahil Sareen 2016-04-03 13:39:34 UTC
Created attachment 325262 [details] [review]
Use gtk infobar if no chess engines installed
Comment 8 Sahil Sareen 2016-04-03 13:41:26 UTC
Created attachment 325263 [details]
Better initial experience using GTK infobar
Comment 9 Michael Catanzaro 2016-04-03 21:07:13 UTC
Review of attachment 325262 [details] [review]:

Thanks! A few comments:

::: src/gnome-chess.vala
@@ +55,3 @@
     private Gtk.AboutDialog? about_dialog = null;
+    private Gtk.InfoBar? no_engine_info_bar = null;
+    private Gtk.Label? no_engine_error_label = null;

These fields are not used except to store the unused out parameters from add_info_bar_to_dialog. You should make that function's out parameters nullable, and not assign to the out parameters if passed null, so you can get rid of these unnecessary fields.

@@ +128,3 @@
     }
 
+    private void on_no_engine_info_bar_closed ()

We use the _cb suffix rather than the on_ prefix for naming callbacks. But...

@@ +139,3 @@
+        no_engine_info_bar.show ();
+        no_engine_info_bar.set_show_close_button (true);
+        no_engine_info_bar.response.connect (on_no_engine_info_bar_closed);

...it'd be easiest to use a lambda here, instead, especially since the callback is a one-liner.

@@ +208,3 @@
             warning ("engines.conf not found");
 
+        // Info bar to indicate no chess engines are installed

/* C style comments */

@@ +209,3 @@
 
+        // Info bar to indicate no chess engines are installed
+        add_info_bar_to_dialog ((Gtk.Dialog) window, out no_engine_info_bar, out no_engine_error_label);

Major problem: this cast is wrong. window is a Gtk.ApplicationWindow, which is not a Gtk.Dialog. If you don't get any critical warnings or crashes doing this, it's just luck that add_info_bar_to_dialog only uses properties and methods shared by Gtk.ApplicationWindow. I would change the function to add_info_bar_to_container that takes a Gtk.Container instead.

Minor problem: this work should not normally be needed. Wouldn't it make more sense to call this inside display_no_engine_info_bar?
Comment 10 Sahil Sareen 2016-05-07 10:41:24 UTC
Created attachment 327432 [details] [review]
Use gtk infobar if no chess engines installed

Fixed suggestions from mcatanzaro
Comment 11 Sahil Sareen 2016-05-07 10:46:29 UTC
Created attachment 327433 [details] [review]
Use gtk infobar if no chess engines installed
Comment 12 Michael Catanzaro 2016-05-07 14:16:59 UTC
Review of attachment 327433 [details] [review]:

::: src/gnome-chess.vala
@@ +2233,3 @@
     }
 
+    private void add_info_bar_to_bin (Gtk.Bin dialog, out Gtk.InfoBar info_bar, out Gtk.Label label)

Please rename the Gtk.Bin parameter from dialog to bin.
Comment 13 Sahil Sareen 2016-05-08 06:14:59 UTC
Thanks Michael, Fixed and pushed to master.

To ssh://ssareen@git.gnome.org/git/gnome-chess
   50c0855..a265373  master -> master