After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673693 - entrycompletion: set_property() should use property setter functions
entrycompletion: set_property() should use property setter functions
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkEntry
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-04-07 16:28 UTC by Pavel Holejsovsky
Modified: 2012-10-18 08:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
entrycompletion: set_property() should invoke object::notify signal (2.20 KB, patch)
2012-04-07 16:28 UTC, Pavel Holejsovsky
none Details | Review
entrycompletion: set_property() should call property setters (2.46 KB, patch)
2012-04-08 08:56 UTC, Pavel Holejsovsky
committed Details | Review

Description Pavel Holejsovsky 2012-04-07 16:28:07 UTC
gtk_entry_completion_set_property() sets values in 'priv' directly,
bypassing notificationand invocation and possibly other actions
done by gtk_set_xxx() functions.   This effectively causes that
gtk_entry_completion_set_xprop () and gobject_set(..., 'xprop')
behave differently.
Comment 1 Pavel Holejsovsky 2012-04-07 16:28:10 UTC
Created attachment 211547 [details] [review]
entrycompletion: set_property() should invoke object::notify signal

gtk_entry_completion_set_property() was setting many properties by
directly modifying priv values, bypassing notification invocation and
possibly another actions done by gtk_completion_entry_set_xxx ()
functions.  Fix by invoking set_xxx() instead of setting the property
value directly.
Comment 2 Emmanuele Bassi (:ebassi) 2012-04-07 22:02:36 UTC
g_object_set() will implicitly call g_object_notify() - the double notification is avoided because GObject compresses notifications on the same property.

it's a good thing, though, to have set_property() call the proper setters - as it unifies the code paths and adds the same constraints on the properties modified, including the notification on multiple properties.
Comment 3 Pavel Holejsovsky 2012-04-08 08:55:18 UTC
(In reply to comment #2)
> g_object_set() will implicitly call g_object_notify() - the double notification
> is avoided because GObject compresses notifications on the same property.

I see, thanks.  I'll attach revised version of the patch with better description which does not talk about ::notify signal any more.
Comment 4 Pavel Holejsovsky 2012-04-08 08:56:59 UTC
Created attachment 211569 [details] [review]
entrycompletion: set_property() should call property setters

A new version of the patch with improved description not mentioning
::notify signal.
Comment 5 Emmanuele Bassi (:ebassi) 2012-04-08 10:09:13 UTC
Review of attachment 211569 [details] [review]:

looks good to me.
Comment 6 Pavel Holejsovsky 2012-04-08 10:12:57 UTC
Attachment 211569 [details] pushed as 331bba1 - entrycompletion: set_property() should call property setters
Comment 7 Matthias Clasen 2012-10-18 01:14:32 UTC
This broke documented GtkEntryCompletion behaviour:

 * This functions creates and adds a #GtkCellRendererText for the selected
 * column. If you need to set the text column, but don't want the cell
 * renderer, use g_object_set() to set the #GtkEntryCompletion:text-column
 * property directly.

If you wondered why the completion popup in the file chooser has been showing you everything twice recently, this is why :-(
Comment 8 Pavel Holejsovsky 2012-10-18 08:08:33 UTC
IMHO, even when documented, this is very strange behaviour and violates principle of the least surprise.  With documented (and now enforced) behaviour, setting  text-column using g_object_set() in simple common cases (similar to the one in gtk-demo) causes hard-to-understand crashes when the popup is about to appear.  IMHO it would be better to have specialised  method for 'raw' setting of the text_column field instead of overloading g_object_set() semantics.