[gnome-software] Add a way to force certain features
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a way to force certain features
- Date: Tue, 10 Sep 2013 00:59:15 +0000 (UTC)
commit 1c240d872ffe7626c3a85f1a07d50d66f913a644
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 9 20:54:59 2013 -0400
Add a way to force certain features
This is handy for debugging the rendering of featured tiles.
To enable this, compile with CFLAGS=-DDEBUG, and then set
the GNOME_SOFTWARE_FEATURED environment variable to the id
of the app you want to see featured.
src/plugins/gs-plugin-hardcoded-featured.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 8d0bce9..3410855 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -77,15 +77,21 @@ gs_plugin_add_featured (GsPlugin *plugin,
apps = g_key_file_get_groups (kf, &n_apps)
;
- /* In lieu of a random number generator, just
- * rotate the featured apps, giving each app
- * 3 days apiece.
- */
- date = g_date_time_new_now_utc ();
- i = g_date_time_get_day_of_year (date);
- g_date_time_unref (date);
- i = (i % (n_apps * 3)) / 3;
- group = apps[i];
+#ifdef DEBUG
+ group = g_getenv ("GNOME_SOFTWARE_FEATURED");
+ if (!group ||!g_list_find_custom (apps, group, g_str_equal))
+#endif
+ {
+ /* In lieu of a random number generator, just
+ * rotate the featured apps, giving each app
+ * 3 days apiece.
+ */
+ date = g_date_time_new_now_utc ();
+ i = g_date_time_get_day_of_year (date);
+ g_date_time_unref (date);
+ i = (i % (n_apps * 3)) / 3;
+ group = apps[i];
+ }
s = g_key_file_get_string (kf, group, "image", NULL);
path = g_build_filename (DATADIR, "gnome-software", s, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]