[gtk+/wip/css: 4/15] styleprovider: Add query function for keyframes
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 4/15] styleprovider: Add query function for keyframes
- Date: Fri, 18 May 2012 15:52:07 +0000 (UTC)
commit b6dd1d4aa6205b3c02a519713baaf810c46ea684
Author: Benjamin Otte <otte redhat com>
Date: Thu Apr 19 03:58:28 2012 +0200
styleprovider: Add query function for keyframes
gtk/gtkcssprovider.c | 10 ++++++++++
gtk/gtkstylecascade.c | 25 +++++++++++++++++++++++++
gtk/gtkstyleproviderprivate.c | 17 +++++++++++++++++
gtk/gtkstyleproviderprivate.h | 5 +++++
4 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 6806c5b..ef6f678 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -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;
}
diff --git a/gtk/gtkstylecascade.c b/gtk/gtkstylecascade.c
index 1b8e9f7..9ccd2f0 100644
--- a/gtk/gtkstylecascade.c
+++ b/gtk/gtkstylecascade.c
@@ -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;
}
diff --git a/gtk/gtkstyleproviderprivate.c b/gtk/gtkstyleproviderprivate.c
index c7284da..a0b75a9 100644
--- a/gtk/gtkstyleproviderprivate.c
+++ b/gtk/gtkstyleproviderprivate.c
@@ -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,
diff --git a/gtk/gtkstyleproviderprivate.h b/gtk/gtkstyleproviderprivate.h
index 0a66a8e..43675d1 100644
--- a/gtk/gtkstyleproviderprivate.h
+++ b/gtk/gtkstyleproviderprivate.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]