merge from fdo

This commit is contained in:
Andreas Volz 2009-01-08 22:11:38 +01:00
parent d6e5ed5f9c
commit afc679a47d
11 changed files with 140 additions and 70 deletions

View file

@ -2,12 +2,9 @@
#include <xml.h>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <string> Names;
static const char *DBUS_SERVER_NAME = "org.freedesktop.DBus";
static const char *DBUS_SERVER_PATH = "/org/freedesktop/DBus";

View file

@ -1,50 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "props-server.h"
#include <signal.h>
static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
PropsServer::PropsServer(DBus::Connection &connection)
: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH)
{
Version = 1;
Message = "default message";
}
void PropsServer::on_set_property
(DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value)
{
if (property == "Message")
{
std::string msg = value;
this->MessageChanged(msg);
}
}
DBus::BusDispatcher dispatcher;
void niam(int sig)
{
dispatcher.leave();
}
int main()
{
signal(SIGTERM, niam);
signal(SIGINT, niam);
DBus::default_dispatcher = &dispatcher;
DBus::Connection conn = DBus::Connection::SessionBus();
conn.request_name(PROPS_SERVER_NAME);
PropsServer server(conn);
dispatcher.enter();
return 0;
}