Commit e6c951a3 authored by Benjamin Otte's avatar Benjamin Otte

styleprovider: Add query function for keyframes

parent cdbc6f48
......@@ -1573,6 +1573,15 @@ gtk_css_style_provider_get_color (GtkStyleProviderPrivate *provider,
return g_hash_table_lookup (css_provider->priv->symbolic_colors, name);
}
static GtkCssKeyframes *
gtk_css_style_provider_get_keyframes (GtkStyleProviderPrivate *provider,
const char *name)
{
GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
return g_hash_table_lookup (css_provider->priv->keyframes, name);
}
static void
gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
......@@ -1652,6 +1661,7 @@ static void
gtk_css_style_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_color = gtk_css_style_provider_get_color;
iface->get_keyframes = gtk_css_style_provider_get_keyframes;
iface->lookup = gtk_css_style_provider_lookup;
iface->get_change = gtk_css_style_provider_get_change;
}
......
......@@ -172,6 +172,30 @@ gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider,
return NULL;
}
GtkCssKeyframes *
gtk_style_cascade_get_keyframes (GtkStyleProviderPrivate *provider,
const char *name)
{
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
GtkStyleCascadeIter iter;
GtkCssKeyframes *keyframes;
GtkStyleProvider *item;
for (item = gtk_style_cascade_iter_init (cascade, &iter);
item;
item = gtk_style_cascade_iter_next (cascade, &iter))
{
if (!GTK_IS_STYLE_PROVIDER_PRIVATE (item))
continue;
keyframes = _gtk_style_provider_private_get_keyframes (GTK_STYLE_PROVIDER_PRIVATE (item), name);
if (keyframes)
return keyframes;
}
return NULL;
}
static void
gtk_style_cascade_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
......@@ -230,6 +254,7 @@ static void
gtk_style_cascade_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface)
{
iface->get_color = gtk_style_cascade_get_color;
iface->get_keyframes = gtk_style_cascade_get_keyframes;
iface->lookup = gtk_style_cascade_lookup;
iface->get_change = gtk_style_cascade_get_change;
}
......
......@@ -60,6 +60,23 @@ _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
return iface->get_color (provider, name);
}
GtkCssKeyframes *
_gtk_style_provider_private_get_keyframes (GtkStyleProviderPrivate *provider,
const char *name)
{
GtkStyleProviderPrivateInterface *iface;
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
g_return_val_if_fail (name != NULL, NULL);
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
if (!iface->get_keyframes)
return NULL;
return iface->get_keyframes (provider, name);
}
void
_gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
......
......@@ -19,6 +19,7 @@
#define __GTK_STYLE_PROVIDER_PRIVATE_H__
#include <glib-object.h>
#include "gtk/gtkcsskeyframesprivate.h"
#include "gtk/gtkcsslookupprivate.h"
#include "gtk/gtkcssmatcherprivate.h"
#include <gtk/gtkenums.h>
......@@ -41,6 +42,8 @@ struct _GtkStyleProviderPrivateInterface
GtkSymbolicColor * (* get_color) (GtkStyleProviderPrivate *provider,
const char *name);
GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider,
const char *name);
void (* lookup) (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
GtkCssLookup *lookup);
......@@ -55,6 +58,8 @@ GType _gtk_style_provider_private_get_type (void) G_GNUC_C
GtkSymbolicColor * _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
const char *name);
GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider,
const char *name);
void _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
const GtkCssMatcher *matcher,
GtkCssLookup *lookup);
......
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