#ifdef HAVE_CONFIG_H #include #endif #include "dbus_ecore.h" #include #include using namespace std; static const char* DBUS_SERVER_NAME = "org.freedesktop.DBus"; static const char* DBUS_SERVER_PATH = "/org/freedesktop/DBus"; DBusBrowser::DBusBrowser( ::DBus::Connection& conn ) : ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME) { typedef std::vector< ::DBus::String > Names; Names names = ListNames(); for(Names::iterator it = names.begin(); it != names.end(); ++it) { cout << *it << endl; } } void DBusBrowser::NameOwnerChanged( const ::DBus::String& name, const ::DBus::String& old_owner, const ::DBus::String& new_owner ) { cout << name << ": " << old_owner << " -> " << new_owner << endl; } void DBusBrowser::NameLost( const ::DBus::String& name ) { cout << name << " lost" << endl; } void DBusBrowser::NameAcquired( const ::DBus::String& name ) { cout << name << " acquired" << endl; } DBus::Ecore::BusDispatcher dispatcher; void niam( int sig ) { ecore_main_loop_quit(); } int main(int argc, char* argv[]) { signal(SIGTERM, niam); signal(SIGINT, niam); ecore_init(); DBus::default_dispatcher = &dispatcher; DBus::Connection conn = DBus::Connection::SessionBus(); DBusBrowser browser(conn); ecore_main_loop_begin(); ecore_shutdown(); return 0; }