summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am15
-rw-r--r--src/connection.cpp6
-rw-r--r--src/connection_p.h3
-rw-r--r--src/debug.cpp4
-rw-r--r--src/dispatcher.cpp10
-rw-r--r--src/dispatcher_p.h3
-rw-r--r--src/ecore-integration.cpp274
-rw-r--r--src/error.cpp4
-rw-r--r--src/eventloop-integration.cpp4
-rw-r--r--src/eventloop.cpp4
-rw-r--r--src/glib-integration.cpp5
-rw-r--r--src/interface.cpp4
-rw-r--r--src/internalerror.h3
-rw-r--r--src/introspection.cpp4
-rw-r--r--src/message.cpp4
-rw-r--r--src/message_p.h3
-rw-r--r--src/object.cpp4
-rw-r--r--src/pendingcall.cpp4
-rw-r--r--src/pendingcall_p.h3
-rw-r--r--src/property.cpp5
-rw-r--r--src/server.cpp4
-rw-r--r--src/server_p.h3
-rw-r--r--src/types.cpp4
23 files changed, 365 insertions, 12 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f449e9d..74ac218 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,8 @@
AM_CPPFLAGS = \
$(dbus_CFLAGS) \
$(glib_CFLAGS) \
+ $(ecore_CFLAGS) \
+ $(PRIVATE_CFLAGS) \
-I$(top_srcdir)/include \
-I$(top_builddir)/include
@@ -9,7 +11,12 @@ GLIB_H = $(HEADER_DIR)/glib-integration.h
GLIB_CPP = glib-integration.cpp
endif
-CONFIG_H = $(top_builddir)/include/dbus-c++/config.h
+if ENABLE_ECORE
+ECORE_H = $(HEADER_DIR)/ecore-integration.h
+ECORE_CPP = ecore-integration.cpp
+endif
+
+CONFIG_H = $(top_builddir)/include/dbus-c++/dbus-c++-config.h
HEADER_DIR = $(top_srcdir)/include/dbus-c++
HEADER_FILES = \
@@ -33,14 +40,14 @@ HEADER_FILES = \
$(HEADER_DIR)/api.h \
$(HEADER_DIR)/eventloop.h \
$(HEADER_DIR)/eventloop-integration.h \
- $(GLIB_H)
+ $(GLIB_H) $(ECORE_H)
lib_includedir=$(includedir)/dbus-c++-1/dbus-c++/
lib_include_HEADERS = $(HEADER_FILES)
lib_LTLIBRARIES = libdbus-c++-1.la
-libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h eventloop.cpp eventloop-integration.cpp $(GLIB_CPP)
-libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(glib_LIBS) $(pthread_LIBS)
+libdbus_c___1_la_SOURCES = $(HEADER_FILES) interface.cpp object.cpp introspection.cpp debug.cpp types.cpp connection.cpp connection_p.h property.cpp dispatcher.cpp dispatcher_p.h pendingcall.cpp pendingcall_p.h error.cpp internalerror.h message.cpp message_p.h server.cpp server_p.h eventloop.cpp eventloop-integration.cpp $(GLIB_CPP) $(ECORE_CPP)
+libdbus_c___1_la_LIBADD = $(dbus_LIBS) $(glib_LIBS) $(pthread_LIBS) $(ecore_LIBS)
MAINTAINERCLEANFILES = \
Makefile.in
diff --git a/src/connection.cpp b/src/connection.cpp
index 08f573a..4620594 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -21,6 +21,12 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dbus-c++/dbus-c++-config.h>
+
#include <dbus-c++/debug.h>
#include <dbus-c++/connection.h>
diff --git a/src/connection_p.h b/src/connection_p.h
index 2164382..65d6c71 100644
--- a/src/connection_p.h
+++ b/src/connection_p.h
@@ -26,8 +26,9 @@
#define __DBUSXX_CONNECTION_P_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/connection.h>
#include <dbus-c++/server.h>
diff --git a/src/debug.cpp b/src/debug.cpp
index 4ca2c78..95d8083 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/debug.h>
diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp
index 68c4412..0e1619a 100644
--- a/src/dispatcher.cpp
+++ b/src/dispatcher.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/dispatcher.h>
@@ -66,7 +70,11 @@ Watch::Watch(Watch::Internal *i)
int Watch::descriptor() const
{
- return dbus_watch_get_fd((DBusWatch *)_int);
+#if HAVE_WIN32
+ return dbus_watch_get_socket((DBusWatch*)_int);
+#else
+ return dbus_watch_get_unix_fd((DBusWatch*)_int);
+#endif
}
int Watch::flags() const
diff --git a/src/dispatcher_p.h b/src/dispatcher_p.h
index ece33b7..5f25782 100644
--- a/src/dispatcher_p.h
+++ b/src/dispatcher_p.h
@@ -26,8 +26,9 @@
#define __DBUSXX_DISPATCHER_P_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/dispatcher.h>
diff --git a/src/ecore-integration.cpp b/src/ecore-integration.cpp
new file mode 100644
index 0000000..7c846eb
--- /dev/null
+++ b/src/ecore-integration.cpp
@@ -0,0 +1,274 @@
+/*
+ *
+ * D-Bus++ - C++ bindings for D-Bus
+ *
+ * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
+
+#include <dbus-c++/ecore-integration.h>
+
+#include <dbus/dbus.h> // for DBUS_WATCH_*
+
+using namespace DBus;
+
+Ecore::BusTimeout::BusTimeout( Timeout::Internal* ti/*, GMainContext* ctx */)
+: Timeout(ti)/*, _ctx(ctx)*/
+{
+ _enable();
+}
+
+Ecore::BusTimeout::~BusTimeout()
+{
+ _disable();
+}
+
+void Ecore::BusTimeout::toggle()
+{
+ debug_log("ecore: timeout %p toggled (%s)", this, Timeout::enabled() ? "on":"off");
+
+ if(Timeout::enabled()) _enable();
+ else _disable();
+}
+
+int Ecore::BusTimeout::timeout_handler( void *data )
+{
+ Ecore::BusTimeout* t = reinterpret_cast<Ecore::BusTimeout*>(data);
+
+ debug_log("Ecore::BusTimeout::timeout_handler( void *data )");
+
+ t->handle();
+
+ return 1; // 1 -> reshedule in ecore for next timer interval
+}
+
+void Ecore::BusTimeout::_enable()
+{
+ // TODO: port
+ // _source => Ecore_Timer
+ // g_source_set_callback => EcoreDispatcher init()
+ debug_log("Ecore::BusTimeout::_enable()");
+
+ _etimer = ecore_timer_add (((double)Timeout::interval())/1000, timeout_handler, this);
+
+ /*_source = g_timeout_source_new();
+ g_source_set_callback(_source, timeout_handler, this, NULL);
+ g_source_attach(_source, _ctx);*/
+}
+
+void Ecore::BusTimeout::_disable()
+{
+ debug_log("Ecore::BusTimeout::_disable()");
+
+ ecore_timer_del (_etimer);
+ //g_source_destroy(_source);
+}
+
+struct BusSource
+{
+ // TODO: needed?
+ //GSource source;
+ //GPollFD poll;
+};
+
+static bool watch_prepare( /*GSource *source,*/ int *timeout )
+{
+ debug_log("ecore: watch_prepare");
+
+ *timeout = -1;
+ return false;
+}
+
+static bool watch_check( /*GSource *source*/ )
+{
+ debug_log("ecore: watch_check");
+
+ //BusSource* io = (BusSource*)source;
+ return true;//io->poll.revents ? true : false;
+}
+
+// TODO: port parameters
+static bool watch_dispatch(/* GSource *source, GSourceFunc callback, */void *data )
+{
+ debug_log("ecore: watch_dispatch");
+
+ bool cb = true;//callback(data);
+ DBus::default_dispatcher->dispatch_pending(); //TODO: won't work in case of multiple dispatchers
+ return cb;
+}
+
+// TODO: needed?
+/*static GSourceFuncs watch_funcs = {
+ watch_prepare,
+ watch_check,
+ watch_dispatch,
+ NULL
+};*/
+
+// TODO: port parameter
+Ecore::BusWatch::BusWatch( Watch::Internal* wi/*, GMainContext* ctx */)
+: Watch(wi)/*, _ctx(ctx)*/
+{
+ _enable();
+}
+
+Ecore::BusWatch::~BusWatch()
+{
+ _disable();
+}
+
+void Ecore::BusWatch::toggle()
+{
+ debug_log("ecore: watch %p toggled (%s)", this, Watch::enabled() ? "on":"off");
+
+ if(Watch::enabled()) _enable();
+ else _disable();
+}
+
+int Ecore::BusWatch::watch_handler_read( void *data, Ecore_Fd_Handler *fdh )
+{
+ Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
+
+ debug_log("ecore: watch_handler_read");
+
+ int flags = DBUS_WATCH_READABLE;
+
+ watch_dispatch(NULL);
+
+ w->handle(flags);
+
+ return 1;
+}
+
+int Ecore::BusWatch::watch_handler_error( void *data, Ecore_Fd_Handler *fdh )
+{
+ Ecore::BusWatch* w = reinterpret_cast<Ecore::BusWatch*>(data);
+
+ debug_log("ecore: watch_handler_error");
+
+ int flags = DBUS_WATCH_ERROR;
+
+ watch_dispatch(NULL);
+
+ //w->handle(flags);
+
+ return 1;
+}
+
+void Ecore::BusWatch::_enable()
+{
+ debug_log("Ecore::BusWatch::_enable()");
+
+ int flags = Watch::flags();
+ //Ecore_Fd_Handler_Flags condition = ECORE_FD_READ;
+
+ // TODO: create second handler for ECORE_FD_ERROR case
+
+ /*if(flags & DBUS_WATCH_READABLE)
+ condition |= ECORE_FD_READ;
+// if(flags & DBUS_WATCH_WRITABLE)
+// condition |= G_IO_OUT;
+ if(flags & DBUS_WATCH_ERROR)
+ condition |= ECORE_FD_ERROR;
+ //if(flags & DBUS_WATCH_HANGUP)
+ //condition |= G_IO_HUP;*/
+
+ fd_handler_read = ecore_main_fd_handler_add (Watch::descriptor(),
+ ECORE_FD_READ,
+ watch_handler_read,
+ this,
+ NULL, NULL);
+
+ ecore_main_fd_handler_active_set(fd_handler_read, ECORE_FD_READ);
+
+ fd_handler_error = ecore_main_fd_handler_add (Watch::descriptor(),
+ ECORE_FD_ERROR,
+ watch_handler_error,
+ this,
+ NULL, NULL);
+
+ ecore_main_fd_handler_active_set(fd_handler_error, ECORE_FD_ERROR);
+
+ // TODO: port this
+ /*_source = g_source_new(&watch_funcs, sizeof(BusSource));
+ g_source_set_callback(_source, watch_handler, this, NULL);
+
+
+
+ GPollFD* poll = &(((BusSource*)_source)->poll);
+ poll->fd = Watch::descriptor();
+ poll->events = condition;
+ poll->revents = 0;
+
+ g_source_add_poll(_source, poll);
+ g_source_attach(_source, _ctx);*/
+}
+
+void Ecore::BusWatch::_disable()
+{
+ ecore_main_fd_handler_del (fd_handler_read);
+ ecore_main_fd_handler_del (fd_handler_error);
+
+ // TODO: port this
+ /*GPollFD* poll = &(((BusSource*)_source)->poll);
+ g_source_remove_poll(_source, poll);
+ g_source_destroy(_source);*/
+}
+
+void Ecore::BusDispatcher::attach( /*GMainContext* ctx */)
+{
+ //_ctx = ctx ? ctx : g_main_context_default();
+}
+
+Timeout* Ecore::BusDispatcher::add_timeout( Timeout::Internal* wi )
+{
+ Timeout* t = new Ecore::BusTimeout(wi/*, _ctx*/);
+
+ debug_log("ecore: added timeout %p (%s)", t, t->enabled() ? "on":"off");
+
+ return t;
+}
+
+void Ecore::BusDispatcher::rem_timeout( Timeout* t )
+{
+ debug_log("ecore: removed timeout %p", t);
+
+ delete t;
+}
+
+Watch* Ecore::BusDispatcher::add_watch( Watch::Internal* wi )
+{
+ Watch* w = new Ecore::BusWatch(wi/*, _ctx*/);
+
+ debug_log("ecore: added watch %p (%s) fd=%d flags=%d",
+ w, w->enabled() ? "on":"off", w->descriptor(), w->flags()
+ );
+ return w;
+}
+
+void Ecore::BusDispatcher::rem_watch( Watch* w )
+{
+ debug_log("ecore: removed watch %p", w);
+
+ delete w;
+}
diff --git a/src/error.cpp b/src/error.cpp
index 23f7bec..dc17d00 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/message.h>
#include <dbus-c++/error.h>
diff --git a/src/eventloop-integration.cpp b/src/eventloop-integration.cpp
index ca72ca8..5cdc79a 100644
--- a/src/eventloop-integration.cpp
+++ b/src/eventloop-integration.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/eventloop-integration.h>
#include <dbus-c++/debug.h>
diff --git a/src/eventloop.cpp b/src/eventloop.cpp
index 1d4aa2a..7d96777 100644
--- a/src/eventloop.cpp
+++ b/src/eventloop.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/eventloop.h>
#include <dbus-c++/debug.h>
diff --git a/src/glib-integration.cpp b/src/glib-integration.cpp
index bde3c7a..c82c77a 100644
--- a/src/glib-integration.cpp
+++ b/src/glib-integration.cpp
@@ -21,7 +21,10 @@
*
*/
-
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/glib-integration.h>
#include <dbus/dbus.h> // for DBUS_WATCH_*
diff --git a/src/interface.cpp b/src/interface.cpp
index 6a47cf6..f1cd68f 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/debug.h>
#include <dbus-c++/interface.h>
diff --git a/src/internalerror.h b/src/internalerror.h
index 1cc1fca..9636c6b 100644
--- a/src/internalerror.h
+++ b/src/internalerror.h
@@ -26,8 +26,9 @@
#define __DBUSXX_INTERNALERROR_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/error.h>
diff --git a/src/introspection.cpp b/src/introspection.cpp
index 88b61a1..eb17218 100644
--- a/src/introspection.cpp
+++ b/src/introspection.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/introspection.h>
#include <dbus-c++/object.h>
diff --git a/src/message.cpp b/src/message.cpp
index 119bff8..bf48405 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/message.h>
diff --git a/src/message_p.h b/src/message_p.h
index af421bc..830e63d 100644
--- a/src/message_p.h
+++ b/src/message_p.h
@@ -26,8 +26,9 @@
#define __DBUSXX_MESSAGE_P_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/message.h>
#include <dbus-c++/refptr_impl.h>
diff --git a/src/object.cpp b/src/object.cpp
index 970fcf7..9148cb2 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/debug.h>
#include <dbus-c++/object.h>
diff --git a/src/pendingcall.cpp b/src/pendingcall.cpp
index e55c174..dd14dbd 100644
--- a/src/pendingcall.cpp
+++ b/src/pendingcall.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/pendingcall.h>
diff --git a/src/pendingcall_p.h b/src/pendingcall_p.h
index 1768b52..dea4cbf 100644
--- a/src/pendingcall_p.h
+++ b/src/pendingcall_p.h
@@ -26,8 +26,9 @@
#define __DBUSXX_PENDING_CALL_P_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/pendingcall.h>
#include <dbus-c++/refptr_impl.h>
diff --git a/src/property.cpp b/src/property.cpp
index 1bf6c6b..69ba352 100644
--- a/src/property.cpp
+++ b/src/property.cpp
@@ -21,6 +21,11 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
+
#include <dbus-c++/debug.h>
#include <dbus-c++/property.h>
diff --git a/src/server.cpp b/src/server.cpp
index eae46d6..2493b74 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/debug.h>
#include <dbus-c++/server.h>
diff --git a/src/server_p.h b/src/server_p.h
index 6264ebf..b510712 100644
--- a/src/server_p.h
+++ b/src/server_p.h
@@ -26,8 +26,9 @@
#define __DBUSXX_SERVER_P_H
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/server.h>
#include <dbus-c++/dispatcher.h>
diff --git a/src/types.cpp b/src/types.cpp
index a144f78..f902b61 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -21,6 +21,10 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <dbus-c++/dbus-c++-config.h>
#include <dbus-c++/types.h>
#include <dbus-c++/object.h>