[recipes/mini-timer: 2/6] Use the timer name for the notification



commit aff26632c4acdd2b2e07a3499552f999f1a79d17
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 22 21:29:56 2017 -0500

    Use the timer name for the notification
    
    This is easier than recreating the same string manually.

 src/gr-cooking-view.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index 75e8e93..4ae5c42 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -264,14 +264,9 @@ send_complete_notification (StepData *step)
         page = gtk_widget_get_ancestor (GTK_WIDGET (view), GR_TYPE_COOKING_PAGE);
         if (page) {
                 g_autofree char *text = NULL;
-                int i;
 
-                for (i = 0; i < view->steps->len; i++) {
-                        if (step == g_ptr_array_index (view->steps, i))
-                                break;
-                }
-
-                text = g_strdup_printf (_("Timer for “Step %d” has expired."), i + 1);
+                text = g_strdup_printf (_("Timer for “%s” has expired."),
+                                        gr_timer_get_name (step->timer));
                 gr_cooking_page_show_notification (GR_COOKING_PAGE (page), text);
         }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]