[recipes] details page: Bring back the description
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] details page: Bring back the description
- Date: Tue, 20 Dec 2016 11:52:26 +0000 (UTC)
commit 0583801c1b9bee3d7649762b1bac616e8c815ca9
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 20 06:51:20 2016 -0500
details page: Bring back the description
We should show it if we have it.
src/gr-details-page.c | 12 ++++++++++++
src/gr-details-page.ui | 23 ++++++++++++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index af5215c..c1a58ff 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -137,6 +137,7 @@ struct _GrDetailsPage
GtkWidget *edit_button;
GtkWidget *delete_button;
GtkWidget *notes_field;
+ GtkWidget *description_label;
guint save_timeout;
};
@@ -628,6 +629,7 @@ gr_details_page_class_init (GrDetailsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, edit_button);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, delete_button);
gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, notes_field);
+ gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, description_label);
gtk_widget_class_bind_template_callback (widget_class, edit_recipe);
gtk_widget_class_bind_template_callback (widget_class, delete_recipe);
@@ -734,6 +736,7 @@ gr_details_page_set_recipe (GrDetailsPage *page,
const char *ingredients;
const char *instructions;
const char *notes;
+ const char *description;
g_autoptr(GdkPixbuf) pixbuf = NULL;
GrRecipeStore *store;
g_autoptr(GrChef) chef = NULL;
@@ -752,6 +755,7 @@ gr_details_page_set_recipe (GrDetailsPage *page,
ingredients = gr_recipe_get_ingredients (recipe);
instructions = gr_recipe_get_instructions (recipe);
notes = gr_recipe_get_notes (recipe);
+ description = gr_recipe_get_description (recipe);
g_object_get (recipe, "images", &images, NULL);
gr_image_viewer_set_images (GR_IMAGE_VIEWER (page->recipe_image), images);
@@ -795,6 +799,14 @@ gr_details_page_set_recipe (GrDetailsPage *page,
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (page->notes_field)),
notes, -1);
+ if (description && description[0]) {
+ gtk_label_set_label (GTK_LABEL (page->description_label), description);
+ gtk_widget_show (page->description_label);
+ }
+ else {
+ gtk_widget_hide (page->description_label);
+ }
+
if (gr_recipe_is_readonly (recipe)) {
gtk_widget_set_sensitive (page->edit_button, FALSE);
gtk_widget_set_sensitive (page->delete_button, FALSE);
diff --git a/src/gr-details-page.ui b/src/gr-details-page.ui
index 616f377..2ae46e7 100644
--- a/src/gr-details-page.ui
+++ b/src/gr-details-page.ui
@@ -268,6 +268,19 @@ followed</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>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">Directions</property>
@@ -278,7 +291,7 @@ followed</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">3</property>
+ <property name="top-attach">4</property>
<property name="width">2</property>
</packing>
</child>
@@ -292,7 +305,7 @@ followed</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">4</property>
+ <property name="top-attach">5</property>
<property name="width">2</property>
</packing>
</child>
@@ -305,7 +318,7 @@ followed</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">5</property>
+ <property name="top-attach">6</property>
<property name="width">2</property>
</packing>
</child>
@@ -320,7 +333,7 @@ followed</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">6</property>
+ <property name="top-attach">7</property>
<property name="width">2</property>
</packing>
</child>
@@ -344,7 +357,7 @@ followed</property>
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">7</property>
+ <property name="top-attach">8</property>
<property name="width">2</property>
</packing>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]