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 746774 - Context needs to be created after game window
Context needs to be created after game window
Status: RESOLVED FIXED
Product: libgnome-games-support
Classification: Other
Component: general
git master
Other Linux
: Normal blocker
: ---
Assigned To: libgames-scores maintainer(s)
libgames-scores maintainer(s)
: 747904 753650 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-03-25 21:05 UTC by Juan R. Garcia Blanco
Modified: 2015-09-19 23:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Juan R. Garcia Blanco 2015-03-25 21:05:39 UTC
Right now the API forces the user to create the game window before creating the context, but showing the window after any other call to the library.

For example, in gnome-2048 this leads to the following issues:
- Context cannot be created in ::startup, since the main window is created in ::activate.
- has_scores () cannot be called after showing the main window.

I think it would be weird to force the user to perform the following actions in sequence:
- Create window.
- Create context, passing window.
- Call has_scores() to determine the active state of menu item.
- Show window.

I would prefer something like:
- Create context (in ::startup).
- Call has_scores().
- Create and show window.
- Associate window with context.
Comment 1 Michael Catanzaro 2015-03-26 18:04:15 UTC
Yes, this needs a rethink. It's my fault for the bad design.

I think the best solution here is to get rid of the need to use has_scores to decide if the dialog can be shown, by making the dialog look good when no scores are present.
Comment 2 Michael Catanzaro 2015-04-15 14:10:50 UTC
*** Bug 747904 has been marked as a duplicate of this bug. ***
Comment 3 Michael Catanzaro 2015-08-21 23:07:57 UTC
*** Bug 753650 has been marked as a duplicate of this bug. ***
Comment 4 Michael Catanzaro 2015-08-21 23:12:15 UTC
(In reply to Michael Catanzaro from comment #1)
> I think the best solution here is to get rid of the need to use has_scores
> to decide if the dialog can be shown, by making the dialog look good when no
> scores are present.

Iulian has a good-looking empty scores dialog now, but we still have problems with sync I/O being performed lazily whenever the context is first used....
Comment 5 Michael Catanzaro 2015-09-19 22:11:11 UTC
(In reply to Juan R. Garcia Blanco from comment #0)
> For example, in gnome-2048 this leads to the following issues:
> - Context cannot be created in ::startup, since the main window is created
> in ::activate.

I'm going to advise creating the main window in startup, and showing it in activate.
Comment 6 Michael Catanzaro 2015-09-19 23:09:21 UTC
P.S. No need to use has_scores() anymore; you can allow access to the scores dialog at all times.