[gtk+/gtk-style-context: 20/206] GtkWidget: Add gtk_widget_get_path().



commit 957c89e54dd3b62aaa63f29848c58c182ec7b871
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Mar 12 19:02:33 2010 +0100

    GtkWidget: Add gtk_widget_get_path().
    
    This function composes and returns a GtkWidgetPath representing
    the passed widget.

 gtk/gtkwidget.c |   24 +++++++++++++++++++++++-
 gtk/gtkwidget.h |    3 +++
 2 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b056a29..d363d0f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11555,6 +11555,27 @@ gtk_widget_send_focus_change (GtkWidget *widget,
   return res;
 }
 
+GtkWidgetPath *
+gtk_widget_get_path (GtkWidget *widget)
+{
+  GtkWidgetPath *path;
+
+  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+  g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
+
+  path = gtk_widget_path_new ();
+
+  while (widget)
+    {
+      gtk_widget_path_prepend_widget_desc (path,
+                                           G_OBJECT_TYPE (widget),
+                                           widget->name);
+      widget = widget->parent;
+    }
+
+  return path;
+}
+
 GtkStyleContext *
 gtk_widget_get_style_context (GtkWidget *widget)
 {
@@ -11568,7 +11589,8 @@ gtk_widget_get_style_context (GtkWidget *widget)
   if (G_UNLIKELY (!context))
     {
       context = g_object_new (GTK_TYPE_STYLE_CONTEXT, NULL);
-      g_object_set_qdata_full (widget, quark_style_context, context,
+      g_object_set_qdata_full (G_OBJECT (widget),
+                               quark_style_context, context,
                                (GDestroyNotify) g_object_unref);
     }
 
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 1ca5ab5..f42e072 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -38,6 +38,7 @@
 #include <gtk/gtkstyle.h>
 #include <gtk/gtksettings.h>
 #include <gtk/gtkstylecontext.h>
+#include <gtk/gtkwidgetpath.h>
 #include <atk/atk.h>
 
 G_BEGIN_DECLS
@@ -997,6 +998,8 @@ void         _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
 
 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
 
+GtkWidgetPath *   gtk_widget_get_path (GtkWidget *widget);
+
 
 G_END_DECLS
 



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