Merge branch 'master' of git@gitorious.org:dbus-cplusplus/mainline

This commit is contained in:
Andreas Volz 2008-08-08 22:37:27 +02:00
commit 7e098eaf9e
6 changed files with 131 additions and 2 deletions

6
README
View file

@ -2,7 +2,13 @@ Debugging
---------
To compile debugging code configure the project with the --enable-debug option. Then at runtime you may set the environment variable "DBUSXX_VERBOSE=1" to activate debugging and to '0' to deactivate debugging.
Hints
-----
Your applications based on dbus-c++ have to support PTHREAD and to export the variable HAVE_PTHREAD_H.
BUGS:
-----
- dbus seems to stop working sometimes (only seen with ecore integrattion)
- ecore dbus integration is really "raw" (but working) at the moment

View file

@ -203,7 +203,8 @@ AC_OUTPUT(
examples/Makefile
examples/properties/Makefile
examples/echo/Makefile
examples/hal/Makefile
examples/ecore/Makefile
examples/hal/Makefile
examples/glib/Makefile
dbus-c++-1.pc
dbus-c++-1-uninstalled.pc

View file

@ -1,4 +1,4 @@
SUBDIRS = properties echo hal glib
SUBDIRS = properties echo hal glib ecore
MAINTAINERCLEANFILES = \
Makefile.in

View file

@ -0,0 +1,23 @@
EXTRA_DIST =
AM_CPPFLAGS = -I$(top_srcdir)/include $(ecore_CFLAGS) $(xml_CFLAGS) -I$(top_srcdir)/tools
if ENABLE_ECORE
noinst_PROGRAMS = dbus_ecore
endif
dbus_ecore_SOURCES = dbus_ecore-glue.h dbus_ecore.h dbus_ecore.cpp $(top_srcdir)/tools/xml.cpp
dbus_ecore_LDADD = $(top_builddir)/src/libdbus-c++-1.la $(ecore_LIBS) $(xml_LIBS)
dbus_ecore-glue.h: $(top_srcdir)/data/org.freedesktop.DBus.xml
$(top_builddir)/tools/dbusxx-xml2cpp $^ --proxy=$@
BUILT_SOURCES = dbus_ecore-glue.h
CLEANFILES = $(BUILT_SOURCES)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
MAINTAINERCLEANFILES = \
Makefile.in

View file

@ -0,0 +1,68 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "dbus_ecore.h"
#include <xml.h>
#include <iostream>
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;
}

View file

@ -0,0 +1,31 @@
#ifndef __DEMO_DBUS_BROWSER_H
#define __DEMO_DBUS_BROWSER_H
#include <dbus-c++/dbus.h>
#include <dbus-c++/ecore-integration.h>
#include <Ecore.h>
#include "dbus_ecore-glue.h"
class DBusBrowser
: public org::freedesktop::DBus,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy
{
public:
DBusBrowser( ::DBus::Connection& conn );
private:
void NameOwnerChanged( const ::DBus::String&, const ::DBus::String&, const ::DBus::String& );
void NameLost( const ::DBus::String& );
void NameAcquired( const ::DBus::String& );
private:
};
#endif//__DEMO_DBUS_BROWSER_H