static void
matecomponent_control_auto_merge (MateComponentControl *control)
{
	MateComponent_UIContainer remote_container;

	if (control->priv->ui_component == NULL)
		return;

	/* 
	 * this makes a CORBA call, so re-entrancy can occur here
	 */
	remote_container = matecomponent_control_get_remote_ui_container (control, NULL);
	if (remote_container == CORBA_OBJECT_NIL)
		return;

	/*
	 * we could have been re-entereted in the previous call, so
	 * make sure we are still active
	 */
	if (control->priv->active)
		matecomponent_ui_component_set_container (
			control->priv->ui_component, remote_container, NULL);

	matecomponent_object_release_unref (remote_container, NULL);
}
MateComponentUIComponent *
matecomponent_control_get_popup_ui_component (MateComponentControl *control)
{
	MateComponentUIContainer *ui_container;

	g_return_val_if_fail (MATECOMPONENT_IS_CONTROL (control), NULL);

	if (!control->priv->popup_ui_component) {
		ui_container = matecomponent_control_get_popup_ui_container (control);

		control->priv->popup_ui_component = 
			matecomponent_ui_component_new_default ();

		matecomponent_ui_component_set_container (
			control->priv->popup_ui_component,
			MATECOMPONENT_OBJREF (ui_container), NULL);
	}

	return control->priv->popup_ui_component;
}
/*
 * Public functions
 */
void
matecomponent_browser_create_window (void)
{
	GtkWidget *window, *status_bar;
	GtkWidget *all_button, *active_button, *inactive_button;
	GtkWidget *query_label, *execute_button;
	GtkWidget *main_vbox, *hbox;
	struct window_info *info;
	MateComponentUIContainer *ui_container;
	MateComponentUIComponent *ui_component;
	MateComponent_UIContainer corba_container;
	CORBA_Environment ev;

	CORBA_exception_init (&ev);

	info = g_malloc (sizeof (struct window_info));

	/* create the window */
	window = matecomponent_window_new ("matecomponent-browser", _("Component Browser"));
	gtk_window_set_role (GTK_WINDOW (window), "Main window");
	gtk_window_set_type_hint (GTK_WINDOW (window),
				  GDK_WINDOW_TYPE_HINT_NORMAL);
	g_signal_connect (G_OBJECT (window), "delete_event",
			  G_CALLBACK (window_closed_cb), NULL);
	g_signal_connect (G_OBJECT (window), "destroy",
			  G_CALLBACK (window_closed_cb), NULL);

	ui_container = matecomponent_window_get_ui_container (MATECOMPONENT_WINDOW(window));
	corba_container = MATECOMPONENT_OBJREF (ui_container);

	ui_component = matecomponent_ui_component_new ("matecomponent-browser");
	matecomponent_ui_component_set_container (ui_component, corba_container,
					   NULL);

	/* set UI for the window */
	matecomponent_ui_component_freeze (ui_component, NULL);
	matecomponent_ui_util_set_ui (ui_component, MATECOMPONENT_BROWSER_DATADIR,
			       "matecomponent-browser.xml",
			       "matecomponent-browser", &ev);
	matecomponent_ui_component_add_verb_list_with_data (ui_component,
						     window_verbs, window); 
	matecomponent_ui_component_thaw (ui_component, NULL);

	/* Create the main window */
	main_vbox = gtk_vbox_new (FALSE, 0);
	matecomponent_window_set_contents (MATECOMPONENT_WINDOW (window), main_vbox);

	hbox = gtk_hbox_new (FALSE, 0);
	gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 3);

	info->comp_list = component_list_new ();
	gtk_box_pack_start (GTK_BOX (main_vbox), info->comp_list,
			    TRUE, TRUE, 3);

	status_bar = gtk_statusbar_new ();
	gtk_box_pack_start (GTK_BOX (main_vbox), status_bar, FALSE, TRUE, 3);

	/* Fill out the tool bar */
	all_button = gtk_radio_button_new_with_label (NULL, _("All"));
	g_signal_connect (G_OBJECT (all_button), "clicked",
			  G_CALLBACK (all_query_cb), info);
	active_button = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (all_button)), _("Active"));
	g_signal_connect (G_OBJECT (active_button), "clicked",
			  G_CALLBACK (active_query_cb), info);
	inactive_button = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (all_button)), _("Inactive"));
	g_signal_connect (G_OBJECT (inactive_button), "clicked",
			  G_CALLBACK (inactive_query_cb), info);
	query_label = gtk_label_new ("Query:");
	info->entry = gtk_entry_new ();
	g_signal_connect (GTK_ENTRY (info->entry), "activate",
			  G_CALLBACK (execute_query_cb), info);
	execute_button = gtk_button_new_from_stock (GTK_STOCK_EXECUTE);
	g_signal_connect (G_OBJECT (execute_button), "clicked",
			  G_CALLBACK (execute_query_cb), info);

	gtk_box_pack_start (GTK_BOX (hbox), all_button, FALSE, FALSE, 3);
	gtk_box_pack_start (GTK_BOX (hbox), active_button, FALSE, FALSE, 3);
	gtk_box_pack_start (GTK_BOX (hbox), inactive_button, FALSE, FALSE, 3);
	gtk_box_pack_start (GTK_BOX (hbox), query_label, FALSE, FALSE, 1);
	gtk_box_pack_start (GTK_BOX (hbox), info->entry, TRUE, TRUE, 3);
	gtk_box_pack_start (GTK_BOX (hbox), execute_button, FALSE, FALSE, 3);

	/* Attach to the component-details signal */
	g_signal_connect (G_OBJECT (info->comp_list), "component-details",
			  G_CALLBACK (component_details_cb), info->comp_list);

	component_list_show (COMPONENT_LIST (info->comp_list),
			     "_active || _active == FALSE");
	gtk_entry_set_text (GTK_ENTRY (info->entry),
			    "_active || _active == FALSE");

	/* add this window to our list of open windows */
	open_windows = g_list_append (open_windows, window);

	gtk_widget_set_size_request (window, 600, 500);
	gtk_widget_show_all (window);
}