forked from AuroraMiddleware/gtk
inspector: Fix quick-fix
Constructing GtkCssStyleChange objects without styles is forbidden, so don't do it. Instead untangle the callback from the actual update function and call that untangled function directly.
This commit is contained in:
parent
f6606c4f6f
commit
26d536a69b
@ -532,16 +532,12 @@ gtk_inspector_css_node_tree_set_object (GtkInspectorCssNodeTree *cnt,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_css_node_tree_update_style (GtkCssNode *node,
|
||||
GtkCssStyleChange *change,
|
||||
GtkInspectorCssNodeTree *cnt)
|
||||
gtk_inspector_css_node_tree_update_style (GtkInspectorCssNodeTree *cnt,
|
||||
GtkCssStyle *new_style)
|
||||
{
|
||||
GtkInspectorCssNodeTreePrivate *priv = cnt->priv;
|
||||
GtkCssStyle *new_style;
|
||||
gint i;
|
||||
|
||||
new_style = gtk_css_style_change_get_new_style (change);
|
||||
|
||||
for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
|
||||
{
|
||||
GtkCssStyleProperty *prop;
|
||||
@ -583,12 +579,19 @@ gtk_inspector_css_node_tree_update_style (GtkCssNode *node,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_css_node_tree_update_style_cb (GtkCssNode *node,
|
||||
GtkCssStyleChange *change,
|
||||
GtkInspectorCssNodeTree *cnt)
|
||||
{
|
||||
gtk_inspector_css_node_tree_update_style (cnt, gtk_css_style_change_get_new_style (change));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_css_node_tree_set_node (GtkInspectorCssNodeTree *cnt,
|
||||
GtkCssNode *node)
|
||||
{
|
||||
GtkInspectorCssNodeTreePrivate *priv = cnt->priv;
|
||||
GtkCssStyleChange change;
|
||||
GString *s;
|
||||
GType type;
|
||||
const gchar *name;
|
||||
@ -601,21 +604,13 @@ gtk_inspector_css_node_tree_set_node (GtkInspectorCssNodeTree *cnt,
|
||||
if (node)
|
||||
g_object_ref (node);
|
||||
|
||||
gtk_css_style_change_init (&change,
|
||||
node ? gtk_css_node_get_style (node) : NULL,
|
||||
priv->node ? gtk_css_node_get_style (priv->node) : NULL);
|
||||
|
||||
gtk_inspector_css_node_tree_update_style (node,
|
||||
&change,
|
||||
cnt);
|
||||
|
||||
gtk_css_style_change_finish (&change);
|
||||
gtk_inspector_css_node_tree_update_style (cnt, node ? gtk_css_node_get_style (node) : NULL);
|
||||
|
||||
gtk_inspector_css_node_tree_unset_node (cnt);
|
||||
|
||||
priv->node = node;
|
||||
|
||||
g_signal_connect (node, "style-changed", G_CALLBACK (gtk_inspector_css_node_tree_update_style), cnt);
|
||||
g_signal_connect (node, "style-changed", G_CALLBACK (gtk_inspector_css_node_tree_update_style_cb), cnt);
|
||||
|
||||
s = g_string_new ("");
|
||||
type = gtk_css_node_get_widget_type (node);
|
||||
|
Loading…
Reference in New Issue
Block a user