forked from AuroraMiddleware/gtk
stack: Assert that StackPage:child is set
Childless GtkStackPage instances are not allowed, otherwise everything falls apart in random places.
This commit is contained in:
parent
d104357d40
commit
9eb6de403f
@ -395,6 +395,20 @@ gtk_stack_page_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_stack_page_constructed (GObject *gobject)
|
||||||
|
{
|
||||||
|
GtkStackPage *self = GTK_STACK_PAGE (gobject);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (self->widget == NULL))
|
||||||
|
g_error ("GtkStackPage '%s' [%p] is missing a child widget",
|
||||||
|
self->name != NULL ? self->name : "<unnamed>",
|
||||||
|
self);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gtk_stack_page_parent_class)->constructed (gobject);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_stack_page_class_init (GtkStackPageClass *class)
|
gtk_stack_page_class_init (GtkStackPageClass *class)
|
||||||
{
|
{
|
||||||
@ -404,6 +418,7 @@ gtk_stack_page_class_init (GtkStackPageClass *class)
|
|||||||
object_class->dispose = gtk_stack_page_dispose;
|
object_class->dispose = gtk_stack_page_dispose;
|
||||||
object_class->get_property = gtk_stack_page_get_property;
|
object_class->get_property = gtk_stack_page_get_property;
|
||||||
object_class->set_property = gtk_stack_page_set_property;
|
object_class->set_property = gtk_stack_page_set_property;
|
||||||
|
object_class->constructed = gtk_stack_page_constructed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkStackPage:child: (attributes org.gtk.Property.get=gtk_stack_page_get_child)
|
* GtkStackPage:child: (attributes org.gtk.Property.get=gtk_stack_page_get_child)
|
||||||
@ -2627,7 +2642,7 @@ gtk_stack_measure (GtkWidget *widget,
|
|||||||
int min_for_size;
|
int min_for_size;
|
||||||
|
|
||||||
gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL, NULL);
|
gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL, NULL);
|
||||||
|
|
||||||
gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat, NULL, NULL);
|
gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat, NULL, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user