Merge branch 'css-classes-notify' into 'main'
css: Avoid redundant change notification Closes #7111 See merge request GNOME/gtk!7871
This commit is contained in:
@@ -1203,7 +1203,7 @@ gtk_css_node_get_classes (GtkCssNode *cssnode)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gtk_css_node_add_class (GtkCssNode *cssnode,
|
gtk_css_node_add_class (GtkCssNode *cssnode,
|
||||||
GQuark style_class)
|
GQuark style_class)
|
||||||
{
|
{
|
||||||
@@ -1211,10 +1211,13 @@ gtk_css_node_add_class (GtkCssNode *cssnode,
|
|||||||
{
|
{
|
||||||
gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_CLASS);
|
gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_CLASS);
|
||||||
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_CLASSES]);
|
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_CLASSES]);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
gtk_css_node_remove_class (GtkCssNode *cssnode,
|
gtk_css_node_remove_class (GtkCssNode *cssnode,
|
||||||
GQuark style_class)
|
GQuark style_class)
|
||||||
{
|
{
|
||||||
@@ -1222,7 +1225,10 @@ gtk_css_node_remove_class (GtkCssNode *cssnode,
|
|||||||
{
|
{
|
||||||
gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_CLASS);
|
gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_CLASS);
|
||||||
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_CLASSES]);
|
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_CLASSES]);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|||||||
@@ -128,9 +128,9 @@ GtkStateFlags gtk_css_node_get_state (GtkCssNode *
|
|||||||
void gtk_css_node_set_classes (GtkCssNode *cssnode,
|
void gtk_css_node_set_classes (GtkCssNode *cssnode,
|
||||||
const char **classes);
|
const char **classes);
|
||||||
char ** gtk_css_node_get_classes (GtkCssNode *cssnode);
|
char ** gtk_css_node_get_classes (GtkCssNode *cssnode);
|
||||||
void gtk_css_node_add_class (GtkCssNode *cssnode,
|
gboolean gtk_css_node_add_class (GtkCssNode *cssnode,
|
||||||
GQuark style_class);
|
GQuark style_class);
|
||||||
void gtk_css_node_remove_class (GtkCssNode *cssnode,
|
gboolean gtk_css_node_remove_class (GtkCssNode *cssnode,
|
||||||
GQuark style_class);
|
GQuark style_class);
|
||||||
gboolean gtk_css_node_has_class (GtkCssNode *cssnode,
|
gboolean gtk_css_node_has_class (GtkCssNode *cssnode,
|
||||||
GQuark style_class) G_GNUC_PURE;
|
GQuark style_class) G_GNUC_PURE;
|
||||||
|
|||||||
@@ -13053,8 +13053,8 @@ gtk_widget_add_css_class (GtkWidget *widget,
|
|||||||
g_return_if_fail (css_class[0] != '\0');
|
g_return_if_fail (css_class[0] != '\0');
|
||||||
g_return_if_fail (css_class[0] != '.');
|
g_return_if_fail (css_class[0] != '.');
|
||||||
|
|
||||||
gtk_css_node_add_class (priv->cssnode, g_quark_from_string (css_class));
|
if (gtk_css_node_add_class (priv->cssnode, g_quark_from_string (css_class)))
|
||||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CSS_CLASSES]);
|
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CSS_CLASSES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13083,8 +13083,8 @@ gtk_widget_remove_css_class (GtkWidget *widget,
|
|||||||
if (!class_quark)
|
if (!class_quark)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_css_node_remove_class (priv->cssnode, class_quark);
|
if (gtk_css_node_remove_class (priv->cssnode, class_quark))
|
||||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CSS_CLASSES]);
|
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CSS_CLASSES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user