diff --git a/src/backend/dbus-interface/kylinagentinterface.c b/src/backend/dbus-interface/kylinagentinterface.c index ad6361a7..35a7d41a 100644 --- a/src/backend/dbus-interface/kylinagentinterface.c +++ b/src/backend/dbus-interface/kylinagentinterface.c @@ -403,6 +403,9 @@ applet_agent_cancel_secrets_cb (AppletAgent *agent, void agent_init() { + if (NULL != kylinAgent) { + return; + } GError *error = NULL; kylinAgent = applet_agent_new (&error); @@ -414,3 +417,12 @@ void agent_init() return; } + +void agent_clear() +{ + if (NULL == kylinAgent) { + return; + } + g_clear_object (&kylinAgent); + kylinAgent = NULL; +} diff --git a/src/backend/dbus-interface/kylinagentinterface.h b/src/backend/dbus-interface/kylinagentinterface.h index 0df883e0..2a097923 100644 --- a/src/backend/dbus-interface/kylinagentinterface.h +++ b/src/backend/dbus-interface/kylinagentinterface.h @@ -3,6 +3,7 @@ #ifdef __cplusplus extern "C"{ void agent_init(); +void agent_clear(); } #endif diff --git a/src/backend/dbusadaptor.cpp b/src/backend/dbusadaptor.cpp index 56802498..29d5b7e8 100644 --- a/src/backend/dbusadaptor.cpp +++ b/src/backend/dbusadaptor.cpp @@ -234,3 +234,13 @@ void DbusAdaptor::reScan() { parent()->rescan(); } + +void DbusAdaptor::keyRingInit() +{ + parent()->keyRingInit(); +} + +void DbusAdaptor::keyRingClear() +{ + parent()->keyRingClear(); +} diff --git a/src/backend/dbusadaptor.h b/src/backend/dbusadaptor.h index 613aecfa..18a28385 100644 --- a/src/backend/dbusadaptor.h +++ b/src/backend/dbusadaptor.h @@ -83,6 +83,9 @@ public Q_SLOTS: // METHODS QStringList getApInfoBySsid(QString devName, QString ssid); //wifi扫描 void reScan(); + //keyring + void keyRingInit(); + void keyRingClear(); Q_SIGNALS: // SIGNALS // void wirelessActivating(QString devName, QString ssid); // void wiredActivating(QString devName, QString ssid); diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 793fe87f..4ce56ded 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -711,3 +711,13 @@ void MainWindow::rescan() { m_wlanWidget->requestScan(); } + +void MainWindow::keyRingInit() +{ + agent_init(); +} + +void MainWindow::keyRingClear() +{ + agent_clear(); +} diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index 5e27f7f9..d0bf9430 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -68,6 +68,9 @@ public: void rescan(); + void keyRingInit(); + void keyRingClear(); + signals: //设备插拔 void deviceStatusChanged();