[hippo-canvas] Remove custom floating references



commit caba7f5536abb8b2feb3e62a2007198832000fa8
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Fri Jun 11 13:52:08 2010 +0200

    Remove custom floating references

 common/hippo/hippo-canvas-box.c          |   18 +-----------------
 common/hippo/hippo-canvas-box.h          |    1 -
 common/hippo/hippo-canvas-item.c         |    8 --------
 common/hippo/hippo-canvas-item.h         |    2 --
 docs/hippo-canvas-sections.txt           |    1 -
 docs/tmpl/hippo-canvas-box.sgml          |    4 ++++
 docs/tmpl/hippo-canvas-container.sgml    |    3 +++
 docs/tmpl/hippo-canvas-context.sgml      |    3 +++
 docs/tmpl/hippo-canvas-gradient.sgml     |    4 ++++
 docs/tmpl/hippo-canvas-image-button.sgml |    4 ++++
 docs/tmpl/hippo-canvas-image.sgml        |    4 ++++
 docs/tmpl/hippo-canvas-item.sgml         |   13 +++----------
 docs/tmpl/hippo-canvas-layout.sgml       |    4 ++++
 docs/tmpl/hippo-canvas-link.sgml         |    4 ++++
 docs/tmpl/hippo-canvas-style.sgml        |    3 +++
 docs/tmpl/hippo-canvas-text.sgml         |    4 ++++
 docs/tmpl/hippo-canvas-unused.sgml       |    7 +++++++
 docs/tmpl/hippo-canvas-util.sgml         |    4 ++++
 docs/tmpl/hippo-canvas-widgets.sgml      |    3 +++
 docs/tmpl/hippo-event.sgml               |    4 ++++
 docs/tmpl/hippo-graphics.sgml            |    4 ++++
 linux/hippo/hippo-canvas-helper.c        |    3 +--
 python/hippo.defs                        |    6 ------
 python/hippomodule.c                     |   14 --------------
 24 files changed, 64 insertions(+), 61 deletions(-)
---
diff --git a/common/hippo/hippo-canvas-box.c b/common/hippo/hippo-canvas-box.c
index 3c39e79..336c11d 100644
--- a/common/hippo/hippo-canvas-box.c
+++ b/common/hippo/hippo-canvas-box.c
@@ -84,7 +84,6 @@ static void             hippo_canvas_box_set_child_visible      (HippoCanvasCont
                                                                  gboolean              visible);
 
 /* Canvas item methods */
-static void               hippo_canvas_box_sink                (HippoCanvasItem    *item);
 static HippoCanvasContext* hippo_canvas_box_get_context        (HippoCanvasItem    *item);
 static void               hippo_canvas_box_set_context         (HippoCanvasItem    *item,
                                                                 HippoCanvasContext *context);
@@ -230,7 +229,6 @@ G_DEFINE_TYPE_WITH_CODE(HippoCanvasBox, hippo_canvas_box, G_TYPE_OBJECT,
 static void
 hippo_canvas_box_iface_init(HippoCanvasItemIface *klass)
 {
-    klass->sink = hippo_canvas_box_sink;
     klass->get_context = hippo_canvas_box_get_context;
     klass->set_context = hippo_canvas_box_set_context;
     klass->set_parent = hippo_canvas_box_set_parent;
@@ -278,7 +276,6 @@ hippo_canvas_box_iface_init_container (HippoCanvasContainerIface *klass)
 static void
 hippo_canvas_box_init(HippoCanvasBox *box)
 {
-    box->floating = TRUE;
     box->orientation = HIPPO_ORIENTATION_VERTICAL;
     box->x_align = HIPPO_ALIGNMENT_FILL;
     box->y_align = HIPPO_ALIGNMENT_FILL;
@@ -796,7 +793,6 @@ hippo_canvas_box_finalize(GObject *object)
 {
     HippoCanvasBox *box = HIPPO_CANVAS_BOX(object);
 
-    g_assert(!box->floating);        /* if there's still a floating ref how did we get finalized? */
     g_assert(box->children == NULL); /* should have vanished in dispose */
 
     g_free(box->tooltip);
@@ -1394,17 +1390,6 @@ hippo_canvas_box_style_changed(HippoCanvasContext   *context,
 }
 
 static void
-hippo_canvas_box_sink(HippoCanvasItem    *item)
-{
-    HippoCanvasBox *box = HIPPO_CANVAS_BOX(item);
-
-    if (box->floating) {
-        box->floating = FALSE;
-        g_object_unref(box);
-    }
-}
-
-static void
 on_context_style_changed(HippoCanvasContext *context,
                          gboolean            resize_needed,
                          HippoCanvasBox     *box)
@@ -4102,8 +4087,7 @@ child_create_from_item(HippoCanvasBox              *box,
 {
     BoxChildPrivate *c;
 
-    g_object_ref(child);
-    hippo_canvas_item_sink(child);
+    g_object_ref_sink(child);
     connect_child(box, child);
     c = g_new0(BoxChildPrivate, 1);
     c->ref_count = 1;
diff --git a/common/hippo/hippo-canvas-box.h b/common/hippo/hippo-canvas-box.h
index 29c5aad..2ad0b43 100644
--- a/common/hippo/hippo-canvas-box.h
+++ b/common/hippo/hippo-canvas-box.h
@@ -111,7 +111,6 @@ struct _HippoCanvasBox {
     
     guint8 spacing;
 
-    guint floating : 1;
     guint needs_width_request : 1;
     guint needs_height_request : 1;
     guint needs_allocate : 1;
diff --git a/common/hippo/hippo-canvas-item.c b/common/hippo/hippo-canvas-item.c
index 86f233e..30b9d0e 100644
--- a/common/hippo/hippo-canvas-item.c
+++ b/common/hippo/hippo-canvas-item.c
@@ -235,14 +235,6 @@ hippo_canvas_item_class_init(void *g_iface)
         
 }
 
-void
-hippo_canvas_item_sink(HippoCanvasItem    *canvas_item)
-{
-    g_return_if_fail(HIPPO_IS_CANVAS_ITEM(canvas_item));
-
-    HIPPO_CANVAS_ITEM_GET_IFACE(canvas_item)->sink(canvas_item);
-}
-
 /**
  * hippo_canvas_item_destroy:
  * @HippoCanvasItem: the canvas item
diff --git a/common/hippo/hippo-canvas-item.h b/common/hippo/hippo-canvas-item.h
index da296c6..5563b3c 100644
--- a/common/hippo/hippo-canvas-item.h
+++ b/common/hippo/hippo-canvas-item.h
@@ -32,7 +32,6 @@ typedef enum {
 struct _HippoCanvasItemIface {
     GTypeInterface base_iface;
 
-    void                   (* sink)                 (HippoCanvasItem *canvas_item);
     HippoCanvasContext*    (* get_context)          (HippoCanvasItem *canvas_item);
     void                   (* set_context)          (HippoCanvasItem      *canvas_item,
                                                      HippoCanvasContext   *context);
@@ -86,7 +85,6 @@ struct _HippoCanvasItemIface {
 };
 
 GType                 hippo_canvas_item_get_type           (void) G_GNUC_CONST;
-void                  hippo_canvas_item_sink               (HippoCanvasItem    *canvas_item);
 void                  hippo_canvas_item_destroy            (HippoCanvasItem    *canvas_item);
 HippoCanvasContext*   hippo_canvas_item_get_context        (HippoCanvasItem    *canvas_item);
 void                  hippo_canvas_item_set_context        (HippoCanvasItem    *canvas_item,
diff --git a/docs/hippo-canvas-sections.txt b/docs/hippo-canvas-sections.txt
index 89d6aed..d8a1384 100644
--- a/docs/hippo-canvas-sections.txt
+++ b/docs/hippo-canvas-sections.txt
@@ -195,7 +195,6 @@ HippoCanvasItemIface
 HippoCanvasPointer
 HippoItemAlignment
 HippoCanvasItemIface
-hippo_canvas_item_sink
 hippo_canvas_item_destroy
 hippo_canvas_item_set_context
 hippo_canvas_item_set_parent
diff --git a/docs/tmpl/hippo-canvas-box.sgml b/docs/tmpl/hippo-canvas-box.sgml
index 54ecad4..8ef0b36 100644
--- a/docs/tmpl/hippo-canvas-box.sgml
+++ b/docs/tmpl/hippo-canvas-box.sgml
@@ -17,6 +17,9 @@ HippoCanvasBox
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### ENUM HippoPackFlags ##### -->
 <para>
 
@@ -201,6 +204,7 @@ HippoCanvasBox
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-container.sgml b/docs/tmpl/hippo-canvas-container.sgml
index 15e6f70..7bd6962 100644
--- a/docs/tmpl/hippo-canvas-container.sgml
+++ b/docs/tmpl/hippo-canvas-container.sgml
@@ -17,6 +17,9 @@ HippoCanvasContainer
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasContainer ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-canvas-context.sgml b/docs/tmpl/hippo-canvas-context.sgml
index 0cc4179..5e907b1 100644
--- a/docs/tmpl/hippo-canvas-context.sgml
+++ b/docs/tmpl/hippo-canvas-context.sgml
@@ -17,6 +17,9 @@ HippoCanvasContext
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### ENUM HippoStockColor ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-canvas-gradient.sgml b/docs/tmpl/hippo-canvas-gradient.sgml
index 9a1b8cf..8fc86b2 100644
--- a/docs/tmpl/hippo-canvas-gradient.sgml
+++ b/docs/tmpl/hippo-canvas-gradient.sgml
@@ -17,6 +17,9 @@ HippoCanvasGradient
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasGradient ##### -->
 <para>
 
@@ -38,6 +41,7 @@ HippoCanvasGradient
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-image-button.sgml b/docs/tmpl/hippo-canvas-image-button.sgml
index b4ab1fe..6c57e51 100644
--- a/docs/tmpl/hippo-canvas-image-button.sgml
+++ b/docs/tmpl/hippo-canvas-image-button.sgml
@@ -17,6 +17,9 @@ HippoCanvasImageButton
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasImageButton ##### -->
 <para>
 
@@ -48,6 +51,7 @@ HippoCanvasImageButton
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-image.sgml b/docs/tmpl/hippo-canvas-image.sgml
index e211c84..a959210 100644
--- a/docs/tmpl/hippo-canvas-image.sgml
+++ b/docs/tmpl/hippo-canvas-image.sgml
@@ -17,6 +17,9 @@ HippoCanvasImage
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasImage ##### -->
 <para>
 
@@ -48,6 +51,7 @@ HippoCanvasImage
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-item.sgml b/docs/tmpl/hippo-canvas-item.sgml
index 04890bf..bab3ba6 100644
--- a/docs/tmpl/hippo-canvas-item.sgml
+++ b/docs/tmpl/hippo-canvas-item.sgml
@@ -17,6 +17,9 @@ HippoCanvasItem
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasItem ##### -->
 <para>
 
@@ -129,7 +132,6 @@ HippoCanvasItem
 </para>
 
 @base_iface: 
- sink: 
 @get_context: 
 @set_context: 
 @set_parent: 
@@ -177,7 +179,6 @@ HippoCanvasItem
 </para>
 
 @base_iface: 
- sink: 
 @get_context: 
 @set_context: 
 @set_parent: 
@@ -200,14 +201,6 @@ HippoCanvasItem
 @get_pointer: 
 @scroll_event: 
 
-<!-- ##### FUNCTION hippo_canvas_item_sink ##### -->
-<para>
-
-</para>
-
- canvas_item: 
-
-
 <!-- ##### FUNCTION hippo_canvas_item_destroy ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-canvas-layout.sgml b/docs/tmpl/hippo-canvas-layout.sgml
index 25f922f..103424c 100644
--- a/docs/tmpl/hippo-canvas-layout.sgml
+++ b/docs/tmpl/hippo-canvas-layout.sgml
@@ -17,6 +17,9 @@ HippoCanvasLayout
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasLayout ##### -->
 <para>
 
@@ -65,6 +68,7 @@ HippoCanvasLayout
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-link.sgml b/docs/tmpl/hippo-canvas-link.sgml
index 8197c59..ae510e1 100644
--- a/docs/tmpl/hippo-canvas-link.sgml
+++ b/docs/tmpl/hippo-canvas-link.sgml
@@ -17,6 +17,9 @@ HippoCanvasLink
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasLink ##### -->
 <para>
 
@@ -33,6 +36,7 @@ HippoCanvasLink
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-style.sgml b/docs/tmpl/hippo-canvas-style.sgml
index e8ae188..de5bb23 100644
--- a/docs/tmpl/hippo-canvas-style.sgml
+++ b/docs/tmpl/hippo-canvas-style.sgml
@@ -17,6 +17,9 @@ HippoCanvasStyle
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### STRUCT HippoCanvasStyle ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-canvas-text.sgml b/docs/tmpl/hippo-canvas-text.sgml
index a9ef7f6..7945d7f 100644
--- a/docs/tmpl/hippo-canvas-text.sgml
+++ b/docs/tmpl/hippo-canvas-text.sgml
@@ -17,6 +17,9 @@ HippoCanvasText
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### ENUM HippoCanvasSizeMode ##### -->
 <para>
 
@@ -62,6 +65,7 @@ HippoCanvasText
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-unused.sgml b/docs/tmpl/hippo-canvas-unused.sgml
index 6d69dd7..799c999 100644
--- a/docs/tmpl/hippo-canvas-unused.sgml
+++ b/docs/tmpl/hippo-canvas-unused.sgml
@@ -78,6 +78,13 @@
 @context: 
 @font_desc: 
 
+<!-- ##### FUNCTION hippo_canvas_item_sink ##### -->
+<para>
+
+</para>
+
+ canvas_item: 
+
 <!-- ##### FUNCTION hippo_canvas_style_affect_color ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-canvas-util.sgml b/docs/tmpl/hippo-canvas-util.sgml
index fc70758..742501d 100644
--- a/docs/tmpl/hippo-canvas-util.sgml
+++ b/docs/tmpl/hippo-canvas-util.sgml
@@ -17,6 +17,9 @@ Utilitites
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### MACRO HIPPO_TYPE_CAIRO_SURFACE ##### -->
 <para>
 
@@ -29,6 +32,7 @@ Utilitites
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-canvas-widgets.sgml b/docs/tmpl/hippo-canvas-widgets.sgml
index 29dded0..6cc4173 100644
--- a/docs/tmpl/hippo-canvas-widgets.sgml
+++ b/docs/tmpl/hippo-canvas-widgets.sgml
@@ -17,6 +17,9 @@ Widgets
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### MACRO HIPPO_DECLARE_WIDGET_ITEM ##### -->
 <para>
 
diff --git a/docs/tmpl/hippo-event.sgml b/docs/tmpl/hippo-event.sgml
index 8661ffc..c7d81b7 100644
--- a/docs/tmpl/hippo-event.sgml
+++ b/docs/tmpl/hippo-event.sgml
@@ -17,6 +17,9 @@ HippoEvent
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### MACRO HIPPO_TYPE_EVENT ##### -->
 <para>
 
@@ -78,6 +81,7 @@ HippoEvent
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/docs/tmpl/hippo-graphics.sgml b/docs/tmpl/hippo-graphics.sgml
index 4bc9331..2a91fd8 100644
--- a/docs/tmpl/hippo-graphics.sgml
+++ b/docs/tmpl/hippo-graphics.sgml
@@ -17,6 +17,9 @@ Graphics
 <!-- ##### SECTION Stability_Level ##### -->
 
 
+<!-- ##### SECTION Image ##### -->
+
+
 <!-- ##### MACRO HIPPO_TYPE_RECTANGLE ##### -->
 <para>
 
@@ -67,6 +70,7 @@ Graphics
 
 </para>
 
+ void: 
 @Returns: 
 
 
diff --git a/linux/hippo/hippo-canvas-helper.c b/linux/hippo/hippo-canvas-helper.c
index 4f2fc44..88b12d1 100644
--- a/linux/hippo/hippo-canvas-helper.c
+++ b/linux/hippo/hippo-canvas-helper.c
@@ -1324,8 +1324,7 @@ hippo_canvas_helper_set_root(HippoCanvasHelper *helper,
     }
 
     if (root != NULL) {
-        g_object_ref(root);
-        hippo_canvas_item_sink(root);
+        g_object_ref_sink(root);
         helper->root = root;
         g_signal_connect(root, "destroy",
                          G_CALLBACK(canvas_root_destroy),
diff --git a/python/hippo.defs b/python/hippo.defs
index cf94dc7..170413b 100644
--- a/python/hippo.defs
+++ b/python/hippo.defs
@@ -1054,12 +1054,6 @@
   (return-type "GType")
 )
 
-(define-method sink
-  (of-object "HippoCanvasItem")
-  (c-name "hippo_canvas_item_sink")
-  (return-type "none")
-)
-
 (define-method destroy
   (of-object "HippoCanvasItem")
   (c-name "hippo_canvas_item_destroy")
diff --git a/python/hippomodule.c b/python/hippomodule.c
index 19fc73c..496e225 100644
--- a/python/hippomodule.c
+++ b/python/hippomodule.c
@@ -19,18 +19,6 @@ void pyhippo_add_constants(PyObject *module, const gchar *strip_prefix);
 
 extern PyMethodDef pyhippo_functions[];
 
-/* this is analogous to what pygtk does for GtkObject, GtkWindow, etc.
- * but it just has to be a bug in pygtk that it works this way.
- */
-static void
-sink_hippocanvasbox(GObject *object)
-{
-    if (HIPPO_CANVAS_BOX(object)->floating) {
-        g_object_ref(object);
-        hippo_canvas_item_sink(HIPPO_CANVAS_ITEM(object));
-    }
-}
-
 static PyObject *
 _cairo_surface_from_gvalue(const GValue *value)
 {
@@ -59,8 +47,6 @@ inithippo(void)
     m = Py_InitModule("hippo", pyhippo_functions);
     d = PyModule_GetDict(m);
 
-    pygobject_register_sinkfunc(HIPPO_TYPE_CANVAS_BOX, sink_hippocanvasbox);
-
     pyhippo_register_classes(d);
     pyhippo_add_constants(m, "HIPPO_");
     PyModule_AddObject(m, "TYPE_CAIRO_SURFACE", pyg_type_wrapper_new(HIPPO_TYPE_CAIRO_SURFACE));



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