summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-10-06 21:59:34 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-10-06 21:59:34 -0400
commit4d3cdfae4438ccea048f22912aa2ff391be2f232 (patch)
tree6ee99538df661e13e975c1e02917a23705e2eae5 /demos
parent481ba13e8efbdac53d752363f5b6a10b4d0a797d (diff)
downloadgtk+-4d3cdfae4438ccea048f22912aa2ff391be2f232.tar.gz
gtk-demo: Deal with big images
We don't want to grow our window to huge size just because there is a big source image.
Diffstat (limited to 'demos')
-rw-r--r--demos/gtk-demo/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index a38981221f..820f1dbd39 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -592,6 +592,17 @@ add_data_tab (const gchar *demoname)
g_bytes_unref (bytes);
}
+ if (GTK_IS_IMAGE (widget))
+ {
+ GtkWidget *sw;
+
+ gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
+ gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (sw), widget);
+ widget = sw;
+ }
+
label = gtk_label_new (resources[i]);
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);