Commit 6443baad authored by Benjamin Otte's avatar Benjamin Otte

styleprovider: Make all implementors emit the new signal

... and listen to it in the cases where they use other style providers.
parent 74f4c6f6
......@@ -2537,6 +2537,8 @@ gtk_css_provider_load_from_data (GtkCssProvider *css_provider,
g_free (free_data);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (css_provider));
return ret;
}
......@@ -2556,12 +2558,18 @@ gtk_css_provider_load_from_file (GtkCssProvider *css_provider,
GFile *file,
GError **error)
{
gboolean success;
g_return_val_if_fail (GTK_IS_CSS_PROVIDER (css_provider), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
gtk_css_provider_reset (css_provider);
return gtk_css_provider_load_internal (css_provider, NULL, file, NULL, error);
success = gtk_css_provider_load_internal (css_provider, NULL, file, NULL, error);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (css_provider));
return success;
}
/**
......
......@@ -210,6 +210,7 @@ modifier_style_set_color (GtkModifierStyle *style,
gtk_style_properties_unset_property (priv->style, prop, state);
g_signal_emit (style, signals[CHANGED], 0);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
}
void
......@@ -250,6 +251,7 @@ _gtk_modifier_style_set_font (GtkModifierStyle *style,
gtk_style_properties_unset_property (priv->style, "font", 0);
g_signal_emit (style, signals[CHANGED], 0);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
}
void
......@@ -272,6 +274,7 @@ _gtk_modifier_style_map_color (GtkModifierStyle *style,
name, symbolic_color);
g_signal_emit (style, signals[CHANGED], 0);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
}
void
......@@ -312,4 +315,5 @@ _gtk_modifier_style_set_color_property (GtkModifierStyle *style,
}
g_signal_emit (style, signals[CHANGED], 0);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
}
......@@ -1738,6 +1738,8 @@ settings_invalidate_style (GtkSettings *settings)
g_object_unref (priv->style);
priv->style = NULL;
}
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (settings));
}
static void
......
......@@ -34,6 +34,7 @@ struct _GtkStyleProviderData
{
GtkStyleProvider *provider;
guint priority;
guint changed_signal_id;
};
static GtkStyleProvider *
......@@ -263,6 +264,7 @@ style_provider_data_clear (gpointer data_)
{
GtkStyleProviderData *data = data_;
g_signal_handler_disconnect (data->provider, data->changed_signal_id);
g_object_unref (data->provider);
}
......@@ -313,10 +315,21 @@ _gtk_style_cascade_set_parent (GtkStyleCascade *cascade,
return;
if (parent)
g_object_ref (parent);
{
g_object_ref (parent);
g_signal_connect_swapped (parent,
"-gtk-private-changed",
G_CALLBACK (_gtk_style_provider_private_changed),
cascade);
}
if (cascade->parent)
g_object_unref (cascade->parent);
{
g_signal_handlers_disconnect_by_func (cascade->parent,
_gtk_style_provider_private_changed,
cascade);
g_object_unref (cascade->parent);
}
cascade->parent = parent;
}
......@@ -335,6 +348,10 @@ _gtk_style_cascade_add_provider (GtkStyleCascade *cascade,
data.provider = g_object_ref (provider);
data.priority = priority;
data.changed_signal_id = g_signal_connect_swapped (provider,
"-gtk-private-changed",
G_CALLBACK (_gtk_style_provider_private_changed),
cascade);
/* ensure it gets removed first */
_gtk_style_cascade_remove_provider (cascade, provider);
......@@ -345,6 +362,8 @@ _gtk_style_cascade_add_provider (GtkStyleCascade *cascade,
break;
}
g_array_insert_val (cascade->providers, i, data);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (cascade));
}
void
......@@ -363,6 +382,8 @@ _gtk_style_cascade_remove_provider (GtkStyleCascade *cascade,
if (data->provider == provider)
{
g_array_remove_index (cascade->providers, i);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (cascade));
break;
}
}
......
......@@ -399,6 +399,8 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
g_hash_table_replace (priv->color_map,
g_strdup (name),
gtk_symbolic_color_ref (color));
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
......@@ -453,6 +455,8 @@ _gtk_style_properties_set_property_by_property (GtkStyleProperties *props,
_gtk_css_value_unref (val->value);
val->value = _gtk_css_value_ref (value);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
......@@ -797,6 +801,8 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
data->value = NULL;
g_array_remove_index (prop->values, pos);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
}
......@@ -815,6 +821,8 @@ gtk_style_properties_clear (GtkStyleProperties *props)
priv = props->priv;
g_hash_table_remove_all (priv->properties);
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
/**
......@@ -935,4 +943,6 @@ gtk_style_properties_merge (GtkStyleProperties *props,
}
}
}
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment