seed r100 - in trunk: examples libseed



Author: racarr
Date: Tue Nov  4 04:52:31 2008
New Revision: 100
URL: http://svn.gnome.org/viewvc/seed?rev=100&view=rev

Log:
Fix silly bug. Unions work now. 


Modified:
   trunk/examples/pango.js
   trunk/libseed/seed-structs.c
   trunk/libseed/seed-types.c

Modified: trunk/examples/pango.js
==============================================================================
--- trunk/examples/pango.js	(original)
+++ trunk/examples/pango.js	Tue Nov  4 04:52:31 2008
@@ -40,8 +40,7 @@
 
 function mouse_click(win, evt)
 {
-	Seed.print(evt);
-	Seed.print(evt.get_stage);
+	Seed.print(evt.get_x()+" "+evt.get_y());
 }
 
 var stage = gtkstage.get_stage();
@@ -54,4 +53,4 @@
 
 stage.add_actor(current_text);
 
-Gtk.main();
\ No newline at end of file
+Gtk.main();

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Tue Nov  4 04:52:31 2008
@@ -63,24 +63,49 @@
 		if (info)
 		{
 				n_methods =
-						g_struct_info_get_n_methods((GIStructInfo *)info);
+						g_union_info_get_n_methods((GIUnionInfo *)info);
 				for (i = 0; i < n_methods; i++)
 				{
 						GIFunctionInfo *finfo;
 						
-						finfo = g_struct_info_get_method(
-								(GIStructInfo*)info, i);
+						finfo = g_union_info_get_method(
+								(GIUnionInfo*)info, i);
 						
 						seed_gobject_define_property_from_function_info((GIFunctionInfo *)finfo,
 																		object,
 																		TRUE);
 				}
 		}
-		seed_value_set_property(object, "test", seed_value_from_int(5));
+
 		return object;
 }
 
 JSObjectRef seed_make_struct(gpointer strukt, GIBaseInfo *info)
 {
-		return seed_make_union(strukt, info);
+		JSObjectRef object;
+		int i, n_methods;
+		
+		if (!seed_struct_class)
+				seed_struct_class = JSClassCreate(&gobject_struct_def);
+		
+		object = JSObjectMake(eng->context, seed_struct_class, strukt);
+		
+		if (info)
+		{
+				n_methods =
+						g_struct_info_get_n_methods((GIStructInfo *)info);
+				for (i = 0; i < n_methods; i++)
+				{
+						GIFunctionInfo *finfo;
+						
+						finfo = g_struct_info_get_method(
+								(GIStructInfo*)info, i);
+						
+						seed_gobject_define_property_from_function_info((GIFunctionInfo *)finfo,
+																		object,
+																		TRUE);
+				}
+		}
+
+		return object;
 }

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Tue Nov  4 04:52:31 2008
@@ -493,7 +493,7 @@
 	case G_TYPE_POINTER:
 		return seed_make_struct(g_value_get_pointer(gval), 0);
 	}
-
+	
 	if(g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
 		return seed_value_from_long(gval->data[0].v_long);
 	else if(g_type_is_a(G_VALUE_TYPE(gval), G_TYPE_ENUM))
@@ -521,6 +521,10 @@
 				return seed_make_struct(g_value_peek_pointer(gval), info);
 									
 		}
+		else if (type == GI_INFO_TYPE_BOXED)
+		{
+				printf("Trying to marshal boxed type \n");
+		}
 			
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]