mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Merge branch 'wip/rishi/gdbus-codegen-deprecated' into 'master'
gdbus-codegen: Tag interfaces and properties so annotated with G_PARAM_DEPRECATED See merge request GNOME/glib!485
This commit is contained in:
commit
0c7492750a
@ -3,7 +3,7 @@
|
||||
|
||||
# GDBus - GLib D-Bus Library
|
||||
#
|
||||
# Copyright (C) 2008-2011 Red Hat, Inc.
|
||||
# Copyright (C) 2008-2018 Red Hat, Inc.
|
||||
# Copyright (C) 2018 Iñigo Martínez <inigomartinez@gmail.com>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@ -1523,7 +1523,10 @@ class CodeGenerator:
|
||||
s = 'g_param_spec_boxed ("%s", "%s", "%s", G_TYPE_STRV'%(p.name_hyphen, p.name, p.name)
|
||||
else:
|
||||
print_error('Unsupported gtype "{}" for GParamSpec'.format(p.arg.gtype))
|
||||
self.outfile.write(' %s, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));'%s);
|
||||
flags = 'G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS'
|
||||
if p.deprecated:
|
||||
flags = 'G_PARAM_DEPRECATED | ' + flags
|
||||
self.outfile.write(' %s, %s));'%(s, flags));
|
||||
self.outfile.write('\n')
|
||||
|
||||
self.outfile.write('}\n'
|
||||
@ -3058,9 +3061,12 @@ class CodeGenerator:
|
||||
' * Connect to the #GObject::notify signal to get informed of property changes.\n'
|
||||
%(self.namespace, i.name_hyphen, i.camel_name, i.name), False))
|
||||
self.write_gtkdoc_deprecated_and_since_and_close(i, self.outfile, 2)
|
||||
self.outfile.write(' g_object_interface_install_property (iface, g_param_spec_object ("%s", "%s", "%s", %sTYPE_%s, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));\n'
|
||||
flags = 'G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS'
|
||||
if i.deprecated:
|
||||
flags = 'G_PARAM_DEPRECATED | ' + flags
|
||||
self.outfile.write(' g_object_interface_install_property (iface, g_param_spec_object ("%s", "%s", "%s", %sTYPE_%s, %s));\n'
|
||||
'\n'
|
||||
%(i.name_hyphen, i.name_hyphen, i.name_hyphen, self.ns_upper, i.name_upper))
|
||||
%(i.name_hyphen, i.name_hyphen, i.name_hyphen, self.ns_upper, i.name_upper, flags))
|
||||
self.outfile.write('}\n'
|
||||
'\n')
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* GLib testing framework examples and tests
|
||||
*
|
||||
* Copyright (C) 2008-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2008-2018 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -2427,6 +2427,42 @@ test_autocleanups (void)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* deprecations
|
||||
*/
|
||||
|
||||
static void
|
||||
test_deprecations (void)
|
||||
{
|
||||
{
|
||||
FooiGenOldieInterface *iskel;
|
||||
GParamSpec *pspec;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
iskel = foo_igen_oldie_interface_skeleton_new ();
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (iskel), "bat");
|
||||
g_assert_nonnull (pspec);
|
||||
g_assert_cmpint (pspec->flags & G_PARAM_DEPRECATED, ==, G_PARAM_DEPRECATED);
|
||||
|
||||
g_object_unref (iskel);
|
||||
}
|
||||
|
||||
{
|
||||
FooiGenObjectSkeleton *oskel;
|
||||
GParamSpec *pspec;
|
||||
|
||||
oskel = foo_igen_object_skeleton_new ("/objects/first");
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (oskel), "oldie-interface");
|
||||
g_assert_nonnull (pspec);
|
||||
g_assert_cmpint (pspec->flags & G_PARAM_DEPRECATED, ==, G_PARAM_DEPRECATED);
|
||||
|
||||
g_object_unref (oskel);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@ -2438,6 +2474,7 @@ main (int argc,
|
||||
g_test_add_func ("/gdbus/codegen/object-manager", test_object_manager);
|
||||
g_test_add_func ("/gdbus/codegen/property-naming", test_property_naming);
|
||||
g_test_add_func ("/gdbus/codegen/autocleanups", test_autocleanups);
|
||||
g_test_add_func ("/gdbus/codegen/deprecations", test_deprecations);
|
||||
|
||||
return session_bus_run ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user