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 780688 - Disable the Run button when it's not useful
Disable the Run button when it's not useful
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
3.24.x
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks: 781010
 
 
Reported: 2017-03-29 15:45 UTC by Matthew Leeds
Modified: 2017-04-25 02:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
run-manager: Switch to using actual GAction instances (8.32 KB, patch)
2017-04-21 05:50 UTC, Matthew Leeds
committed Details | Review
run-manager: Disable run button when can-build is FALSE (7.42 KB, patch)
2017-04-21 05:51 UTC, Matthew Leeds
committed Details | Review

Description Matthew Leeds 2017-03-29 15:45:11 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.
Comment 1 Christian Hergert 2017-03-29 16:54:40 UTC
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.
Comment 2 Matthew Leeds 2017-03-29 18:08:59 UTC
(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.
Comment 3 Christian Hergert 2017-03-29 18:12:36 UTC
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.
Comment 4 Matthew Leeds 2017-04-19 00:34:14 UTC
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.
Comment 5 Christian Hergert 2017-04-19 00:37:41 UTC
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.
Comment 6 Matthew Leeds 2017-04-19 01:05:04 UTC
Right, maybe it should just be insensitive until can-build is true
Comment 7 Christian Hergert 2017-04-19 01:08:58 UTC
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.
Comment 8 Carlos Soriano 2017-04-19 08:18:50 UTC
(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.
Comment 9 Matthew Leeds 2017-04-21 05:50:57 UTC
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.
Comment 10 Matthew Leeds 2017-04-21 05:51:01 UTC
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.
Comment 11 Christian Hergert 2017-04-25 02:15:55 UTC
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