#include <gtk/gtk.h>

static void
on_expander_activate (GtkWidget *widget, gpointer user_data)
{
	if (gtk_expander_get_expanded (GTK_EXPANDER (widget)))
		gtk_label_set_ellipsize (GTK_LABEL (user_data), PANGO_ELLIPSIZE_NONE);
	else
		gtk_label_set_ellipsize (GTK_LABEL (user_data), PANGO_ELLIPSIZE_END);
}

int
main (int argc, char **argv)
{
	GtkWidget *window, *expander, *label;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request (GTK_WIDGET (window), 100, -1);

	expander = gtk_expander_new (NULL);
	gtk_widget_set_size_request (GTK_WIDGET (expander), 100, -1);

	label = gtk_label_new ("testtesttesttesttesttest\ntest");
	gtk_expander_set_label_widget (GTK_EXPANDER (expander), label);
	g_signal_connect (expander, "activate", G_CALLBACK (on_expander_activate), label);

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


	gtk_main ();

	return 0;
}
