Example #1
0
/**
 * go_combo_popup_reparent
 * @popup:       Popup
 * @new_parent:  New parent
 * @unrealize:   Unrealize popup if TRUE.
 *
 * Reparent the popup, taking care of the refcounting
 *
 * Compare with gtk_menu_reparent in gtk/gtkmenu.c
 */
static void
go_combo_popup_reparent (GtkWidget *popup,
			 GtkWidget *new_parent,
			 gboolean unrealize)
{
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
	gboolean was_floating = g_object_is_floating (popup);
	g_object_ref_sink (popup);
#else
	gboolean was_floating = GTK_OBJECT_FLOATING (popup);
	g_object_ref (popup);
	gtk_object_sink (GTK_OBJECT (popup));
#endif

	if (unrealize) {
		g_object_ref (popup);
		gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
		gtk_container_add (GTK_CONTAINER (new_parent), popup);
		g_object_unref (popup);
	}
	else
		gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
	gtk_widget_set_size_request (new_parent, -1, -1);

	if (was_floating) {
#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
		g_object_force_floating (G_OBJECT (popup));
#else
		GTK_OBJECT_SET_FLAGS (GTK_OBJECT (popup), GTK_FLOATING);
#endif
	} else
		g_object_unref (popup);
}
Example #2
0
GtkWidget * vex_single_new(char * pwd, VexProfile * profile)
{
	VexSingle * vex_single = g_object_new(VEX_TYPE_VEX_SINGLE, NULL);

	vex_single_constructor(vex_single, pwd, profile);
	GTK_OBJECT_SET_FLAGS(vex_single, GTK_CAN_FOCUS);

	return GTK_WIDGET(vex_single);
}