[gtk] stack: Make the child meta work without stack
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] stack: Make the child meta work without stack
- Date: Fri, 8 Feb 2019 14:05:15 +0000 (UTC)
commit 1632cc7929431082f18f47db15b7a86adb7f3624
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 8 08:22:35 2019 -0500
stack: Make the child meta work without stack
We have tests that expect this to work, like defaultvalue.
gtk/gtkstack.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 7ac18bfc79..75bcc69059 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -220,8 +220,6 @@ gtk_stack_page_get_property (GObject *object,
GParamSpec *pspec)
{
GtkStackPage *info = GTK_STACK_PAGE (object);
- GtkWidget *stack = gtk_widget_get_parent (GTK_WIDGET (info->widget));
- GtkStackPrivate *priv = gtk_stack_get_instance_private (GTK_STACK (stack));
switch (property_id)
{
@@ -242,7 +240,15 @@ gtk_stack_page_get_property (GObject *object,
break;
case CHILD_PROP_POSITION:
- g_value_set_int (value, g_list_index (priv->children, info));
+ if (info->widget)
+ {
+ GtkWidget *stack = gtk_widget_get_parent (GTK_WIDGET (info->widget));
+ GtkStackPrivate *priv = gtk_stack_get_instance_private (GTK_STACK (stack));
+
+ g_value_set_int (value, g_list_index (priv->children, info));
+ }
+ else
+ g_value_set_int (value, 0);
break;
case CHILD_PROP_NEEDS_ATTENTION:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]