#include <gtk/gtk.h>

int main(int argc, char **argv)
{
	gtk_init (&argc, &argv);

	GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);

	GtkWidget *scroller = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_propagate_natural_width (GTK_SCROLLED_WINDOW (scroller), TRUE);
	gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scroller), TRUE);

	GtkWidget *text_view = gtk_text_view_new ();
	GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
	gtk_text_buffer_set_text (buffer, "This is an extremely long line that should have its natural width propagated to the ScrolledWindow.", -1);

	gtk_container_add (GTK_CONTAINER (scroller), text_view);

	gtk_container_add (GTK_CONTAINER (box), scroller);
	gtk_container_child_set (GTK_CONTAINER (box), scroller, "expand", TRUE, NULL);
	gtk_container_child_set (GTK_CONTAINER (box), scroller, "fill", FALSE, NULL);

	gtk_container_add (GTK_CONTAINER (window), box);
	gtk_widget_show_all (window);

	g_signal_connect (window, "delete-event", &gtk_main_quit, NULL);
	gtk_main ();
	return 0;
}
