GNOME Bugzilla – Bug 761752
no chess engine installed is a poor initial experience
Last modified: 2016-05-08 06:14:59 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.
Created attachment 320692 [details] poor initial experience in GNOME Continuous
Created attachment 320693 [details] better initial user experience using gtkinfobar
+1 Jakub I'd suggest using the same message as before as I find it easier to understand.
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.
(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
I couldn't find time before 3.20 for this, will do for the coming cycle.
Created attachment 325262 [details] [review] Use gtk infobar if no chess engines installed
Created attachment 325263 [details] Better initial experience using GTK infobar
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?
Created attachment 327432 [details] [review] Use gtk infobar if no chess engines installed Fixed suggestions from mcatanzaro
Created attachment 327433 [details] [review] Use gtk infobar if no chess engines installed
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.
Thanks Michael, Fixed and pushed to master. To ssh://ssareen@git.gnome.org/git/gnome-chess 50c0855..a265373 master -> master