diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-02-14 07:51:25 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-14 07:51:25 -0800 |
commit | 6b458ad7fadedf6eb10c6fd3964d5caa409353da (patch) | |
tree | 25eb52736d32a49d3a9b9fbe690436d4c80b79ca /planner.c | |
parent | 29bc1e12a490853c1a17ba4691e91d295bc7a91b (diff) | |
download | subsurface-6b458ad7fadedf6eb10c6fd3964d5caa409353da.tar.gz |
Ensure that planner warnings get shown before calculations are run
Linus pointed out that the warning wasn't shown until the main loop got
control back, so even a gtk_widget_show_all() doesn't really help to make
sure that things are shown right then.
This commit adds a little loop to handle all pending gtk_events before
exiting the show_error() function. Now the warning should be shown BEFORE
a potentially slow calculation gets started.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -83,6 +83,9 @@ static void show_error(const char *fmt, ...) if (!bar_is_visible) gtk_box_pack_start(GTK_BOX(box), planner_error_bar, FALSE, FALSE, 0); gtk_widget_show_all(box); + /* make sure this actually gets shown BEFORE the calculations run */ + while (gtk_events_pending()) + gtk_main_iteration_do(FALSE); } void get_gas_from_events(struct divecomputer *dc, int time, int *o2, int *he) |