diff --git a/src/core/DBusManager.cpp b/src/core/DBusManager.cpp index d8d4742..b218ffd 100644 --- a/src/core/DBusManager.cpp +++ b/src/core/DBusManager.cpp @@ -16,14 +16,14 @@ DBusManager::~DBusManager() { void DBusManager::initializeConnection() { try { - m_connection = sdbus::createSystemBusConnection(); + m_pConnection = sdbus::createSystemBusConnection(); const sdbus::ServiceName destination{"org.freedesktop.login1"}; const sdbus::ObjectPath loginPath{"/org/freedesktop/login1"}; const sdbus::ObjectPath sessionPath{"/org/freedesktop/login1/session/auto"}; - m_loginProxy = sdbus::createProxy(*m_connection, destination, loginPath); - m_sessionProxy = sdbus::createProxy(*m_connection, destination, sessionPath); + m_pLoginProxy = sdbus::createProxy(*m_pConnection, destination, loginPath); + m_pSessionProxy = sdbus::createProxy(*m_pConnection, destination, sessionPath); Debug::log(LOG, "[DBusManager] Initialized D-Bus connection. Service: {}. Login path: {}, Session path: {}", std::string(destination), std::string(loginPath), std::string(sessionPath)); @@ -34,35 +34,35 @@ void DBusManager::initializeConnection() { std::shared_ptr DBusManager::getConnection() { std::lock_guard lock(m_mutex); - return m_connection; + return m_pConnection; } std::shared_ptr DBusManager::getLoginProxy() { std::lock_guard lock(m_mutex); - if (!m_loginProxy) { + if (!m_pLoginProxy) initializeConnection(); - } - return m_loginProxy; + + return m_pLoginProxy; } std::shared_ptr DBusManager::getSessionProxy() { std::lock_guard lock(m_mutex); - if (!m_sessionProxy) { + if (!m_pSessionProxy) initializeConnection(); - } - return m_sessionProxy; + + return m_pSessionProxy; } void DBusManager::setLockedHint(bool locked) { std::lock_guard lock(m_mutex); - if (!m_sessionProxy) { + if (!m_pSessionProxy) { Debug::log(WARN, "[DBusManager] Cannot set locked hint: Proxy is not initialized."); return; } try { const sdbus::ServiceName interface{"org.freedesktop.login1.Session"}; - m_sessionProxy->callMethod("SetLockedHint").onInterface(interface).withArguments(locked); + m_pSessionProxy->callMethod("SetLockedHint").onInterface(interface).withArguments(locked); Debug::log(LOG, "[DBusManager] Sent 'SetLockedHint({})' on {}", locked, std::string(interface)); } catch (const sdbus::Error& e) { @@ -72,14 +72,14 @@ void DBusManager::setLockedHint(bool locked) { void DBusManager::sendUnlockSignal() { std::lock_guard lock(m_mutex); - if (!m_sessionProxy) { + if (!m_pSessionProxy) { Debug::log(WARN, "[DBusManager] Unlock signal skipped: Proxy is not initialized."); return; } try { const sdbus::ServiceName interface{"org.freedesktop.login1.Session"}; - m_sessionProxy->callMethod("Unlock").onInterface(interface); + m_pSessionProxy->callMethod("Unlock").onInterface(interface); Debug::log(LOG, "[DBusManager] Sent 'Unlock' on {}", std::string(interface)); } catch (const sdbus::Error& e) { diff --git a/src/core/DBusManager.hpp b/src/core/DBusManager.hpp index bc0cb71..cf4b1fb 100644 --- a/src/core/DBusManager.hpp +++ b/src/core/DBusManager.hpp @@ -22,9 +22,9 @@ private: void initializeConnection(); - std::shared_ptr m_connection; - std::shared_ptr m_loginProxy; - std::shared_ptr m_sessionProxy; + std::shared_ptr m_pConnection; + std::shared_ptr m_pLoginProxy; + std::shared_ptr m_pSessionProxy; std::mutex m_mutex; };