[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: Sinkability considered harmful
From:       Tristan Van Berkom <tvb () gnome ! org>
Date:       2006-01-04 14:41:49
Message-ID: 43BBEEE1.7000207 () gnome ! org
[Download RAW message or body]

Tim Janik wrote:
[...]
>   MyObject *object;    /* move to declaration section */
> 
>   object = create_a_floating_object();
>   some_container_add (container, object);
>   my_object_unref (object);

In a sane world where your program doesnt explode
due to OOM conditions, it would read like this anyway:

     if ((object = create_a_floating_object()) != NULL) {
         some_container_add (container, object);
         my_object_unref (object);
     }

A widget is a resource, like a file descriptor or a
memory region; passing gtk_button_new() as an argument
to gtk_container_add() feels just as gross as passing
open() as an argument to read(), only the consequences
are acceptable.

The extra redundant lines of code (which are usually
taken care of by libglade anyway) IMO are a small price
to pay in exchange for:

     o Not having to open up myobject.h and check if it
       remotely descends from GtkObject and has to be
       treated specially.

     o Having unexpected surprises months later because
       one followed a perfectly acceptable logic: Its not
       a GtkWidget (someone mentioned a filechooser filter ?)
       so I'm not special casing it by assuming I dont own it.

My understanding is that floating widgets are deeply embedded
into GTK+ culture and are here to stay anyway so I can only
say: we have a confusing triple standard here (GObject,
GtkObject & GtkWindow), lets just do our best to not let that
get any worse.

My 2 cents,
                                  -Tristan

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic