Commit a6902b9e authored by Julien Bonjean's avatar Julien Bonjean

[#1671] Use propertiesChange as signal to register accounts

- it seems to be more generic (VPN creation, ...) but may be overkill ...
parent c91f3206
......@@ -18,8 +18,18 @@ void NetworkManager::StateChanged(const uint32_t& state)
{
_warn("Network state changed: %s", stateAsString(state).c_str());
if(state == NM_STATE_CONNECTED)
Manager::instance().registerAccounts();
// if(state == NM_STATE_CONNECTED)
// Manager::instance().registerAccounts();
}
void NetworkManager::PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0)
{
const map< string, ::DBus::Variant >::const_iterator iter = argin0.begin();
_warn("Properties changed: %s", iter->first.c_str());
Manager::instance().registerAccounts();
}
NetworkManager::NetworkManager(DBus::Connection& connection, const DBus::Path& path, const char* destination): DBus::ObjectProxy (connection, path, destination)
......
......@@ -14,6 +14,7 @@ public:
NetworkManager(DBus::Connection&, const DBus::Path&, const char*);
void StateChanged(const uint32_t& state);
void PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0);
string stateAsString(const uint32_t& state);
enum NMState
......
/*
* This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
*/
#ifndef __dbusxx__networkmanager_proxy_h__PROXY_MARSHAL_H
#define __dbusxx__networkmanager_proxy_h__PROXY_MARSHAL_H
#include <dbus-c++/dbus.h>
#include <cassert>
#include <iostream>
namespace org {
namespace freedesktop {
......@@ -17,6 +21,7 @@ public:
: ::DBus::InterfaceProxy("org.freedesktop.NetworkManager")
{
connect_signal(NetworkManager_proxy, StateChanged, _StateChanged_stub);
connect_signal(NetworkManager_proxy, PropertiesChanged, _PropertiesChanged_stub);
}
public:
......@@ -27,7 +32,6 @@ public:
/* methods exported by this interface,
* this functions will invoke the corresponding methods on the remote objects
*/
/*
std::vector< ::DBus::Path > GetDevices()
{
::DBus::CallMessage call;
......@@ -39,13 +43,14 @@ public:
ri >> argout;
return argout;
}
*/
public:
/* signal handlers for this interface
*/
virtual void StateChanged(const uint32_t& argin0) = 0;
virtual void PropertiesChanged(const std::map< std::string, ::DBus::Variant >& argin0) = 0;
private:
......@@ -59,6 +64,14 @@ private:
ri >> arg0;
StateChanged(arg0);
}
void _PropertiesChanged_stub(const ::DBus::SignalMessage &sig)
{
::DBus::MessageIter ri = sig.reader();
std::map< std::string, ::DBus::Variant > arg0;
ri >> arg0;
PropertiesChanged(arg0);
}
};
} }
......
......@@ -8,6 +8,9 @@
<signal name="StateChanged">
<arg type="u"/>
</signal>
<signal name="PropertiesChanged">
<arg type="a{sv}"/>
</signal>
</interface>
</node>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment