[Telepathy-commits] [telepathy-qt4/master] Explicitly qualify the main interfaces specified to client-gen to be able to use mothership classes as the mainiface

Olli Salli olli.salli at collabora.co.uk
Mon Sep 29 13:05:11 PDT 2008


---
 TelepathyQt4/Makefile.am |   10 +++++-----
 tools/qt4-client-gen.py  |   19 +++++++++----------
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index a1749ec..4d8deb7 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -170,15 +170,15 @@ _gen/cli-%.h _gen/cli-%-body.hpp: _gen/spec-%.xml \
 		channel) \
 			group='clientchannel'; \
 			prettyinclude='Channel'; \
-			mainiface='--mainiface=/Channel';; \
+			mainiface='--mainiface=Telepathy::Client::ChannelInterface';; \
 		connection) \
 			group='clientconn'; \
 			prettyinclude='Connection'; \
-			mainiface='--mainiface=/Connection';; \
+			mainiface='--mainiface=Telepathy::Client::ConnectionInterface';; \
 		connection-manager) \
 			group='clientcm'; \
 			prettyinclude='ConnectionManager'; \
-			mainiface='--mainiface=/Connection_Manager';; \
+			mainiface='--mainiface=Telepathy::Client::ConnectionManagerInterface';; \
 		dbus) \
 			group='clientdbus'; \
 			namespace='Telepathy::Client::DBus'; \
@@ -186,11 +186,11 @@ _gen/cli-%.h _gen/cli-%-body.hpp: _gen/spec-%.xml \
 		media-session-handler) \
 			group='clientmsesh'; \
 			prettyinclude='MediaSessionHandler'; \
-			mainiface='--mainiface=/Media_Session_Handler';; \
+			mainiface='--mainiface=Telepathy::Client::MediaSessionHandlerInterface';; \
 		media-stream-handler) \
 			group='clientmstrh'; \
 			prettyinclude='MediaStreamHandler'; \
-			mainiface='--mainiface=/Media_Stream_Handler';; \
+			mainiface='--mainiface=Telepathy::Client::MediaStreamHandlerInterface';; \
 		properties) \
 			group='clientprops'; \
 			prettyinclude='Properties';; \
diff --git a/tools/qt4-client-gen.py b/tools/qt4-client-gen.py
index 28e7b20..1a15c62 100644
--- a/tools/qt4-client-gen.py
+++ b/tools/qt4-client-gen.py
@@ -48,7 +48,6 @@ class Generator(object):
         self.spec, = get_by_path(specdom, "spec")
         self.custom_lists = gather_custom_lists(self.spec, self.typesnamespace)
         self.externals = gather_externals(self.spec)
-        self.mainifacename = self.mainiface and self.mainiface.replace('/', '').replace('_', '') + 'Interface'
 
     def __call__(self):
         # Output info header and includes
@@ -85,7 +84,7 @@ namespace %s
 
         # Output interface proxies
         def ifacenodecmp(x, y):
-            xname, yname = x.getAttribute('name'), y.getAttribute('name')
+            xname, yname = [self.namespace + '::' + node.getAttribute('name').replace('/', '').replace('_', '') + 'Interface' for node in x, y]
 
             if xname == self.mainiface:
                 return -1
@@ -182,9 +181,9 @@ public:
 """ % {'name' : name})
 
         # Main interface
-        mainifacename = self.mainifacename or 'QDBusAbstractInterface'
+        mainiface = self.mainiface or 'QDBusAbstractInterface'
 
-        if mainifacename != name:
+        if mainiface != self.namespace + '::' + name:
             self.h("""
     /**
      * Creates a %(name)s associated with the same object as the given proxy.
@@ -193,7 +192,7 @@ public:
      *
      * \\param mainInterface The proxy to use.
      */
-    explicit %(name)s(const %(mainifacename)s& mainInterface);
+    explicit %(name)s(const %(mainiface)s& mainInterface);
 
     /**
      * Creates a %(name)s associated with the same object as the given proxy.
@@ -202,22 +201,22 @@ public:
      * \\param mainInterface The proxy to use.
      * \\param parent Passed to the parent class constructor.
      */
-    %(name)s(const %(mainifacename)s& mainInterface, QObject* parent);
+    %(name)s(const %(mainiface)s& mainInterface, QObject* parent);
 """ % {'name' : name,
-       'mainifacename' : mainifacename})
+       'mainiface' : mainiface})
 
             self.b("""
-%(name)s::%(name)s(const %(mainifacename)s& mainInterface)
+%(name)s::%(name)s(const %(mainiface)s& mainInterface)
     : QDBusAbstractInterface(mainInterface.service(), mainInterface.path(), staticInterfaceName(), mainInterface.connection(), mainInterface.parent())
 {
 }
 
-%(name)s::%(name)s(const %(mainifacename)s& mainInterface, QObject *parent)
+%(name)s::%(name)s(const %(mainiface)s& mainInterface, QObject *parent)
     : QDBusAbstractInterface(mainInterface.service(), mainInterface.path(), staticInterfaceName(), mainInterface.connection(), parent)
 {
 }
 """ % {'name' : name,
-       'mainifacename' : mainifacename})
+       'mainiface' : mainiface})
 
         # Properties
         for prop in get_by_path(iface, 'property'):
-- 
1.5.6.5




More information about the Telepathy-commits mailing list