[gtk+/wip/css: 115/154] stylecontext: Add _gtk_style_context_peek_property()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 115/154] stylecontext: Add _gtk_style_context_peek_property()
- Date: Sat, 7 Jan 2012 14:57:35 +0000 (UTC)
commit b55c8a6cfbdc8148bae9b93f2cea0227f93570f7
Author: Benjamin Otte <otte redhat com>
Date: Tue Jan 3 02:35:05 2012 +0100
stylecontext: Add _gtk_style_context_peek_property()
This allows peeking at the computed value for a property. This is useful
for looking at GtkCssImage.
gtk/gtkstylecontext.c | 21 +++++++++++++++++++++
gtk/gtkstylecontextprivate.h | 2 ++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 6588207..be0fb8a 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2298,6 +2298,27 @@ style_property_values_cmp (gconstpointer bsearch_node1,
}
const GValue *
+_gtk_style_context_peek_property (GtkStyleContext *context,
+ const char *property_name)
+{
+ GtkStyleProperty *property;
+ StyleData *data;
+
+ property = _gtk_style_property_lookup (property_name);
+ if (!GTK_IS_CSS_STYLE_PROPERTY (property))
+ {
+ g_warning ("Style property \"%s\" does not exist", property_name);
+ return NULL;
+ }
+
+ data = style_data_lookup (context, gtk_style_context_get_state (context));
+
+ return _gtk_style_properties_peek_property (data->store,
+ GTK_CSS_STYLE_PROPERTY (property),
+ 0);
+}
+
+const GValue *
_gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
GtkStateFlags state,
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index 981eda7..ffde8db 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -25,6 +25,8 @@
G_BEGIN_DECLS
+const GValue * _gtk_style_context_peek_property (GtkStyleContext *context,
+ const char *property_name);
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
GtkStateFlags state,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]