Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The changes to
EditCanvasGridAction
, specifically, are a demonstration that will help us start discussing a point.I wanted to change some code in
StatusBarColorPaletteWidget
andNewDocumentAction
so that their dialog code usesasync
andawait
. However, doing it the way I'm doing it with other dialogs means that I would be accessing its properties after it has beenDestroy
ed. That would work because the properties are custom, from the Pinta codebase, and in no way tied to the lifetime of the Gtk dialog in question. However, it doesn't feel that clean.If we just need to read the values, I was thinking we could create specialized extension methods and using them instead of the generic dialog methods, something like:
It's also tricky because the dialog is still visible even after it's
Dispose
d, unless weDestroy
it previously, which doesn't make a lot of sense to me. One possible way to address that is creating our own base dialog class with an overriddenDispose
method, or perhaps even address it directly by making the appropriate changes to gir.core.If we are not just reading its properties, but also calling a method with side effects, (see
dialog.RevertChanges()
), it's a bit trickier to do cleanly, but in this PR I'm proposing a temporary solution, although in my opinion thisRevertChanges
method, along with theCanvasGridManager
, should be refactored out of the dialog, because a dialog has no business changing the workspace, but rather should just be used for getting input from the user.