How do I dispatch a signal containing a variant with DBus-GLib?

View: New views
2 Messages — Rating Filter:   Alert me  

How do I dispatch a signal containing a variant with DBus-GLib?

by David Tucker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi all,

 

I’m using the DBus-GLib bindings and would like to dispatch a signal containing a GValue variant type.  I am not able to receive signals that contain a variant type, but I am able to dispatch and receive signals using non-variant types.

I’m also able to send and receive GValue types using method calls just fine.

 

I’m using the following code:

(again, this works fine when sending a char*, or other non-variant, instead of GValue)

 

Introspection:

<signal name="VariantSignal">

<arg type="v" name="value" />

</signal>

 

C code fragments:

--to create the signal ----

signals[VARIANT_SIGNAL] =

    g_signal_new ("VariantSignal",

                  G_OBJECT_CLASS_TYPE (klass),

                  (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED),

                  0,

                  NULL, NULL,

                  g_cclosure_marshal_VOID__BOXED,

                  G_TYPE_NONE, 1, G_TYPE_VALUE);

 

----- to dispatch the signal  ---

    GValue gv = {0};

    g_value_init(&gv, G_TYPE_STRING);   

    g_value_set_string(&gv, "Hello");   

    g_signal_emit (obj, signals[VARIANT_SIGNAL], 0, value);

    return TRUE;


_______________________________________________
dbus mailing list
dbus@...
http://lists.freedesktop.org/mailman/listinfo/dbus

RE: How do I dispatch a signal containing a variant with DBus-GLib?

by David Tucker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

I’m really sorry!  I made a silly mistake on the client side (the client was expecting the wrong signal prototype).  This code works fine.

 


From: dbus-bounces@... [mailto:dbus-bounces@...] On Behalf Of David Tucker
Sent: Friday, October 09, 2009 6:44 PM
To: dbus@...
Subject: How do I dispatch a signal containing a variant with DBus-GLib?

 

Hi all,

 

I’m using the DBus-GLib bindings and would like to dispatch a signal containing a GValue variant type.  I am not able to receive signals that contain a variant type, but I am able to dispatch and receive signals using non-variant types.

I’m also able to send and receive GValue types using method calls just fine.

 

I’m using the following code:

(again, this works fine when sending a char*, or other non-variant, instead of GValue)

 

Introspection:

<signal name="VariantSignal">

<arg type="v" name="value" />

</signal>

 

C code fragments:

--to create the signal ----

signals[VARIANT_SIGNAL] =

    g_signal_new ("VariantSignal",

                  G_OBJECT_CLASS_TYPE (klass),

                  (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED),

                  0,

                  NULL, NULL,

                  g_cclosure_marshal_VOID__BOXED,

                  G_TYPE_NONE, 1, G_TYPE_VALUE);

 

----- to dispatch the signal  ---

    GValue gv = {0};

    g_value_init(&gv, G_TYPE_STRING);   

    g_value_set_string(&gv, "Hello");   

    g_signal_emit (obj, signals[VARIANT_SIGNAL], 0, value);

    return TRUE;


_______________________________________________
dbus mailing list
dbus@...
http://lists.freedesktop.org/mailman/listinfo/dbus