g_object_unref (object);
}
-static gboolean
-should_issue_prop_deprecation_warning (const GParamSpec *pspec)
+static void
+consider_issuing_property_deprecation_warning (const GParamSpec *pspec)
{
static GHashTable *already_warned_table;
static const gchar *enable_diagnostic;
gboolean already;
if (!(pspec->flags & G_PARAM_DEPRECATED))
- return FALSE;
+ return;
if (g_once_init_enter (&enable_diagnostic))
{
}
if (enable_diagnostic[0] == '0')
- return FALSE;
+ return;
/* We hash only on property names: this means that we could end up in
* a situation where we fail to emit a warning about a pair of
g_mutex_unlock (&already_warned_lock);
- return !already;
+ if (!already)
+ g_warning ("The property %s:%s is deprecated and shouldn't be used "
+ "anymore. It will be removed in a future version.",
+ g_type_name (pspec->owner_type), pspec->name);
}
static inline void
if (redirect)
pspec = redirect;
- if (should_issue_prop_deprecation_warning (pspec))
- {
- 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);
- }
+ consider_issuing_property_deprecation_warning (pspec);
class->get_property (object, param_id, value, pspec);
}
if (redirect)
pspec = redirect;
- if (pspec->flags & G_PARAM_DEPRECATED)
- {
- /* don't warn for automatically provided construct properties */
- if (!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) || !object_in_construction (object))
- {
- if (should_issue_prop_deprecation_warning (pspec))
- 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 */
g_value_init (&tmp_value, pspec->value_type);
if (!g_value_transform (value, &tmp_value))
for (j = 0; j < n_params; j++)
if (params[j].pspec == pspec)
{
+ consider_issuing_property_deprecation_warning (pspec);
value = params[j].value;
break;
}
/* set remaining properties */
for (i = 0; i < n_params; i++)
if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
- object_set_property (object, params[i].pspec, params[i].value, nqueue);
+ {
+ consider_issuing_property_deprecation_warning (params[i].pspec);
+ object_set_property (object, params[i].pspec, params[i].value, nqueue);
+ }
/* If nqueue is non-NULL then we are frozen. Thaw it. */
if (nqueue)
for (j = 0; j < n_params; j++)
if (params[j].pspec == pspec)
{
+ consider_issuing_property_deprecation_warning (pspec);
value = params[j].value;
break;
}
*/
for (i = 0; i < n_params; i++)
if (!(params[i].pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
- object_set_property (object, params[i].pspec, params[i].value, nqueue);
+ {
+ consider_issuing_property_deprecation_warning (params[i].pspec);
+ object_set_property (object, params[i].pspec, params[i].value, nqueue);
+ }
g_object_notify_queue_thaw (object, nqueue);
}
g_value_unset (&value);
break;
}
-
+
+ consider_issuing_property_deprecation_warning (pspec);
object_set_property (object, pspec, &value, nqueue);
g_value_unset (&value);
-
+
name = va_arg (var_args, gchar*);
}
g_warning ("%s: construct property \"%s\" for object '%s' can't be set after construction",
G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (object));
else
- object_set_property (object, pspec, value, nqueue);
-
+ {
+ consider_issuing_property_deprecation_warning (pspec);
+ object_set_property (object, pspec, value, nqueue);
+ }
+
g_object_notify_queue_thaw (object, nqueue);
g_object_unref (object);
}