[seed] Add void* userdata support for gobjects
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Add void* userdata support for gobjects
- Date: Sun, 18 Apr 2010 08:28:59 +0000 (UTC)
commit 3791ecad4d0fb31a50077bd102a898544b6c0cfc
Author: Alan Knowles <alan akbkhome com>
Date: Sun Apr 18 15:37:14 2010 +0800
Add void* userdata support for gobjects
gtk_menu_popup void* userdata when used with gtk_statusicon_position_menu
expect the userdata to be a pointer to the status icon. This change checks void*
arguments and if they are gobjects, sends them.
libseed/seed-types.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index defc766..67fa9e5 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -481,10 +481,28 @@ seed_gi_make_argument (JSContextRef ctx,
switch (gi_tag)
{
case GI_TYPE_TAG_VOID:
- // things like gio.outputstream.write use void pointers
+
if (g_type_info_is_pointer (type_info))
- arg->v_string = seed_value_to_string (ctx, value, exception);
+ {
+ GObject *gobject;
+ if (JSValueIsString (ctx, value))
+ {
+ /*
+ things like gio.outputstream.write use void pointers
+ might need a few other types here..
+ not very well memory managed. - should be solved by bytearrays when
+ introspection implements it.
+ */
+ arg->v_string = seed_value_to_string (ctx, value, exception);
+ break;
+ }
+ /* gtk_statusicon_position_menu / gtk_menu_popup use the userdata for the Gobject */
+ gobject = seed_value_to_object (ctx, value, exception);
+ if (!gobject)
+ return FALSE;
+ arg->v_pointer = gobject;
+ }
break;
case GI_TYPE_TAG_BOOLEAN:
arg->v_boolean = seed_value_to_boolean (ctx, value, exception);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]