[Telepathy-commits] [telepathy-qt4/master] While I'm looking at the codegen anyway, deprecate Qt-style property access

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Jan 21 09:32:46 PST 2009


Having Qt properties on the QDBusAbstractInterface classes is appealing,
but hides a pseudo-blocking D-Bus round-trip to the connection manager
(of exactly the sort that we're trying to avoid).
---
 tools/qt4-client-gen.py |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/qt4-client-gen.py b/tools/qt4-client-gen.py
index 77ba7d2..5f61512 100644
--- a/tools/qt4-client-gen.py
+++ b/tools/qt4-client-gen.py
@@ -83,6 +83,14 @@ class Generator(object):
 #include <QDBusAbstractInterface>
 #include <QDBusPendingReply>
 
+// basically the same as GLib's G_GNUC_DEPRECATED
+#ifndef TELEPATHY_GNUC_DEPRECATED
+#   if defined(Q_CC_GNUC) && __GNUC__ >= 4
+#       define TELEPATHY_GNUC_DEPRECATED __attribute__((__deprecated__))
+#   else
+#       define TELEPATHY_GNUC_DEPRECATED
+#   endif
+#endif
 """)
 
         if self.must_define:
@@ -290,10 +298,12 @@ Q_SIGNALS:\
     /**
      * Getter for the remote object property "%(name)s".
      *
+     * Don't use this: it blocks the main loop.
+     *
      * \\return The value of the property, or a default-constructed value
      *          if the property is not readable.
      */
-    inline %(val)s %(gettername)s() const
+    inline %(val)s %(gettername)s() const TELEPATHY_GNUC_DEPRECATED
     {
         return %(getter-return)s;
     }
@@ -311,9 +321,11 @@ Q_SIGNALS:\
     /**
      * Setter for the remote object property "%s".
      *
+     * Don't use this: it blocks the main loop.
+     *
      * \\param newValue The value to set the property to.
      */
-    inline void %s(%s newValue)
+    inline void %s(%s newValue) TELEPATHY_GNUC_DEPRECATED
     {
         internalPropSet("%s", QVariant::fromValue(newValue));
     }
-- 
1.5.6.5




More information about the Telepathy-commits mailing list