/*

Test case showing no label ("Click to select device...")
if the device property is never set.

gcc -Wall -Wl,--export-dynamic -o test-btc-button-label test-btc-button-label.c `pkg-config --cflags --libs gtk+-2.0 gnome-bluetooth-1.0`
*/
#include <gtk/gtk.h>
#include <string.h>
#include <bluetooth-chooser.h>
#include <bluetooth-chooser-button.h>

void
add_from_gtkbuilder (GtkWidget *container)
{
	const char *gtkbuilderstr = "" \
"<interface>" \
"<object class='BluetoothChooserButton' id='btchooser'>" \
"  <property name='visible'>True</property>" \
"  <property name='can_focus'>True</property>" \
"  <property name='receives_default'>True</property>" \
"</object>" \
"</interface>";
	GtkBuilder *ui;
	GtkWidget *w;

	ui = gtk_builder_new ();
	if (ui) {
		if (gtk_builder_add_from_string (ui, gtkbuilderstr, -1, NULL)) {
			w = GTK_WIDGET (gtk_builder_get_object (ui, "btchooser"));
			gtk_box_pack_start (GTK_BOX (container), w, TRUE, FALSE, 60);
#if 0
			/* Enable complilation of this line to see the default label */
			g_object_set (w, "device", NULL, NULL);
#endif
		}
	}
}

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

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_size_request (window, 300, 300);
	g_signal_connect (window, "destroy",
			  G_CALLBACK (gtk_main_quit), NULL);

	vbox = gtk_vbox_new (FALSE, 6);
	gtk_container_add (GTK_CONTAINER (window), vbox);

	add_from_gtkbuilder (vbox);

	gtk_widget_show_all (window);

	gtk_main ();

	return 0;
}

