GNOME Bugzilla – Bug 780688
Disable the Run button when it's not useful
Last modified: 2017-04-25 02:16:06 UTC
When there's nothing to run, the run button should be disabled. This was mentioned before here: https://bugzilla.gnome.org/show_bug.cgi?id=771145#c20 but I think it deserves its own bug.
One difficulty as that we won't necessarily know the answer to this until the project has been at least configured. And to configure the project we have to do a bunch of other stuff like download dependencies. So that means that we wouldn't know the proper state of the button for a while down the build process anyway. That leads to two thoughts. 1) Stay insensitive until IDE_BUILD_PHASE_CONFIGURE has been reached. 2) If we fail to discover the build target, just ask the user for one. I sort of like 2 more than 1.
(In reply to Christian Hergert from comment #1) > 2) If we fail to discover the build target, just ask the user for one. I wonder what the UI would look like for that.
I(In reply to Matthew Leeds from comment #2) > I wonder what the UI would look like for that. It's the type of thing I would want Allan to take a look at so we know it fits in with the rest of the design. At some point, we need probably need the ability to select "run targets", so that might be how we address it.
To be consistent with the build buttons, maybe we should do both: make the Run button insensitive until a build target is found, and add the aforementioned UI for selecting build targets.
What I don't like about that is it requires two clicks to run the app. Where as the run button today will fire off the build too.
Right, maybe it should just be insensitive until can-build is true
I think that is fine. The thing that was troubling me previously before your can-build patches was that we can ensure that the runtime will still auto-install.
(In reply to Matthew Leeds from comment #4) > To be consistent with the build buttons, maybe we should do both: make the > Run button insensitive until a build target is found, and add the > aforementioned UI for selecting build targets. I think some kind of spinner would just present that the build situations is being found out. The problem basically is that you press build, but no progression feedback is provided. Making build/play button insensitive sounds like not precisely progress feedback, but at least is not as confusing as the current situation is.
Created attachment 350178 [details] [review] run-manager: Switch to using actual GAction instances IdeRunManager implements the ActionGroup interface but avoids instantiating any actual GAction's, instead just calling functions functions directly in activate_action(). Change it to use GAction instances as this will allow us to disable the actions when necessary and affect the buttons' sensitivity.
Created attachment 350179 [details] [review] run-manager: Disable run button when can-build is FALSE We're already disabling the build buttons when the build isn't possible (e.g. due to a missing runtime) so it makes sense to disable the Run button too (which does an install before running). Since the actions' enabled state also depends on whether the IdeRunManager is busy or not, we have to use a callback rather than a simple property binding. And since the context isn't available in the init() we have to get it in the async init instead.
LGTM, thanks! Attachment 350178 [details] pushed as cd8e487 - run-manager: Switch to using actual GAction instances Attachment 350179 [details] pushed as 6228da7 - run-manager: Disable run button when can-build is FALSE