Re: none



On 13 Dec 2000, Maciej Stachowiak wrote:

> Havoc Pennington <hp redhat com> writes:
> 
> > Tim Janik <timj gtk org> writes: 
> > > what? how's GtkObject deprecated?
> > > 
> > 
> > It has exactly one feature not found in GObject, which is the
> > "destroy" signal. Our claim is that "destroy" is only useful for GUI
> > objects, so "destroy" should really be in GtkWidget. So GtkObject is
> > just legacy cruft.
> >
> > Granted, it's legacy cruft we are never going to remove, since it
> > would be too painful. But newly-written user code should only be using
> > GtkObject for the "destroy" signal, and never using it otherwise. So
> > GtkObject is deprecated (i.e. not recommended that you use it), though
> > not deprecated in the sense that we are going to remove it.
> > 
> > You should never type a function that begins gtk_object_ anymore and
> > you should never use the GTK_OBJECT() cast, because in all cases you
> > should be using GObject or GtkWidget. The only legit way to use
> > GtkObject is too connect to "destroy".
> 
> This is sadly broken. A "destroy" signal is needed for lots of non-GUI
> objects. It gets used all the time in non-GUI Bonobo code, for
> instance, so factory servers know when all their objects have gone
> away.
> 
> Last time this came up Havoc or somebody said to just do
> gobject_set_data with a destroy notification, but that seems
> needlessly arcane. The "destroy" signal should be moved to
> GObject. Even if it does not make sense for some non-gui objects,
> there are cases where it's clearly needed.

nope GObject shouldn't have ::destroy.
if you need non-GUI objects that have destroy, what stops you from
introducing:

struct _MyObject
{
  GObject parent_instance;
};

struct _MyObjectClass
{
  GObject parent_instance;
  
  void (*destroy) (MyObject *obj);
};

i think even bonobo has some kind of base object type,
BONOBO_TYPE_OBEJCT or so? derive that from GObject and introduce
::destroy, it's not that hard.
  

> 
> Regards,
> 
> Maciej
> 

---
ciaoTJ





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