+2007-04-20 2007-04-20 Murray Cumming <murrayc@murrayc.com>
+
+ * configure.ac:
+ * src/Makefile.am:
+ * src/dbus_api/Makefile.am:
+ * src/dbus_api/modest-dbus-callbacks.c:
+ * src/dbus_api/modest-dbus-callbacks.h:
+ * src/maemo/modest-platform.c: (modest_platform_init):
+ Added the beginnings of a D-Bus API. At the moment it just has a HelloWorld
+ method.
+ * tests/Makefile.am:
+ * tests/dbus_api/Makefile.am:
+ * tests/dbus_api/test_hello.c: (main): Very simple test of the D-Bus API.
+
2007-04-20 Murray Cumming <murrayc@murrayc.com>
* src/maemo/modest-account-settings-dialog.c:
Makefile
man/Makefile
src/Makefile
+src/dbus_api/Makefile
src/gnome/Makefile
src/maemo/Makefile
src/maemo/easysetup/Makefile
docs/Makefile
docs/reference/Makefile
tests/Makefile
+tests/dbus_api/Makefile
src/maemo/modest.desktop
src/maemo/modest.service
])
#
# Makefile.am
# Time-stamp: <2007-04-10 10:58:05 (djcb)>
-SUBDIRS=$(MODEST_PLATFORM) widgets
+SUBDIRS=$(MODEST_PLATFORM) widgets dbus_api
DIST_SUBDIRS = widgets gnome maemo
INCLUDES=\
$(MODEST_LIBTINYMAIL_MAEMO_LIBS) \
${easysetupmaybe} \
$(MODEST_PLATFORM)/libmodest-ui.la \
- widgets/libmodest-widgets.la
+ widgets/libmodest-widgets.la \
+ dbus_api/libmodest-dbus-api.la
EXTRA_DIST=modest-marshal.list
--- /dev/null
+# Copyright (c) 2006,2007 Nokia Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the Nokia Corporation nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+INCLUDES=\
+ $(MODEST_GSTUFF_CFLAGS) \
+ $(MODEST_LIBTINYMAIL_MAEMO_CFLAGS) \
+ -DMODEST_PLATFORM_ID=$(MODEST_PLATFORM_ID) \
+ -I ${top_srcdir}/src/widgets \
+ -I ${top_srcdir}/src \
+ -DPREFIX=\"@prefix@\" \
+ -DMAEMO_CHANGES \
+ -DPIXMAP_PREFIX=\"${datadir}/pixmaps/modest/\" \
+ -DMODEST_UIDIR=\""$(datadir)/modest/ui/"\" \
+ -DPROVIDER_DATA_DIR=\""${datadir}/modest/provider-data/"\" \
+ -Wall
+
+noinst_LTLIBRARIES=\
+ libmodest-dbus-api.la
+
+libmodest_dbus_api_la_SOURCES= \
+ modest-dbus-callbacks.h modest-dbus-callbacks.c
+
+LDADD = \
+ $(MODEST_GSTUFF_LIBS) \
+ $(MODEST_LIBTINYMAIL_MAEMO_LIBS)
+
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "modest-dbus-callbacks.h"
+#include <stdio.h>
+
+/* Callback for normal D-BUS messages */
+gint modest_dbus_req_handler(const gchar * interface, const gchar * method,
+ GArray * arguments, gpointer data,
+ osso_rpc_t * retval)
+{
+ printf("debug: modest_dbus_req_handler()\n");
+
+ if (g_ascii_strcasecmp(method, MODEST_DBUS_EXAMPLE_MESSAGE) == 0) {
+ printf("debug: method received:" MODEST_DBUS_EXAMPLE_MESSAGE "\n");
+ }
+
+ return OSSO_OK;
+}
--- /dev/null
+/* Copyright (c) 2007, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef __MODEST_DBUS_CALLBACKS_H__
+#define __MODEST_DBUS_CALLBACKS_H__
+
+#include <glib.h>
+#include <libosso.h>
+
+/* Note that the com.nokia service name and /com/nokia object name
+ * are what is assumed by the, bizarrely named, osso_rpc_run_with_defaults() function,
+ * so they are probably a good choice. */
+#define MODEST_DBUS_NAME "modestemail"
+#define MODEST_DBUS_EXAMPLE_SERVICE "com.nokia."MODEST_DBUS_NAME
+#define MODEST_DBUS_EXAMPLE_OBJECT "/com/nokia/"MODEST_DBUS_NAME
+#define MODEST_DBUS_EXAMPLE_IFACE "com.nokia."MODEST_DBUS_NAME
+#define MODEST_DBUS_EXAMPLE_MESSAGE "HelloWorld"
+
+gint modest_dbus_req_handler(const gchar * interface, const gchar * method,
+ GArray * arguments, gpointer data,
+ osso_rpc_t * retval);
+
+#endif /* __MODEST_DBUS_CALLBACKS_H__ */
#include <config.h>
#include <glib/gi18n.h>
#include <modest-platform.h>
+#include <dbus_api/modest-dbus-callbacks.h>
#include <libosso.h>
#ifdef MODEST_HILDON_VERSION_0
g_printerr ("modest: failed to acquire osso context\n");
return FALSE;
}
+
+ /* Register our D-Bus callbacks, via the osso API: */
+ osso_return_t result = osso_rpc_set_cb_f(osso_context,
+ MODEST_DBUS_EXAMPLE_SERVICE,
+ MODEST_DBUS_EXAMPLE_OBJECT,
+ MODEST_DBUS_EXAMPLE_IFACE,
+ modest_dbus_req_handler, NULL /* user_data */);
+ if (result != OSSO_OK) {
+ g_print("Error setting D-BUS callback (%d)\n", result);
+ return OSSO_ERROR;
+ }
+
+ /* Add handler for Exit D-BUS messages.
+ * Not used because osso_application_set_exit_cb() is deprecated and obsolete:
+ result = osso_application_set_exit_cb(osso_context,
+ modest_dbus_exit_event_handler,
+ (gpointer) NULL);
+ if (result != OSSO_OK) {
+ g_print("Error setting exit callback (%d)\n", result);
+ return OSSO_ERROR;
+ }
+ */
+
return TRUE;
}
# Makefile.am
#
+SUBDIRS = dbus_api
+
+# TODO: Why is this line here?
MAINTAINERCLEANFILES = Makefile.in
TESTS_ENVIRONMENT = top_builddir=$(top_builddir) \
$(MODEST_LIBTINYMAIL_MAEMO_LIBS) \
${top_srcdir}/src/$(MODEST_PLATFORM)/libmodest-ui.la \
${top_srcdir}/src/widgets/libmodest-widgets.la \
+ ${top_srcdir}/src/dbus_api/libmodest-dbus-api.la \
${top_srcdir}/src/modest-runtime.o \
${top_srcdir}/src/modest-singletons.o \
${top_srcdir}/src/modest-tny-account.o \
--- /dev/null
+INCLUDES=\
+ @CHECK_CFLAGS@ \
+ $(MODEST_GSTUFF_CFLAGS)\
+ $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \
+ $(MODEST_LIBTINYMAIL_MAEMO_CFLAGS) \
+ -I$(MODEST_PLATFORM) \
+ -I${top_srcdir}/src \
+ -DPREFIX=\"@prefix@\" \
+ -DMODESTLOCALEDIR=\""$(modestlocaledir)"\"
+
+objects=\
+ @CHECK_LIBS@ \
+ $(MODEST_GSTUFF_LIBS) \
+ $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS) \
+ $(MODEST_LIBTINYMAIL_MAEMO_LIBS)
+
+noinst_PROGRAMS = test_hello
+
+test_hello_SOURCES = test_hello.c
+test_hello_LDADD = $(objects)
+
--- /dev/null
+#include <libosso.h>
+#include <stdio.h>
+
+#define MODEST_DBUS_NAME "modestemail"
+#define MODEST_DBUS_EXAMPLE_MESSAGE "HelloWorld"
+
+
+
+int main(int argc, char *argv[])
+{
+ /* Initialize maemo application */
+ osso_context_t * osso_context = osso_initialize(
+ "test_hello", "0.0.1", TRUE, NULL);
+
+ /* Check that initialization was ok */
+ if (osso_context == NULL)
+ {
+ printf("osso_initialize() failed.\n");
+ return OSSO_ERROR;
+ }
+
+ osso_rpc_t retval;
+ osso_return_t ret = osso_rpc_run_with_defaults(osso_context,
+ MODEST_DBUS_NAME,
+ MODEST_DBUS_EXAMPLE_MESSAGE, &retval, DBUS_TYPE_INVALID);
+ if (ret != OSSO_OK) {
+ printf("osso_rpc_run() failed.\n");
+ return OSSO_ERROR;
+ } else {
+ printf("osso_rpc_run() succeeded.\n");
+ }
+
+ osso_rpc_free_val(&retval);
+
+ /* Exit */
+ return 0;
+}