[recipes] details: Show more details
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] details: Show more details
- Date: Sat, 25 Feb 2017 05:30:28 +0000 (UTC)
commit 6e381dddabd10ac26326610c7e52ce3e388f93fa
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 25 00:26:52 2017 -0500
details: Show more details
Show cuisine, meal and season if we have this information.
src/gr-details-page.c | 52 ++++++++++++++++++++++++
src/gr-details-page.ui | 103 +++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 149 insertions(+), 6 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 4b11bb5..3880412 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -41,6 +41,9 @@
#include "gr-recipe-printer.h"
#include "gr-recipe-exporter.h"
#include "gr-recipe-formatter.h"
+#include "gr-cuisine.h"
+#include "gr-meal.h"
+#include "gr-season.h"
struct _GrDetailsPage
@@ -59,6 +62,12 @@ struct _GrDetailsPage
GtkWidget *prep_time_label;
GtkWidget *cook_time_desc;
GtkWidget *cook_time_label;
+ GtkWidget *cuisine_desc;
+ GtkWidget *cuisine_label;
+ GtkWidget *meal_desc;
+ GtkWidget *meal_label;
+ GtkWidget *season_desc;
+ GtkWidget *season_label;
GtkWidget *serves_spin;
GtkWidget *warning_box;
GtkWidget *spicy_warning;
@@ -389,6 +398,12 @@ gr_details_page_class_init (GrDetailsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, prep_time_label);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, cook_time_desc);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, cook_time_label);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, cuisine_desc);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, cuisine_label);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, meal_desc);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, meal_label);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, season_desc);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, season_label);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, serves_spin);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, warning_box);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, spicy_warning);
@@ -591,6 +606,9 @@ gr_details_page_set_recipe (GrDetailsPage *page,
const char *author;
const char *prep_time;
const char *cook_time;
+ const char *cuisine;
+ const char *meal;
+ const char *season;
int serves;
int want_serves;
const char *ingredients;
@@ -617,6 +635,9 @@ gr_details_page_set_recipe (GrDetailsPage *page,
serves = gr_recipe_get_serves (recipe);
prep_time = gr_recipe_get_prep_time (recipe);
cook_time = gr_recipe_get_cook_time (recipe);
+ cuisine = gr_recipe_get_cuisine (recipe);
+ meal = gr_recipe_get_category (recipe);
+ season = gr_recipe_get_season (recipe);
ingredients = gr_recipe_get_ingredients (recipe);
notes = gr_recipe_get_translated_notes (recipe);
instructions = gr_recipe_get_translated_instructions (recipe);
@@ -658,6 +679,37 @@ gr_details_page_set_recipe (GrDetailsPage *page,
gtk_widget_show (page->cook_time_desc);
gtk_label_set_label (GTK_LABEL (page->cook_time_label), _(cook_time));
}
+ if (cuisine[0] == '\0') {
+ gtk_widget_hide (page->cuisine_label);
+ gtk_widget_hide (page->cuisine_desc);
+ }
+ else {
+ const char *title;
+
+ gr_cuisine_get_data (cuisine, &title, NULL, NULL);
+ gtk_widget_show (page->cuisine_label);
+ gtk_widget_show (page->cuisine_desc);
+ gtk_label_set_label (GTK_LABEL (page->cuisine_label), title);
+ }
+ if (meal[0] == '\0') {
+ gtk_widget_hide (page->meal_label);
+ gtk_widget_hide (page->meal_desc);
+ }
+ else {
+ gtk_widget_show (page->meal_label);
+ gtk_widget_show (page->meal_desc);
+ gtk_label_set_label (GTK_LABEL (page->meal_label), gr_meal_get_title (meal));
+ }
+ if (season[0] == '\0') {
+ gtk_widget_hide (page->season_label);
+ gtk_widget_hide (page->season_desc);
+ }
+ else {
+ gtk_widget_show (page->season_label);
+ gtk_widget_show (page->season_desc);
+ gtk_label_set_label (GTK_LABEL (page->season_label), gr_season_get_title (season));
+ }
+
processed = process_instructions (instructions);
gtk_label_set_label (GTK_LABEL (page->instructions_label), processed);
gtk_label_set_track_visited_links (GTK_LABEL (page->instructions_label), FALSE);
diff --git a/src/gr-details-page.ui b/src/gr-details-page.ui
index 811a802..a6516dd 100644
--- a/src/gr-details-page.ui
+++ b/src/gr-details-page.ui
@@ -231,7 +231,7 @@
<property name="valign">baseline</property>
<property name="margin-start">20</property>
<property name="margin-end">20</property>
- <property name="margin-bottom">30</property>
+ <property name="margin-bottom">15</property>
<style>
<class name="dim-label"/>
</style>
@@ -254,16 +254,107 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="cuisine_desc">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Cuisine</property>
+ <property name="xalign">1</property>
+ <property name="valign">baseline</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
+ <property name="margin-bottom">15</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="cuisine_label">
+ <property name="visible">1</property>
+ <property name="xalign">0</property>
+ <property name="valign">baseline</property>
+ <property name="hexpand">1</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="meal_desc">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Meal</property>
+ <property name="xalign">1</property>
+ <property name="valign">baseline</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
+ <property name="margin-bottom">15</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="meal_label">
+ <property name="visible">1</property>
+ <property name="xalign">0</property>
+ <property name="valign">baseline</property>
+ <property name="hexpand">1</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="season_desc">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">Season</property>
+ <property name="xalign">1</property>
+ <property name="valign">baseline</property>
+ <property name="margin-start">20</property>
+ <property name="margin-end">20</property>
+ <property name="margin-bottom">15</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="season_label">
+ <property name="visible">1</property>
+ <property name="xalign">0</property>
+ <property name="valign">baseline</property>
+ <property name="hexpand">1</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="description_label">
<property name="visible">1</property>
<property name="xalign">0</property>
<property name="wrap">1</property>
<property name="max-width-chars">45</property>
+ <property name="margin-top">15</property>
<property name="margin-bottom">15</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">3</property>
+ <property name="top-attach">6</property>
<property name="width">2</property>
</packing>
</child>
@@ -310,7 +401,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">4</property>
+ <property name="top-attach">7</property>
<property name="width">2</property>
</packing>
</child>
@@ -325,7 +416,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">5</property>
+ <property name="top-attach">8</property>
<property name="width">2</property>
</packing>
</child>
@@ -342,7 +433,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">6</property>
+ <property name="top-attach">9</property>
<property name="width">2</property>
</packing>
</child>
@@ -355,7 +446,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">7</property>
+ <property name="top-attach">10</property>
<property name="width">2</property>
</packing>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]