[Kde-bindings] KDE/kdebindings/csharp/qyoto
Arno Rehn
kde at arnorehn.de
Sat Mar 21 20:14:56 UTC 2009
SVN commit 942473 by arnorehn:
* Use qDBusReplyFill to get the data from a dbus call into a QDBusReply.
This adds support for non-primitive types such as QVariantMap.
CCMAIL: kde-bindings at kde.org
M +4 -0 ChangeLog
M +9 -11 qdbus/QDBusReply.cs
M +19 -0 src/qyoto.cpp
--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #942472:942473
@@ -1,3 +1,7 @@
+2009-03-21 Arno Rehn <arno at arnorehn.de>
+ * Use qDBusReplyFill to get the data from a dbus call into a QDBusReply.
+ This adds support for non-primitive types such as QVariantMap.
+
2009-02-10 Arno Rehn <arno at arnorehn.de>
* Get rid of application_terminated checks in methodcall.cpp and make the
application cleanup properly. The problem was WeakReference.IsValid being
--- trunk/KDE/kdebindings/csharp/qyoto/qdbus/QDBusReply.cs #942472:942473
@@ -1,22 +1,20 @@
namespace Qyoto {
using System;
+ using System.Runtime.InteropServices;
using System.Collections.Generic;
public class QDBusReply<T> {
+ [DllImport("libqyoto", CharSet=CharSet.Ansi)]
+ private static extern void qyoto_qdbus_reply_fill(IntPtr msg, IntPtr error, IntPtr variant);
+
public QDBusReply(QDBusMessage reply) {
m_error = new QDBusError(reply);
- if (m_error.IsValid()) {
- return;
- }
-
- if (reply.Arguments().Count >= 1) {
- m_data = (reply.Arguments()[0]).Value<QDBusVariant>().Value<T>();
- return;
- }
-
- m_error = new QDBusError( QDBusError.ErrorType.InvalidSignature,
- "Unexpected reply signature" );
+ QVariant variant = QVariant.FromValue<T>(default(T));
+ qyoto_qdbus_reply_fill((IntPtr) GCHandle.Alloc(reply), (IntPtr) GCHandle.Alloc(m_error),
+ (IntPtr) GCHandle.Alloc(variant));
+ if (!m_error.IsValid())
+ m_data = variant.Value<T>();
}
public QDBusReply(QDBusError dbusError) {
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyoto.cpp #942472:942473
@@ -33,6 +33,7 @@
#include <QtCore/qregexp.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
+#include <QtDBus/QDBusReply>
#include <QtGui/qapplication.h>
#undef DEBUG
@@ -319,6 +320,24 @@
return instance;
}
+Q_DECL_EXPORT void
+qyoto_qdbus_reply_fill(void *msg, void *error, void *variant)
+{
+ smokeqyoto_object *o = (smokeqyoto_object*) (*GetSmokeObject)(msg);
+ QDBusMessage *dbusmsg = (QDBusMessage*) o->ptr;
+ (*FreeGCHandle)(msg);
+
+ o = (smokeqyoto_object*) (*GetSmokeObject)(error);
+ QDBusError *dbuserror = (QDBusError*) o->ptr;
+ (*FreeGCHandle)(error);
+
+ o = (smokeqyoto_object*) (*GetSmokeObject)(variant);
+ QVariant *v = (QVariant*) o->ptr;
+ (*FreeGCHandle)(variant);
+
+ qDBusReplyFill(*dbusmsg, *dbuserror, *v);
+}
+
Q_DECL_EXPORT void *
QVariantValue(char * typeName, void * variant)
{
More information about the Kde-bindings
mailing list