[Telepathy-commits] [telepathy-qt4/master] Consistently call bus names "busName" instead of "serviceName"

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Mar 23 10:09:21 PDT 2009


D-Bus upstream generally discourage the use of the term "service name" -
officially, things like ":1.42" are /unique bus names/, things like
"org.freedesktop.Telepathy.AccountManager" are /well-known bus names/,
and /bus names/ are either of those. This is the terminology used in
telepathy-spec and in DBusProxy, too.
---
 NEWS                                       |    2 +-
 TelepathyQt4/Client/account.cpp            |    4 +-
 TelepathyQt4/Client/connection.cpp         |   32 +++++++++++----------
 TelepathyQt4/Client/connection.h           |    4 +-
 TelepathyQt4/Client/pending-connection.cpp |   41 ++++++++++++++-------------
 TelepathyQt4/Client/pending-connection.h   |    2 +-
 tools/qt4-client-gen.py                    |   16 +++++-----
 7 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/NEWS b/NEWS
index 56b3ea6..545a80e 100644
--- a/NEWS
+++ b/NEWS
@@ -27,7 +27,7 @@ Enhancements:
 * The skeletal StreamedMediaChannel class from 0.1.0 has been expanded to
   cover all the functionality of the Telepathy StreamedMedia interface
 
-* PendingConnection, PendingAccount etc. have serviceName and objectPath
+* PendingConnection, PendingAccount etc. have busName and objectPath
   methods where necessary, so that objects of custom classes can be
   constructed
 
diff --git a/TelepathyQt4/Client/account.cpp b/TelepathyQt4/Client/account.cpp
index cd8c52e..e287ad2 100644
--- a/TelepathyQt4/Client/account.cpp
+++ b/TelepathyQt4/Client/account.cpp
@@ -525,10 +525,10 @@ ConnectionPtr Account::connection() const
         return ConnectionPtr();
     }
     QString objectPath = mPriv->connectionObjectPath;
-    QString serviceName = objectPath.mid(1).replace('/', '.');
+    QString busName = objectPath.mid(1).replace('/', '.');
     if (!mPriv->connection) {
         mPriv->connection = ConnectionPtr(
-                new Connection(dbusConnection(), serviceName, objectPath));
+                new Connection(dbusConnection(), busName, objectPath));
     }
     return mPriv->connection;
 }
diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index ab29534..b25d89f 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -271,16 +271,16 @@ void Connection::Private::init()
 
     QMutexLocker locker(&handleContextsLock);
     QString busConnectionName = baseInterface->connection().name();
-    QString serviceName = baseInterface->service();
+    QString busName = baseInterface->service();
 
-    if (handleContexts.contains(qMakePair(busConnectionName, serviceName))) {
+    if (handleContexts.contains(qMakePair(busConnectionName, busName))) {
         debug() << "Reusing existing HandleContext";
-        handleContext = handleContexts[qMakePair(busConnectionName, serviceName)];
+        handleContext = handleContexts[qMakePair(busConnectionName, busName)];
     }
     else {
         debug() << "Creating new HandleContext";
         handleContext = new HandleContext;
-        handleContexts[qMakePair(busConnectionName, serviceName)] = handleContext;
+        handleContexts[qMakePair(busConnectionName, busName)] = handleContext;
     }
 
     // All handle contexts locked, so safe
@@ -456,15 +456,16 @@ const Feature Connection::FeatureRoster = Feature(Connection::staticMetaObject.c
 /**
  * Construct a new Connection object.
  *
- * \param serviceName Connection service name.
- * \param objectPath Connection object path.
- * \param parent Object parent.
+ * \param busName The connection's well-known or unique bus name
+ *                (sometimes called a "service name")
+ * \param objectPath The connection's object path
+ * \param parent Object parent
  */
-Connection::Connection(const QString &serviceName,
+Connection::Connection(const QString &busName,
                        const QString &objectPath,
                        QObject *parent)
     : StatefulDBusProxy(QDBusConnection::sessionBus(),
-            serviceName, objectPath, parent),
+            busName, objectPath, parent),
       OptionalInterfaceFactory<Connection>(this),
       ReadyObject(this, FeatureCore),
       mPriv(new Private(this))
@@ -474,16 +475,17 @@ Connection::Connection(const QString &serviceName,
 /**
  * Construct a new Connection object.
  *
- * \param bus QDBusConnection to use.
- * \param serviceName Connection service name.
- * \param objectPath Connection object path.
- * \param parent Object parent.
+ * \param bus QDBusConnection to use
+ * \param busName The connection's well-known or unique bus name
+ *                (sometimes called a "service name")
+ * \param objectPath The connection's object path
+ * \param parent Object parent
  */
 Connection::Connection(const QDBusConnection &bus,
-                       const QString &serviceName,
+                       const QString &busName,
                        const QString &objectPath,
                        QObject *parent)
-    : StatefulDBusProxy(bus, serviceName, objectPath, parent),
+    : StatefulDBusProxy(bus, busName, objectPath, parent),
       OptionalInterfaceFactory<Connection>(this),
       ReadyObject(this, FeatureCore),
       mPriv(new Private(this))
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index acfc40f..3cd6928 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -80,12 +80,12 @@ public:
         StatusUnknown = 0xFFFFFFFF
     };
 
-    Connection(const QString &serviceName,
+    Connection(const QString &busName,
                const QString &objectPath,
                QObject *parent = 0);
 
     Connection(const QDBusConnection &bus,
-               const QString &serviceName,
+               const QString &busName,
                const QString &objectPath,
                QObject *parent = 0);
 
diff --git a/TelepathyQt4/Client/pending-connection.cpp b/TelepathyQt4/Client/pending-connection.cpp
index d5e4f62..b0c51ba 100644
--- a/TelepathyQt4/Client/pending-connection.cpp
+++ b/TelepathyQt4/Client/pending-connection.cpp
@@ -57,7 +57,7 @@ struct PendingConnection::Private
 
     ConnectionManager *manager;
     ConnectionPtr connection;
-    QString serviceName;
+    QString busName;
     QDBusObjectPath objectPath;
 };
 
@@ -127,42 +127,43 @@ ConnectionPtr PendingConnection::connection() const
     if (!mPriv->connection) {
         mPriv->connection = ConnectionPtr(
                 new Connection(mPriv->manager->dbusConnection(),
-                    mPriv->serviceName, mPriv->objectPath.path()));
+                    mPriv->busName, mPriv->objectPath.path()));
     }
 
     return mPriv->connection;
 }
 
 /**
- * Returns the connection service name or an empty string on error.
+ * Returns the connection's bus name ("service name"), or an empty string on
+ * error.
  *
- * This method is useful for creating custom Connection objects, so instead of using
- * PendingConnection::connection, one could construct a new custom connection with
- * the service name and object path.
+ * This method is useful for creating custom Connection objects: instead
+ * of using PendingConnection::connection, one could construct a new custom
+ * connection from the bus name and object path.
  *
- * \return Connection service name.
+ * \return Connection bus name
  * \sa objectPath()
  */
-QString PendingConnection::serviceName() const
+QString PendingConnection::busName() const
 {
     if (!isFinished()) {
-        warning() << "PendingConnection::serviceName called before finished";
+        warning() << "PendingConnection::busName called before finished";
     } else if (!isValid()) {
-        warning() << "PendingConnection::serviceName called when not valid";
+        warning() << "PendingConnection::busName called when not valid";
     }
 
-    return mPriv->serviceName;
+    return mPriv->busName;
 }
 
 /**
- * Returns the connection object path or an empty string on error.
+ * Returns the connection's object path or an empty string on error.
  *
- * This method is useful for creating custom Connection objects, so instead of using
- * PendingConnection::connection, one could construct a new custom connection with
- * the service name and object path.
+ * This method is useful for creating custom Connection objects: instead
+ * of using PendingConnection::connection, one could construct a new custom
+ * connection with the bus name and object path.
  *
- * \return Connection object path.
- * \sa serviceName()
+ * \return Connection object path
+ * \sa busName()
  */
 QString PendingConnection::objectPath() const
 {
@@ -180,10 +181,10 @@ void PendingConnection::onCallFinished(QDBusPendingCallWatcher *watcher)
     QDBusPendingReply<QString, QDBusObjectPath> reply = *watcher;
 
     if (!reply.isError()) {
-        mPriv->serviceName = reply.argumentAt<0>();
+        mPriv->busName = reply.argumentAt<0>();
         mPriv->objectPath = reply.argumentAt<1>();
-        debug() << "Got reply to ConnectionManager.CreateConnection - service name:" <<
-            mPriv->serviceName << "- object path:" << mPriv->objectPath.path();
+        debug() << "Got reply to ConnectionManager.CreateConnection - bus name:" <<
+            mPriv->busName << "- object path:" << mPriv->objectPath.path();
         setFinished();
     } else {
         debug().nospace() <<
diff --git a/TelepathyQt4/Client/pending-connection.h b/TelepathyQt4/Client/pending-connection.h
index 766c975..eba1df7 100644
--- a/TelepathyQt4/Client/pending-connection.h
+++ b/TelepathyQt4/Client/pending-connection.h
@@ -52,7 +52,7 @@ public:
 
     ConnectionPtr connection() const;
 
-    QString serviceName() const;
+    QString busName() const;
 
     QString objectPath() const;
 
diff --git a/tools/qt4-client-gen.py b/tools/qt4-client-gen.py
index 3f92dc2..567c66e 100644
--- a/tools/qt4-client-gen.py
+++ b/tools/qt4-client-gen.py
@@ -167,12 +167,12 @@ public:
     /**
      * Creates a %(name)s associated with the given object on the session bus.
      *
-     * \\param serviceName Name of the service the object is on.
+     * \\param busName Name of the service the object is on.
      * \\param objectPath Path to the object on the service.
      * \\param parent Passed to the parent class constructor.
      */
     %(name)s(
-        const QString& serviceName,
+        const QString& busName,
         const QString& objectPath,
         QObject* parent = 0
     );
@@ -181,13 +181,13 @@ public:
      * Creates a %(name)s associated with the given object on the given bus.
      *
      * \\param connection The bus via which the object can be reached.
-     * \\param serviceName Name of the service the object is on.
+     * \\param busName Name of the service the object is on.
      * \\param objectPath Path to the object on the service.
      * \\param parent Passed to the parent class constructor.
      */
     %(name)s(
         const QDBusConnection& connection,
-        const QString& serviceName,
+        const QString& busName,
         const QString& objectPath,
         QObject* parent = 0
     );
@@ -197,13 +197,13 @@ public:
        'dbusname' : dbusname})
 
         self.b("""
-%(name)s::%(name)s(const QString& serviceName, const QString& objectPath, QObject *parent)
-    : Telepathy::Client::AbstractInterface(serviceName, objectPath, staticInterfaceName(), QDBusConnection::sessionBus(), parent)
+%(name)s::%(name)s(const QString& busName, const QString& objectPath, QObject *parent)
+    : Telepathy::Client::AbstractInterface(busName, objectPath, staticInterfaceName(), QDBusConnection::sessionBus(), parent)
 {
 }
 
-%(name)s::%(name)s(const QDBusConnection& connection, const QString& serviceName, const QString& objectPath, QObject *parent)
-    : Telepathy::Client::AbstractInterface(serviceName, objectPath, staticInterfaceName(), connection, parent)
+%(name)s::%(name)s(const QDBusConnection& connection, const QString& busName, const QString& objectPath, QObject *parent)
+    : Telepathy::Client::AbstractInterface(busName, objectPath, staticInterfaceName(), connection, parent)
 {
 }
 """ % {'name' : name})
-- 
1.5.6.5




More information about the telepathy-commits mailing list