[recipes] cooking view: Center text if there's no image or timer
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] cooking view: Center text if there's no image or timer
- Date: Tue, 21 Feb 2017 00:10:27 +0000 (UTC)
commit ff468c816b43a1e6ad786e600ee1019ea2f8b76f
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 20 18:49:55 2017 -0500
cooking view: Center text if there's no image or timer
This was requested by Jakub.
src/gr-cooking-view.c | 8 ++++++++
src/gr-cooking-view.ui | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-cooking-view.c b/src/gr-cooking-view.c
index efe38ad..6b6d6ce 100644
--- a/src/gr-cooking-view.c
+++ b/src/gr-cooking-view.c
@@ -103,6 +103,7 @@ struct _GrCookingView
GtkWidget *cooking_image;
GtkWidget *cooking_stack;
GtkWidget *cooking_timer;
+ GtkWidget *text_box;
GArray *images;
char *instructions;
@@ -195,6 +196,8 @@ setup_step (GrCookingView *view)
if (s->timer) {
gboolean active;
+ gtk_widget_show (view->cooking_stack);
+ gtk_widget_set_halign (view->text_box, GTK_ALIGN_START);
g_object_get (s->timer, "active", &active, NULL);
g_object_set (view->cooking_timer, "timer", s->timer, NULL);
gtk_stack_set_visible_child_name (GTK_STACK (view->cooking_stack), "timer");
@@ -203,6 +206,8 @@ setup_step (GrCookingView *view)
GrImage *ri = NULL;
g_autoptr(GdkPixbuf) pixbuf = NULL;
+ gtk_widget_show (view->cooking_stack);
+ gtk_widget_set_halign (view->text_box, GTK_ALIGN_START);
ri = &g_array_index (view->images, GrImage, s->image);
if (view->wide)
pixbuf = load_pixbuf_fill_size (ri->path, 0, 640, 480);
@@ -212,6 +217,8 @@ setup_step (GrCookingView *view)
gtk_stack_set_visible_child_name (GTK_STACK (view->cooking_stack), "image");
}
else {
+ gtk_widget_hide (view->cooking_stack);
+ gtk_widget_set_halign (view->text_box, GTK_ALIGN_CENTER);
gtk_stack_set_visible_child_name (GTK_STACK (view->cooking_stack), "empty");
}
}
@@ -398,6 +405,7 @@ gr_cooking_view_class_init (GrCookingViewClass *klass)
gtk_widget_class_bind_template_child (widget_class, GrCookingView, cooking_image);
gtk_widget_class_bind_template_child (widget_class, GrCookingView, cooking_stack);
gtk_widget_class_bind_template_child (widget_class, GrCookingView, cooking_timer);
+ gtk_widget_class_bind_template_child (widget_class, GrCookingView, text_box);
gtk_widget_class_bind_template_callback (widget_class, step_timer_start);
gtk_widget_class_bind_template_callback (widget_class, step_timer_pause);
diff --git a/src/gr-cooking-view.ui b/src/gr-cooking-view.ui
index c1cb88f..63e9253 100644
--- a/src/gr-cooking-view.ui
+++ b/src/gr-cooking-view.ui
@@ -82,7 +82,7 @@
</object>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="text_box">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="halign">start</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]