[gtk+] styleproperties: Adapt _gtk_style_properties_peek_property()



commit 5f5cc7962333be185f8cc35bdefbab8def3a51fd
Author: Benjamin Otte <otte redhat com>
Date:   Sat May 21 17:19:50 2011 +0200

    styleproperties: Adapt _gtk_style_properties_peek_property()
    
    Optionally return the GtkStyleProperty that was looked up. This feature
    isn't used yet, but will soon be.

 gtk/gtkstylecontext.c           |   26 +++++++++++++++++++-------
 gtk/gtkstyleproperties.c        |    9 ++++++---
 gtk/gtkstylepropertiesprivate.h |   16 +++++++++-------
 3 files changed, 34 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index ca0c96e..e96faea 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3363,7 +3363,9 @@ gtk_style_context_get_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "color", state);
+                                               "color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3402,7 +3404,9 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "background-color", state);
+                                               "background-color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3441,7 +3445,9 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "border-color", state);
+                                               "border-color",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3481,7 +3487,9 @@ gtk_style_context_get_border (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "border-width", state);
+                                               "border-width",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3521,7 +3529,9 @@ gtk_style_context_get_padding (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "padding", state);
+                                               "padding",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3561,7 +3571,9 @@ gtk_style_context_get_margin (GtkStyleContext *context,
 
   data = style_data_lookup (context);
   value = _gtk_style_properties_peek_property (data->store,
-                                               "margin", state);
+                                               "margin",
+                                               state,
+                                               NULL);
 
   if (value)
     {
@@ -3599,7 +3611,7 @@ gtk_style_context_get_font (GtkStyleContext *context,
   g_return_val_if_fail (priv->widget_path != NULL, NULL);
 
   data = style_data_lookup (context);
-  value = _gtk_style_properties_peek_property (data->store, "font", state);
+  value = _gtk_style_properties_peek_property (data->store, "font", state, NULL);
 
   if (value)
     return g_value_get_boxed (value);
diff --git a/gtk/gtkstyleproperties.c b/gtk/gtkstyleproperties.c
index 2fd806b..2b7f90d 100644
--- a/gtk/gtkstyleproperties.c
+++ b/gtk/gtkstyleproperties.c
@@ -799,9 +799,10 @@ lookup_default_value (const GtkStyleProperty *node,
 }
 
 const GValue *
-_gtk_style_properties_peek_property (GtkStyleProperties *props,
-                                     const gchar        *prop_name,
-                                     GtkStateFlags       state)
+_gtk_style_properties_peek_property (GtkStyleProperties      *props,
+                                     const gchar             *prop_name,
+                                     GtkStateFlags            state,
+                                     const GtkStyleProperty **property)
 {
   GtkStylePropertiesPrivate *priv;
   const GtkStyleProperty *node;
@@ -812,6 +813,8 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
   g_return_val_if_fail (prop_name != NULL, NULL);
 
   node = _gtk_style_property_lookup (prop_name);
+  if (property)
+    *property = node;
 
   if (!node)
     {
diff --git a/gtk/gtkstylepropertiesprivate.h b/gtk/gtkstylepropertiesprivate.h
index f4cea2d..a75da44 100644
--- a/gtk/gtkstylepropertiesprivate.h
+++ b/gtk/gtkstylepropertiesprivate.h
@@ -21,17 +21,19 @@
 #define __GTK_STYLE_PROPERTIES_PRIVATE_H__
 
 #include "gtkstyleproperties.h"
+#include "gtkstylepropertyprivate.h"
 
 G_BEGIN_DECLS
 
-const GValue * _gtk_style_properties_peek_property         (GtkStyleProperties *props,
-                                                            const gchar        *prop_name,
-                                                            GtkStateFlags       state);
+const GValue * _gtk_style_properties_peek_property         (GtkStyleProperties      *props,
+                                                            const gchar             *prop_name,
+                                                            GtkStateFlags            state,
+                                                            const GtkStyleProperty **property);
 
-void           _gtk_style_properties_set_property_by_pspec (GtkStyleProperties *props,
-                                                            GParamSpec         *pspec,
-                                                            GtkStateFlags       state,
-                                                            const GValue       *value);
+void           _gtk_style_properties_set_property_by_pspec (GtkStyleProperties      *props,
+                                                            GParamSpec              *pspec,
+                                                            GtkStateFlags            state,
+                                                            const GValue            *value);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]