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.
This commit is contained in:
Matthias Clasen 2017-10-06 21:59:34 -04:00
parent 481ba13e8e
commit 4d3cdfae44

View File

@ -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);