Example #1
0
static VALUE
textview_add_child_at_anchor(VALUE self, VALUE child, VALUE anchor)
{
    G_CHILD_ADD(self, child);
    gtk_text_view_add_child_at_anchor(_SELF(self), GTK_WIDGET(RVAL2GOBJ(child)), 
                                      GTK_TEXT_CHILD_ANCHOR(RVAL2GOBJ(anchor)));
    return self;
}
Example #2
0
static void
gtk_text_child_anchor_finalize (GObject *obj)
{
  GtkTextChildAnchor *anchor;
  GSList *tmp_list;
  GtkTextLineSegment *seg;
  
  anchor = GTK_TEXT_CHILD_ANCHOR (obj);

  seg = anchor->segment;
  
  if (seg)
    {
      if (seg->body.child.tree != NULL)
        {
          g_warning ("Someone removed a reference to a GtkTextChildAnchor "
                     "they didn't own; the anchor is still in the text buffer "
                     "and the refcount is 0.");
          return;
        }
      
      tmp_list = seg->body.child.widgets;
      while (tmp_list)
        {
          g_object_unref (tmp_list->data);
          tmp_list = g_slist_next (tmp_list);
        }
  
      g_slist_free (seg->body.child.widgets);
  
      g_free (seg);
    }

  anchor->segment = NULL;

  G_OBJECT_CLASS (gtk_text_child_anchor_parent_class)->finalize (obj);
}