GNOME Bugzilla – Bug 746774
Context needs to be created after game window
Last modified: 2015-09-19 23:09:21 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.
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.
*** Bug 747904 has been marked as a duplicate of this bug. ***
*** Bug 753650 has been marked as a duplicate of this bug. ***
(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....
(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.
P.S. No need to use has_scores() anymore; you can allow access to the scores dialog at all times.