[gtk+] widget: Always set the type on css nodes

commit 203742b1886a56909b12ebfcfa92bc99f6bd0df5
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 22 21:00:12 2015 -0400

    widget: Always set the type on css nodes
    See the previous commit for why this is necessary.
    Also make gtk_widget_class_set_css_name work by looking at
    the correct class for the name.
    Note for future reference: GTK_WIDGET_GET_CLASS() does not
    work in the instance init function.

 gtk/gtkwidget.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4b1668d..e5763df 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4366,10 +4366,9 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
   priv->cssnode = gtk_css_widget_node_new (widget);
   gtk_css_node_set_state (priv->cssnode, GTK_STATE_FLAG_DIR_LTR);
   /* need to set correct type here, and only class has the correct type here */
-  if (GTK_WIDGET_GET_CLASS (widget)->priv->css_name)
-    gtk_css_node_set_name (priv->cssnode, GTK_WIDGET_GET_CLASS (widget)->priv->css_name);
-  else
-    gtk_css_node_set_widget_type (priv->cssnode, G_TYPE_FROM_CLASS (g_class));
+  gtk_css_node_set_widget_type (priv->cssnode, G_TYPE_FROM_CLASS (g_class));
+  if (GTK_WIDGET_CLASS (g_class)->priv->css_name)
+    gtk_css_node_set_name (priv->cssnode, GTK_WIDGET_CLASS (g_class)->priv->css_name);
   priv->style = gtk_widget_get_default_style ();

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]