forked from AuroraMiddleware/gtk
Merge branch 'issue2780' into 'gtk-3-24'
cssnode: Bail out nicely if there is no settings See merge request GNOME/gtk!2646
This commit is contained in:
commit
c4c00461fe
@ -1432,6 +1432,7 @@ GtkStyleProviderPrivate *
|
|||||||
gtk_css_node_get_style_provider (GtkCssNode *cssnode)
|
gtk_css_node_get_style_provider (GtkCssNode *cssnode)
|
||||||
{
|
{
|
||||||
GtkStyleProviderPrivate *result;
|
GtkStyleProviderPrivate *result;
|
||||||
|
GtkSettings *settings;
|
||||||
|
|
||||||
result = gtk_css_node_get_style_provider_or_null (cssnode);
|
result = gtk_css_node_get_style_provider_or_null (cssnode);
|
||||||
if (result)
|
if (result)
|
||||||
@ -1440,7 +1441,11 @@ gtk_css_node_get_style_provider (GtkCssNode *cssnode)
|
|||||||
if (cssnode->parent)
|
if (cssnode->parent)
|
||||||
return gtk_css_node_get_style_provider (cssnode->parent);
|
return gtk_css_node_get_style_provider (cssnode->parent);
|
||||||
|
|
||||||
return GTK_STYLE_PROVIDER_PRIVATE (_gtk_settings_get_style_cascade (gtk_settings_get_default (), 1));
|
settings = gtk_settings_get_default ();
|
||||||
|
if (!settings)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return GTK_STYLE_PROVIDER_PRIVATE (_gtk_settings_get_style_cascade (settings, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -235,6 +235,7 @@ gtk_css_widget_node_get_style_provider (GtkCssNode *node)
|
|||||||
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
|
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GtkStyleCascade *cascade;
|
GtkStyleCascade *cascade;
|
||||||
|
GtkSettings *settings;
|
||||||
|
|
||||||
if (widget_node->widget == NULL)
|
if (widget_node->widget == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -243,6 +244,10 @@ gtk_css_widget_node_get_style_provider (GtkCssNode *node)
|
|||||||
if (context)
|
if (context)
|
||||||
return gtk_style_context_get_style_provider (context);
|
return gtk_style_context_get_style_provider (context);
|
||||||
|
|
||||||
|
settings = gtk_widget_get_settings (widget_node->widget);
|
||||||
|
if (!settings)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
cascade = _gtk_settings_get_style_cascade (gtk_widget_get_settings (widget_node->widget),
|
cascade = _gtk_settings_get_style_cascade (gtk_widget_get_settings (widget_node->widget),
|
||||||
gtk_widget_get_scale_factor (widget_node->widget));
|
gtk_widget_get_scale_factor (widget_node->widget));
|
||||||
return GTK_STYLE_PROVIDER_PRIVATE (cascade);
|
return GTK_STYLE_PROVIDER_PRIVATE (cascade);
|
||||||
|
@ -1843,12 +1843,13 @@ GtkStyleCascade *
|
|||||||
_gtk_settings_get_style_cascade (GtkSettings *settings,
|
_gtk_settings_get_style_cascade (GtkSettings *settings,
|
||||||
gint scale)
|
gint scale)
|
||||||
{
|
{
|
||||||
GtkSettingsPrivate *priv = settings->priv;
|
GtkSettingsPrivate *priv;
|
||||||
GtkStyleCascade *new_cascade;
|
GtkStyleCascade *new_cascade;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_SETTINGS (settings), NULL);
|
g_return_val_if_fail (GTK_IS_SETTINGS (settings), NULL);
|
||||||
|
|
||||||
|
priv = settings->priv;
|
||||||
for (list = priv->style_cascades; list; list = list->next)
|
for (list = priv->style_cascades; list; list = list->next)
|
||||||
{
|
{
|
||||||
if (_gtk_style_cascade_get_scale (list->data) == scale)
|
if (_gtk_style_cascade_get_scale (list->data) == scale)
|
||||||
|
Loading…
Reference in New Issue
Block a user