#50218 - Notification on write-only properties is questionable/problematic



Text of bug:

=====
If you get the "notify" signal for a write-only property, it's kind of
unclear what you are supposed to do about it; you can't get the value of
the property. How do you handle this in a GUI builder?

As a concrete example, for GtkTextTag there's a write-only "foreground"
property that is the color name as a string. You can also set the color as
a GdkColor. In a GUI builder, conceivably you want people to be able to
enter the color as a string, but you can't really do that since
you can't display the current color as a string.

Anyway, I'm thinking perhaps notification should be disabled for write-only
properties, since it only conveys that the property was touched, there's no
way to get the new value or display the value.

In my experience write-only properties are only used for a different way to
set some readable property. So there is always some other property that
should be used for notification in these cases.
=====

I think you were in agreement that notification on write-only properties
was a bad idea. 

What was the concrete step to take here - something like the following
patch?

Regards,
                                        Owen

Index: gobject.c
===================================================================
RCS file: /cvs/gnome/glib/gobject/gobject.c,v
retrieving revision 1.29
diff -u -r1.29 gobject.c
--- gobject.c	2001/03/18 04:44:37	1.29
+++ gobject.c	2001/03/26 22:45:31
@@ -602,7 +619,11 @@
 	       property_name);
   else
     {
-      NotifyQueue *nqueue = object_freeze_notifies (object);
+      NotifyQueue *nqueue;
+
+      g_return_if_fail (pspec->flags & G_PARAM_READABLE != 0);
+
+      nqueue = object_freeze_notifies (object);
 
       object_queue_property (object, pspec, nqueue);
       object_thaw_notifies (object, nqueue);




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