diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-05-12 23:05:41 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-05-13 08:08:38 -0400 |
commit | 4360756c6903491977886f4b4eee0650469d9ea4 (patch) | |
tree | 49a12fc30466270236d46df5b40d94c651a8eb67 | |
parent | 4dba2eb48625c7d5f72e4737eff28688332143c6 (diff) |
Avoid overeager warning about deprecated properties
Construct properties are always set during construction.
It makes no sense to warn about this even if the property
is marked as deprecated; the deprecation warning should
only be issues for explicit uses of the property after
construction.
https://bugzilla.gnome.org/show_bug.cgi?id=730045
-rw-r--r-- | gobject/gobject.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gobject/gobject.c b/gobject/gobject.c index e12eb6ba9..78fe203e9 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1348,9 +1348,16 @@ object_set_property (GObject *object, if (enable_diagnostic[0] == '1') { if (pspec->flags & G_PARAM_DEPRECATED) - g_warning ("The property %s:%s is deprecated and shouldn't be used " - "anymore. It will be removed in a future version.", - G_OBJECT_TYPE_NAME (object), pspec->name); + { + /* don't warn for automatically provided construct properties */ + if (!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) || + !object_in_construction (object)) + { + g_warning ("The property %s:%s is deprecated and shouldn't be used " + "anymore. It will be removed in a future version.", + G_OBJECT_TYPE_NAME (object), pspec->name); + } + } } /* provide a copy to work from, convert (if necessary) and validate */ |