Ejemplo n.º 1
0
/*!
    \internal
*/
QDBusConnectionInterface::QDBusConnectionInterface(const QDBusConnection &connection,
                                                   QObject *parent)
    : QDBusAbstractInterface(QLatin1String(DBUS_SERVICE_DBUS),
                             QLatin1String(DBUS_PATH_DBUS),
                             DBUS_INTERFACE_DBUS, connection, parent)
{
    connect(this, SIGNAL(NameAcquired(QString)), this, SIGNAL(serviceRegistered(QString)));
    connect(this, SIGNAL(NameLost(QString)), this, SIGNAL(serviceUnregistered(QString)));
    connect(this, SIGNAL(NameOwnerChanged(QString,QString,QString)),
            this, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
}
Ejemplo n.º 2
0
/*!
    \internal
*/
void QDBusConnectionInterface::disconnectNotify(const char *signalName)
{
    // translate the signal names to what we really want
    // this avoids setting hooks for signals that don't exist on the bus
    if (qstrcmp(signalName, SIGNAL(serviceRegistered(QString))) == 0)
        QDBusAbstractInterface::disconnectNotify(SIGNAL(NameAcquired(QString)));

    else if (qstrcmp(signalName, SIGNAL(serviceUnregistered(QString))) == 0)
        QDBusAbstractInterface::disconnectNotify(SIGNAL(NameLost(QString)));

    else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0)
        QDBusAbstractInterface::disconnectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString)));
}
BubbleManager::BubbleManager(QObject *parent)
    : QObject(parent)
{
    m_bubble = new Bubble;
    m_persistence = new Persistence;
    m_dockPosition = DockPosition::Bottom;

    m_dbusDaemonInterface = new DBusDaemonInterface(DBusDaemonDBusService, DBusDaemonDBusPath,
                                                    QDBusConnection::sessionBus(), this);

    m_dbusdockinterface = new DBusDockInterface(DBbsDockDBusServer, DBusDockDBusPath,
                                                QDBusConnection::sessionBus(), this);

    m_login1ManagerInterface = new Login1ManagerInterface(Login1DBusService, Login1DBusPath,
                                                          QDBusConnection::systemBus(), this);

    m_dbusControlCenter = new DBusControlCenter(ControlCenterDBusService, ControlCenterDBusPath,
                                                    QDBusConnection::sessionBus(), this);

    m_dockDeamonInter = new DockDaemonInter(DockDaemonDBusServie, DockDaemonDBusPath,
                                            QDBusConnection::sessionBus(), this);
    m_dockDeamonInter->setSync(false);

    connect(m_bubble, SIGNAL(expired(int)), this, SLOT(bubbleExpired(int)));
    connect(m_bubble, SIGNAL(dismissed(int)), this, SLOT(bubbleDismissed(int)));
    connect(m_bubble, SIGNAL(replacedByOther(int)), this, SLOT(bubbleReplacedByOther(int)));
    connect(m_bubble, SIGNAL(actionInvoked(uint, QString)), this, SLOT(bubbleActionInvoked(uint, QString)));

    connect(m_dbusDaemonInterface, SIGNAL(NameOwnerChanged(QString, QString, QString)),
            this, SLOT(onDbusNameOwnerChanged(QString, QString, QString)));

    connect(m_login1ManagerInterface, SIGNAL(PrepareForSleep(bool)),
            this, SLOT(onPrepareForSleep(bool)));

    connect(m_dbusdockinterface, &DBusDockInterface::geometryChanged, this, &BubbleManager::onDockRectChanged);
    connect(m_persistence, &Persistence::RecordAdded, this, &BubbleManager::onRecordAdded);

    connect(m_dockDeamonInter, &DockDaemonInter::PositionChanged, this, &BubbleManager::onDockPositionChanged);

    // get correct value for m_dockGeometry, m_dockPosition, m_ccGeometry
    if (m_dbusdockinterface->isValid())
        onDockRectChanged(m_dbusdockinterface->geometry());
    if (m_dockDeamonInter->isValid())
        m_dockPosition = static_cast<DockPosition>(m_dockDeamonInter->position());
    if (m_dbusControlCenter->isValid())
        onCCDestRectChanged(m_dbusControlCenter->rect());

    registerAsService();
}
Ejemplo n.º 4
0
/*!
    \internal
*/
void QDBusConnectionInterface::connectNotify(const char *signalName)
{
    // translate the signal names to what we really want
    // this avoids setting hooks for signals that don't exist on the bus
    if (qstrcmp(signalName, SIGNAL(serviceRegistered(QString))) == 0)
        QDBusAbstractInterface::connectNotify(SIGNAL(NameAcquired(QString)));

    else if (qstrcmp(signalName, SIGNAL(serviceUnregistered(QString))) == 0)
        QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString)));

    else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) {
        static bool warningPrinted = false;
        if (!warningPrinted) {
            qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)");
            warningPrinted = true;
        }
        QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString)));
    }
}
Ejemplo n.º 5
0
Archivo: applet.c Proyecto: rplnt/abrt
static DBusHandlerResult handle_message(DBusConnection* conn, DBusMessage* msg, void* user_data)
{
    const char* member = dbus_message_get_member(msg);

    VERB1 log("%s(member:'%s')", __func__, member);

    int type = dbus_message_get_type(msg);
    if (type != DBUS_MESSAGE_TYPE_SIGNAL)
    {
        log("The message is not a signal. ignoring");
        return DBUS_HANDLER_RESULT_HANDLED;
    }

    if (strcmp(member, "NameOwnerChanged") == 0)
        NameOwnerChanged(msg);
    else if (strcmp(member, "Crash") == 0)
        Crash(msg);
    else if (strcmp(member, "QuotaExceeded") == 0)
        QuotaExceeded(msg);

    return DBUS_HANDLER_RESULT_HANDLED;
}