GObject proposal



Hi all,

As far as I can tell, the g_object_queue_param_changed function is used
by an object to notify itself just once when the specified param
changes.  IMHO, there are a number of possible improvements to this
functionality.

First, I would suggest extending the signature of this function by
adding an "observer" parameter:

void          g_object_queue_param_changed   (GObject        *subject,
                                              const gchar   
*param_name,
                                              GObject        *observer);

This would allow other objects to "watch" the object and be notified
when the specified param changes.  (param_name could be NULL to watch
all parameters and observer could be NULL to watch itself.)

Second, add an "update" function to allow subjects to notify observers
of a change:

void          g_object_notify_param_changed  (GObject        *observer,
                                              const gchar   
*param_name,
                                              GObject        *subject);

(subject is given so the observer can get the param value from
subject.)  And third, instead of having to register for notifications
after each update, just notify observers each time the param changes but
let observers remove themselves when necessary:

void          g_object_ignore_param_changed  (GObject        *subject,
                                              const gchar   
*param_name,
                                              GObject        *observer);

Comments welcome.

Eric.




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