java-gnome version 4.0.19

org.gnome.gtk
Class Object

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
Direct Known Subclasses:
Adjustment, CellRenderer, FileFilter, Language, LanguageManager, RecentFilter, Tooltip, TreeViewColumn, Widget

public abstract class Object
extends Object

Base class for Widgets and various other elements in GTK.

This is the wrapper around GtkObject!

Since the GObject type system was abstracted out from GTK some time after GTK was first written, GtkObject predates GObject; almost all of the functionality originally resident in GtkObject was moved to GObject long ago. Its presence in the type hierarchy is largely for backwards compatibility. Only people hacking on java-gnome itself will have any need to interact with this class, and then only rarely.

Since:
4.0.0
Author:
Andrew Cowie

Nested Class Summary
static interface Object.Destroy
          Signal handler for when an Object requests that all other code holding references to it release those references.
 
Method Summary
 void connect(Object.Destroy handler)
          Hook up a Object.Destroy handler.
 void destroy()
          Ask everything connected to this object to release its references.
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

connect

public void connect(Object.Destroy handler)
Hook up a Object.Destroy handler.

Since:
4.0.18

destroy

public void destroy()
Ask everything connected to this object to release its references. Use this in preference to Container's remove() if you don't need the Widget any more.

We didn't expose this for a long time in java-gnome; after all, memory management of both Java references and GObject Ref counts is handled automatically by the diabolical cunning of this most excellent library. It turns out, however, that this does not free() the GtkObject's memory; it really only does what it says: ask other GtkObjects to drop whatever Refs they may be holding to this object. Thus if this GtkWidget is in a GtkContainer and you call destroy() the GtkContainer will drop its Refs to this GtkWidget thereby breaking its parent-child relationship.

Note that Java's references remain, so the object will not, in fact, be eligable for finalizing until you drop all your references; ie, the Java side Proxy Object goes out of scope. Nevertheless calling this will speed up release of resources associated with a Widget, so it's a good idea. Once you've done so, finalize() will be traversed a short time later and the GObject will be released.

Since:
4.0.18


java-gnome