[recipes] Tweak the handling of the done button
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Tweak the handling of the done button
- Date: Sat, 25 Feb 2017 18:30:17 +0000 (UTC)
commit 2531af959d957c4db1cbad13e7713c65c204da68
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 25 10:32:33 2017 -0500
Tweak the handling of the done button
Only show the done button on the last step of cooking mode
if there are no running timers. This is not quite perfect,
since we may show and then hide the button if there's a timer
on the last step that gets started, but it is still an
improvement.
https://bugzilla.gnome.org/show_bug.cgi?id=778861
src/gr-cooking-page.c | 10 +++++++++-
src/gr-cooking-view.c | 6 ++++++
src/gr-cooking-view.h | 1 +
3 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-cooking-page.c b/src/gr-cooking-page.c
index 3826f2f..1d7a29a 100644
--- a/src/gr-cooking-page.c
+++ b/src/gr-cooking-page.c
@@ -140,13 +140,16 @@ update_steppers (GrCookingPage *page)
{
int step;
int n_steps;
+ gboolean active_timers;
step = gr_cooking_view_get_step (GR_COOKING_VIEW (page->cooking_view));
n_steps = gr_cooking_view_get_n_steps (GR_COOKING_VIEW (page->cooking_view));
+ active_timers = gr_cooking_view_has_active_timers (GR_COOKING_VIEW (page->cooking_view));
gtk_widget_set_sensitive (page->prev_step_button, step - 1 >= 0);
gtk_widget_set_sensitive (page->next_step_button, step + 1 <= n_steps - 1);
- gtk_widget_set_visible (page->done_button, step == n_steps - 1);
+
+ gtk_widget_set_visible (page->done_button, step == n_steps - 1 && !active_timers);
}
static void
@@ -281,6 +284,8 @@ gr_cooking_page_timer_expired (GrCookingPage *page,
static void
show_buttons (GrCookingPage *page)
{
+ update_steppers (page);
+
if (!gtk_revealer_get_child_revealed (GTK_REVEALER (page->close_revealer)))
gtk_revealer_set_reveal_child (GTK_REVEALER (page->close_revealer), TRUE);
@@ -297,6 +302,8 @@ show_buttons (GrCookingPage *page)
static void
hide_buttons (GrCookingPage *page)
{
+ update_steppers (page);
+
if (gtk_revealer_get_child_revealed (GTK_REVEALER (page->close_revealer)))
gtk_revealer_set_reveal_child (GTK_REVEALER (page->close_revealer), FALSE);
@@ -432,6 +439,7 @@ static void
close_notification (GrCookingPage *page)
{
gtk_revealer_set_reveal_child (GTK_REVEALER (page->notification_revealer), FALSE);
+ update_steppers (page);
}
static void
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index db70129..2512f98 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -684,3 +684,9 @@ gr_cooking_view_set_timer_box (GrCookingView *view,
{
view->timer_box = box;
}
+
+gboolean
+gr_cooking_view_has_active_timers (GrCookingView *view)
+{
+ return view->timers != NULL;
+}
diff --git a/src/gr-cooking-view.h b/src/gr-cooking-view.h
index a52f015..cd3eb8d 100644
--- a/src/gr-cooking-view.h
+++ b/src/gr-cooking-view.h
@@ -48,6 +48,7 @@ void gr_cooking_view_set_timer_box (GrCookingView *view,
GtkWidget *box);
void gr_cooking_view_timer_expired (GrCookingView *view,
int step);
+gboolean gr_cooking_view_has_active_timers (GrCookingView *view);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]