[recipes] Randomize the pick selection
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Randomize the pick selection
- Date: Wed, 18 Jan 2017 11:28:59 +0000 (UTC)
commit 4611d78190d2edbdc756ccc378d4f08e91025c64
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 18 06:27:17 2017 -0500
Randomize the pick selection
We lost this at some point; it is a bit boring to see the
same picks every time, so scramble the list to let us
see different picks.
src/gr-recipes-page.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-recipes-page.c b/src/gr-recipes-page.c
index 989877e..ffddb71 100644
--- a/src/gr-recipes-page.c
+++ b/src/gr-recipes-page.c
@@ -295,6 +295,18 @@ populate_recipes_from_store (GrRecipesPage *self)
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
keys = gr_recipe_store_get_recipe_keys (store, &length);
+
+ /* scramble the keys so we don't always get the same picks */
+ for (i = 0; i < length; i++) {
+ int r;
+
+ r = g_random_int_range (0, length);
+
+ tmp = keys[i];
+ keys[i] = keys[r];
+ keys[r] = tmp;
+ }
+
todays = 0;
picks = 0;
shopping = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]