[gtk+/wip/baedert/drawing: 47/371] gizmo: Remove gadget



commit f0ebedcd30685da3874e048ab31c5d36d01ae180
Author: Timm Bäder <mail baedert org>
Date:   Thu May 4 08:13:07 2017 +0200

    gizmo: Remove gadget

 gtk/gtkgizmo.c        |   79 ++++++------------------------------------------
 gtk/gtkgizmoprivate.h |    4 --
 2 files changed, 10 insertions(+), 73 deletions(-)
---
diff --git a/gtk/gtkgizmo.c b/gtk/gtkgizmo.c
index dc941e2..5c065e5 100644
--- a/gtk/gtkgizmo.c
+++ b/gtk/gtkgizmo.c
@@ -1,7 +1,6 @@
 
 #include "gtkgizmoprivate.h"
 #include "gtkwidgetprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
 
 
 G_DEFINE_TYPE (GtkGizmo, gtk_gizmo, GTK_TYPE_WIDGET);
@@ -17,11 +16,10 @@ gtk_gizmo_measure (GtkWidget      *widget,
 {
   GtkGizmo *self = GTK_GIZMO (widget);
 
-  gtk_css_gadget_get_preferred_size (self->gadget,
-                                     orientation,
-                                     for_size,
-                                     minimum, natural,
-                                     minimum_baseline, natural_baseline);
+  if (self->measure_func)
+    self->measure_func (self, orientation, for_size,
+                        minimum, natural,
+                        minimum_baseline, natural_baseline);
 }
 
 static void
@@ -29,14 +27,13 @@ gtk_gizmo_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
   GtkGizmo *self = GTK_GIZMO (widget);
-  GtkAllocation clip;
-
-  GTK_WIDGET_CLASS (gtk_gizmo_parent_class)->size_allocate (widget, allocation);
+  GtkAllocation clip = *allocation;
 
-  gtk_css_gadget_allocate (self->gadget,
-                           allocation,
-                           gtk_widget_get_allocated_baseline (widget),
-                           &clip);
+  if (self->allocate_func)
+    self->allocate_func (self,
+                         allocation,
+                         gtk_widget_get_allocated_baseline (widget),
+                         &clip);
 
   gtk_widget_set_clip (widget, &clip);
 }
@@ -52,58 +49,10 @@ gtk_gizmo_snapshot (GtkWidget   *widget,
 }
 
 static void
-gtk_gizmo_measure_contents (GtkCssGadget   *gadget,
-                            GtkOrientation  orientation,
-                            int             for_size,
-                            int            *minimum,
-                            int            *natural,
-                            int            *minimum_baseline,
-                            int            *natural_baseline,
-                            gpointer        user_data)
-{
-  GtkGizmo *self = GTK_GIZMO (gtk_css_gadget_get_owner (gadget));
-
-  if (self->measure_func)
-    self->measure_func (self, orientation, for_size,
-                        minimum, natural,
-                        minimum_baseline, natural_baseline);
-}
-
-static void
-gtk_gizmo_allocate_contents (GtkCssGadget        *gadget,
-                             const GtkAllocation *allocation,
-                             int                  baseline,
-                             GtkAllocation       *out_clip,
-                             gpointer             user_data)
-
-{
-  GtkGizmo *self = GTK_GIZMO (gtk_css_gadget_get_owner (gadget));
-
-  if (self->allocate_func)
-    self->allocate_func (self,
-                         allocation,
-                         baseline,
-                         out_clip);
-}
-
-static void
-gtk_gizmo_finalize (GObject *obj)
-{
-  GtkGizmo *self = GTK_GIZMO (obj);
-
-  g_clear_object (&self->gadget);
-
-  G_OBJECT_CLASS (gtk_gizmo_parent_class)->finalize (obj);
-}
-
-static void
 gtk_gizmo_class_init (GtkGizmoClass *klass)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->finalize = gtk_gizmo_finalize;
-
   widget_class->measure = gtk_gizmo_measure;
   widget_class->size_allocate = gtk_gizmo_size_allocate;
   widget_class->snapshot = gtk_gizmo_snapshot;
@@ -113,14 +62,6 @@ static void
 gtk_gizmo_init (GtkGizmo *self)
 {
   gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
-
-  self->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (self)),
-                                                     GTK_WIDGET (self),
-                                                     gtk_gizmo_measure_contents,
-                                                     gtk_gizmo_allocate_contents,
-                                                     NULL,
-                                                     NULL,
-                                                     NULL);
 }
 
 GtkWidget *
diff --git a/gtk/gtkgizmoprivate.h b/gtk/gtkgizmoprivate.h
index 5fb7842..b5744b4 100644
--- a/gtk/gtkgizmoprivate.h
+++ b/gtk/gtkgizmoprivate.h
@@ -3,8 +3,6 @@
 #define __GTK_GIZMO_H__
 
 #include "gtkwidget.h"
-#include "gtkcssgadgetprivate.h"
-#include "gtkcsscustomgadgetprivate.h"
 
 #define GTK_TYPE_GIZMO                 (gtk_gizmo_get_type ())
 #define GTK_GIZMO(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GIZMO, GtkGizmo))
@@ -35,8 +33,6 @@ struct _GtkGizmo
 {
   GtkWidget parent_instance;
 
-  GtkCssGadget *gadget;
-
   GtkGizmoMeasureFunc  measure_func;
   GtkGizmoAllocateFunc allocate_func;
   GtkGizmoSnapshotFunc snapshot_func;


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