[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:15:37 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=5188712

The following commit has been merged in the master branch:
commit 518871229c35643c12ff608e8c2728efe22f6ea1
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Thu Oct 25 22:23:34 2012 -0700

    Remove DbusExporter class, only register service name.  Ref count usages to know when to remove.
    
    This simplifies code and removes a bug in which if you add two plasmoids, then remove the first one, we no longer appear to be running.
    
    BUG: 305614
    REVIEW: 107046
---
 presence/src/presence-applet.cpp | 15 ++++++++++-----
 presence/src/presence-applet.h   | 17 +++--------------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/presence/src/presence-applet.cpp b/presence/src/presence-applet.cpp
index ca32e35..dd3c54a 100644
--- a/presence/src/presence-applet.cpp
+++ b/presence/src/presence-applet.cpp
@@ -19,7 +19,8 @@
 
 #include "presenceapplet.h"
 
-#include <QDBusAbstractAdaptor>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
 #include <QGraphicsLinearLayout>
 
 #include <KAction>
@@ -46,10 +47,13 @@
 
 #define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
 
+int TelepathyPresenceApplet::s_instanceCount = 0;
+
 TelepathyPresenceApplet::TelepathyPresenceApplet(QObject *parent, const QVariantList &args)
     : Plasma::Applet(parent, args),
       m_globalPresence(new KTp::GlobalPresence(this))
 {
+    s_instanceCount ++;
     setupContextMenuActions();
 
     setAspectRatioMode(Plasma::ConstrainedSquare);
@@ -86,8 +90,11 @@ TelepathyPresenceApplet::TelepathyPresenceApplet(QObject *parent, const QVariant
 TelepathyPresenceApplet::~TelepathyPresenceApplet()
 {
     m_contextActions.clear();
-    QDBusConnection::sessionBus().unregisterObject("/PresenceAppletActive");
-    QDBusConnection::sessionBus().unregisterService("org.kde.Telepathy.PresenceAppletActive");
+
+    s_instanceCount--;
+    if (s_instanceCount == 0) {
+        QDBusConnection::sessionBus().unregisterService("org.kde.Telepathy.PresenceAppletActive");
+    }
 }
 
 QList<QAction*> TelepathyPresenceApplet::contextualActions()
@@ -97,8 +104,6 @@ QList<QAction*> TelepathyPresenceApplet::contextualActions()
 
 void TelepathyPresenceApplet::init()
 {
-    m_dbusExporter = new DBusExporter(this);
-    QDBusConnection::sessionBus().registerObject("/PresenceAppletActive", this, QDBusConnection::ExportAdaptors);
     QDBusConnection::sessionBus().registerService("org.kde.Telepathy.PresenceAppletActive");
 
     Tp::registerTypes();
diff --git a/presence/src/presence-applet.h b/presence/src/presence-applet.h
index 5b462fc..78ccfbd 100644
--- a/presence/src/presence-applet.h
+++ b/presence/src/presence-applet.h
@@ -41,7 +41,6 @@ namespace Tp {
 class GlobalPresenceWrapper;
 class KConfigDialog;
 class QAction;
-class DBusExporter;
 
 class TelepathyPresenceApplet: public Plasma::Applet
 {
@@ -73,24 +72,14 @@ private:
     /** used only upon creation to setup a list of actions for the context menu */
     void setupContextMenuActions();
 
+    /** the number of instances which have tried to register the DBus service*/
+    static int s_instanceCount;
+
     QList<QAction*>       m_contextActions;
     Plasma::IconWidget   *m_icon;
 
     Tp::AccountManagerPtr m_accountManager;
     KTp::GlobalPresence  *m_globalPresence;
-    DBusExporter         *m_dbusExporter;
-};
-
-//-----------------------------------------------------------------------------------------
-
-class DBusExporter : public QDBusAbstractAdaptor
-{
-    Q_OBJECT
-    Q_CLASSINFO("D-Bus Interface", "org.kde.Telepathy.PresenceApplet")
-
-public:
-    DBusExporter(QObject *parent = 0) : QDBusAbstractAdaptor(parent) {}
-    ~DBusExporter() {};
 };
 
 #endif  // KTP_PRESENCE_APPLET_H

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list