[gtk+/gtk-style-context: 21/347] GtkStyleContext: Add gtk_style_context_[gs]et_path()



commit d3815fe033fb44b09057d537a794819187aa1187
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Mar 13 11:15:42 2010 +0100

    GtkStyleContext: Add gtk_style_context_[gs]et_path()
    
    This relates a GtkStyleContext with a widget path, so
    all style querying would happen based on it.

 gtk/gtkstylecontext.c |   32 ++++++++++++++++++++++++++++++++
 gtk/gtkstylecontext.h |    8 +++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 85727e3..b19b02a 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -40,6 +40,8 @@ struct GtkStyleContextPrivate
 {
   GList *providers;
   GtkStyleSet *store;
+  GtkWidgetPath *widget_path;
+
   GtkStateFlags state_flags;
 };
 
@@ -325,5 +327,35 @@ gtk_style_context_is_state_set (GtkStyleContext *context,
     }
 }
 
+void
+gtk_style_context_set_path (GtkStyleContext *context,
+                            GtkWidgetPath   *path)
+{
+  GtkStyleContextPrivate *priv;
+
+  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+  g_return_if_fail (path != NULL);
+
+  priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context);
+
+  if (priv->widget_path)
+    {
+      gtk_widget_path_free (priv->widget_path);
+      priv->widget_path = NULL;
+    }
+
+  if (path)
+    priv->widget_path = gtk_widget_path_copy (path);
+}
+
+G_CONST_RETURN GtkWidgetPath *
+gtk_style_context_get_path (GtkStyleContext *context)
+{
+  GtkStyleContextPrivate *priv;
+
+  priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context);
+  return priv->widget_path;
+}
+
 #define __GTK_STYLE_CONTEXT_C__
 #include "gtkaliasdef.c"
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index edc6732..79f0f35 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -21,7 +21,8 @@
 #define __GTK_STYLE_CONTEXT_H__
 
 #include <glib-object.h>
-#include "gtkstyleprovider.h"
+#include <gtk/gtkstyleprovider.h>
+#include <gtk/gtkwidgetpath.h>
 
 G_BEGIN_DECLS
 
@@ -72,6 +73,11 @@ GtkStateFlags gtk_style_context_get_state    (GtkStyleContext *context);
 gboolean      gtk_style_context_is_state_set (GtkStyleContext *context,
                                               GtkStateType     state);
 
+void          gtk_style_context_set_path     (GtkStyleContext *context,
+                                              GtkWidgetPath   *path);
+G_CONST_RETURN GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
+
+
 G_END_DECLS
 
 #endif /* __GTK_STYLE_CONTEXT_H__ */



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