File: ondemand.namespace.diff

package info (click to toggle)
seed-webkit2 4.0.0+20161014+6c77960+dfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,760 kB
  • sloc: ansic: 25,104; makefile: 1,023; xml: 206; python: 173; sh: 46
file content (697 lines) | stat: -rw-r--r-- 20,898 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
diff --git a/libseed/seed-builtins.c b/libseed/seed-builtins.c
index b5b14fc..6bbb07c 100644
--- a/libseed/seed-builtins.c
+++ b/libseed/seed-builtins.c
@@ -279,6 +279,48 @@ seed_g_type_name_to_string (GITypeInfo * type)
   return type_name;
 }
 
+
+
+static JSValueRef
+seed_run_dispose (JSContextRef ctx,
+		 JSObjectRef function,
+		 JSObjectRef this_object,
+		 size_t argumentCount,
+		 const JSValueRef arguments[], JSValueRef * exception)
+{
+   
+  GObject* object;
+  
+
+  if (argumentCount != 1)
+    {
+      seed_make_exception (ctx, exception, "ArgumentError",
+			   "Seed.run_dispose^ expected 1 argument, "
+			   "got %zd", argumentCount);
+      return JSValueMakeNull (ctx);
+    }
+
+  if (!JSValueIsObject (ctx, arguments[0]))
+    return JSValueMakeNull (ctx);
+  if (!JSValueIsObjectOfClass (ctx, arguments[0], gobject_class)) {
+    SEED_NOTE (FINALIZATION,
+		 "seed_run_dispose - failed - not gobject_class ");
+ 
+    return JSValueMakeNull (ctx);
+  }
+
+  object = seed_value_to_object (ctx,  arguments[0], exception);
+  while(object->ref_count > 1) 
+     g_object_unref(object);
+  
+   SEED_NOTE (FINALIZATION,
+		 "Manual dispose of gobject.");
+     
+  g_object_run_dispose(object);
+  return JSValueMakeNull (ctx);
+}
+
+
 static JSValueRef
 seed_introspect (JSContextRef ctx,
 		 JSObjectRef function,
@@ -542,6 +584,7 @@ seed_init_builtins (SeedEngine * local_eng, gint * argc, gchar *** argv)
 			"introspect", &seed_introspect, obj);
   seed_create_function (local_eng->context, "spawn", &seed_spawn, obj);
   seed_create_function (local_eng->context, "quit", &seed_quit, obj);
+  seed_create_function (local_eng->context, "run_dispose", &seed_run_dispose, obj);
   seed_create_function (local_eng->context, "breakpoint",
 			&seed_breakpoint, obj);
 
diff --git a/libseed/seed-closure.c b/libseed/seed-closure.c
index 62241c8..f621160 100644
--- a/libseed/seed-closure.c
+++ b/libseed/seed-closure.c
@@ -288,10 +288,9 @@ seed_handle_closure (ffi_cif * cif, void *result, void **args, gpointer userdata
       *(gpointer *) result = 0;
     }
   g_base_info_unref ((GIBaseInfo *) return_type);
-  
-  JSGarbageCollect(ctx);
-
+   
   JSGlobalContextRelease ((JSGlobalContextRef) ctx);
+  JSGarbageCollect(ctx);
 }
 
 SeedNativeClosure *
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 3870fb0..06364f1 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1009,6 +1009,45 @@ seed_gobject_define_property_from_function_info (JSContextRef ctx,
 
 }
 
+
+
+JSObjectRef
+seed_gobject_function_info_to_value (JSContextRef ctx,
+						 GIFunctionInfo * info,
+						 gboolean instance)
+{
+  GIFunctionInfoFlags flags;
+  JSObjectRef method_ref;
+  const gchar *name;
+
+  //if (g_base_info_is_deprecated ((GIBaseInfo *) info))
+  //g_printf("Not defining deprecated symbol: %s \n",
+  //g_base_info_get_name((GIBaseInfo *)info));
+
+  flags = g_function_info_get_flags (info);
+
+  if (instance && (flags & GI_FUNCTION_IS_CONSTRUCTOR))
+    {
+      return;
+    }
+
+  method_ref = JSObjectMake (ctx, gobject_method_class,
+			     g_base_info_ref ((GIBaseInfo *) info));
+
+  JSObjectSetPrototype (ctx, method_ref, function_proto);
+
+   
+  seed_object_set_property (ctx, method_ref, "info",
+			    seed_make_struct (ctx,
+					      g_base_info_ref ((GIBaseInfo *)
+							       info),
+					      base_info_info));
+  return method_ref;
+  
+}
+
+
+
 static void
 seed_gobject_add_methods_for_interfaces (JSContextRef ctx,
 					 GIObjectInfo * oinfo,
diff --git a/libseed/seed-engine.h b/libseed/seed-engine.h
index 4adcde5..a97c4bd 100644
--- a/libseed/seed-engine.h
+++ b/libseed/seed-engine.h
@@ -52,6 +52,10 @@ typedef struct _SeedScript
 JSObjectRef seed_gobject_get_prototype_for_gtype (GType type);
 JSClassRef seed_gobject_get_class_for_gtype (JSContextRef ctx, GType type);
 
+JSObjectRef
+seed_gobject_function_info_to_value (JSContextRef ctx,
+						 GIFunctionInfo * info,
+						 gboolean instance);
 void
 seed_gobject_define_property_from_function_info (JSContextRef ctx,
 						 GIFunctionInfo * info,
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index de331ff..b345480 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -28,6 +28,8 @@ JSClassRef importer_class;
 JSObjectRef importer;
 
 JSClassRef gi_importer_class;
+JSClassRef gi_importer_namespace;
+
 JSObjectRef gi_importer;
 JSObjectRef gi_importer_versions;
 
@@ -90,24 +92,25 @@ seed_gi_importer_is_init (GIFunctionInfo * info)
   return TRUE;
 }
 
-static void
+static JSValueRef
 seed_gi_importer_handle_function (JSContextRef ctx,
-				  JSObjectRef namespace_ref,
 				  GIFunctionInfo * info,
 				  JSValueRef * exception)
 {
-  if (!seed_gi_importer_is_init (info))
-    seed_gobject_define_property_from_function_info (ctx,
-						     (GIFunctionInfo *) info,
-						     namespace_ref, FALSE);
-  else
-    {
-      JSObjectRef init_method;
-
-      init_method = JSObjectMake (ctx, gobject_init_method_class,
+ 
+  if (seed_gi_importer_is_init (info)) {
+     
+   
+      return  JSObjectMake (ctx, gobject_init_method_class,
 				  g_base_info_ref ((GIBaseInfo *) info));
-      seed_object_set_property (ctx, namespace_ref, "init", init_method);
+      
     }
+
+return seed_gobject_function_info_to_value (ctx,  info,  FALSE);
+ 
+
+
+  
 }
 
 /*
@@ -116,9 +119,8 @@ seed_gi_importer_handle_function (JSContextRef ctx,
  * a value for each member, all in uppercase
  * i.e. Gtk.WindowType.NORMAL
  */
-static void
-seed_gi_importer_handle_enum (JSContextRef ctx,
-			      JSObjectRef namespace_ref,
+static JSValueRef
+seed_gi_importer_handle_enum (JSContextRef ctx, 
 			      GIEnumInfo * info, JSValueRef * exception)
 {
   JSObjectRef enum_class;
@@ -130,9 +132,9 @@ seed_gi_importer_handle_enum (JSContextRef ctx,
 
   enum_class = JSObjectMake (ctx, 0, 0);
   num_vals = g_enum_info_get_n_values (info);
-  seed_object_set_property (ctx, namespace_ref,
-			    g_base_info_get_name ((GIBaseInfo *) info),
-			    enum_class);
+  //seed_object_set_property (ctx, namespace_ref,
+ //			    g_base_info_get_name ((GIBaseInfo *) info),
+ //			    enum_class);
 
   for (i = 0; i < num_vals; i++)
     {
@@ -158,6 +160,7 @@ seed_gi_importer_handle_enum (JSContextRef ctx,
       g_base_info_unref ((GIBaseInfo *) val);
 
     }
+  return enum_class;
 }
 
 /*
@@ -165,78 +168,81 @@ seed_gi_importer_handle_enum (JSContextRef ctx,
  * Namespace.Type will be the constructor and Namespace.Type.prototype is
  * the prototype object. Namespace.Type.type will be the GType.
  */
-static void
-seed_gi_importer_handle_object (JSContextRef ctx,
-				JSObjectRef namespace_ref,
+static JSValueRef
+seed_gi_importer_handle_object (JSContextRef ctx, 
 				GIObjectInfo * info, JSValueRef * exception)
 {
   GType type;
   JSClassRef class_ref;
+  //JSValueRef ret;
 
+  
   type = g_registered_type_info_get_g_type ((GIRegisteredTypeInfo *) info);
 
-  if (type != 0)
-    {
-      GIFunctionInfo *finfo;
-      GIFunctionInfoFlags flags;
-      JSObjectRef constructor_ref;
-      guint i, n_methods;
+  if (type == 0) {
+    return NULL;
+  }
 
-      class_ref = seed_gobject_get_class_for_gtype (ctx, type);
 
-      constructor_ref =
-	JSObjectMake (ctx, gobject_constructor_class, (gpointer) type);
+  GIFunctionInfo *finfo;
+  GIFunctionInfoFlags flags;
+  JSObjectRef constructor_ref;
+  guint i, n_methods;
 
-      seed_object_set_property (ctx, constructor_ref,
-				"type",
-				seed_value_from_long (ctx, type, exception));
-      n_methods = g_object_info_get_n_methods (info);
-      for (i = 0; i < n_methods; i++)
-	{
-	  finfo = g_object_info_get_method (info, i);
-	  flags = g_function_info_get_flags (finfo);
-	  if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
-	    {
-	      JSObjectRef constructor = JSObjectMake (ctx,
-						      gobject_named_constructor_class,
-						      finfo);
-	      const gchar *fname =
-		g_base_info_get_name ((GIBaseInfo *) finfo);
-	      if (g_strrstr (fname, "new_") == fname)
-		fname += 4;
-	      else if (!g_strcmp0 (fname, "new"))
-		fname = "c_new";
-
-	      seed_object_set_property (ctx,
-					constructor_ref, fname, constructor);
-	    }
-	  else if (!(flags & GI_FUNCTION_IS_METHOD))
-	    {
-	      seed_gobject_define_property_from_function_info
-		(ctx, finfo, constructor_ref, FALSE);
-	    }
-	  else
-	    {
-	      g_base_info_unref ((GIBaseInfo *) finfo);
-	    }
-	}
+  class_ref = seed_gobject_get_class_for_gtype (ctx, type);
+
+  constructor_ref =
+    JSObjectMake (ctx, gobject_constructor_class, (gpointer) type);
 
-      seed_object_set_property (ctx, namespace_ref,
-				g_base_info_get_name ((GIBaseInfo *) info),
-				constructor_ref);
-      seed_object_set_property (ctx, constructor_ref,
-				"prototype",
-				seed_gobject_get_prototype_for_gtype (type));
+  seed_object_set_property (ctx, constructor_ref,
+                            "type",
+                            seed_value_from_long (ctx, type, exception));
+  n_methods = g_object_info_get_n_methods (info);
+  for (i = 0; i < n_methods; i++)
+  {
+    finfo = g_object_info_get_method (info, i);
+    flags = g_function_info_get_flags (finfo);
+    if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
+    {
+      JSObjectRef constructor = JSObjectMake (ctx,
+                                              gobject_named_constructor_class,
+                                              finfo);
+      const gchar *fname =
+	g_base_info_get_name ((GIBaseInfo *) finfo);
+      if (g_strrstr (fname, "new_") == fname)
+	fname += 4;
+      else if (!g_strcmp0 (fname, "new"))
+	fname = "c_new";
+
+      seed_object_set_property (ctx,
+                                constructor_ref, fname, constructor);
     }
+    else if (!(flags & GI_FUNCTION_IS_METHOD))
+    {
+      seed_gobject_define_property_from_function_info
+	(ctx, finfo, constructor_ref, FALSE);
+    }
+    else
+    {
+      g_base_info_unref ((GIBaseInfo *) finfo);
+    }
+  }
+  // sets up imports.gi.Gtk.Window << 
+
+  seed_object_set_property (ctx, constructor_ref,
+                            "prototype",
+                            seed_gobject_get_prototype_for_gtype (type));
+
+  return  (JSValueRef) constructor_ref;
+  
 }
 
 /*
  * Set up prototype and constructor for structs. Same semantics as objects except
  * for the type.
  */
-static void
+static JSValueRef
 seed_gi_importer_handle_struct (JSContextRef ctx,
-				JSObjectRef namespace_ref,
 				GIStructInfo * info, JSValueRef * exception)
 {
   JSObjectRef struct_ref;
@@ -279,14 +285,15 @@ seed_gi_importer_handle_struct (JSContextRef ctx,
   proto = seed_struct_prototype (ctx, (GIBaseInfo *) info);
   seed_object_set_property (ctx, struct_ref, "prototype", proto);
 
-  seed_object_set_property (ctx, namespace_ref,
+  return struct_ref;
+  /*seed_object_set_property (ctx, namespace_ref,
 			    g_base_info_get_name ((GIBaseInfo *) info),
 			    struct_ref);
+  */
 }
 
-static void
+static JSValueRef
 seed_gi_importer_handle_union (JSContextRef ctx,
-			       JSObjectRef namespace_ref,
 			       GIUnionInfo * info, JSValueRef * exception)
 {
   JSObjectRef union_ref;
@@ -315,32 +322,31 @@ seed_gi_importer_handle_union (JSContextRef ctx,
 
   proto = seed_union_prototype (ctx, (GIBaseInfo *) info);
   seed_object_set_property (ctx, union_ref, "prototype", proto);
-
-  seed_object_set_property (ctx, namespace_ref,
-			    g_base_info_get_name ((GIBaseInfo *) info),
-			    union_ref);
+  return union_ref;
+  //seed_object_set_property (ctx, namespace_ref,
+//			    g_base_info_get_name ((GIBaseInfo *) info),
+			//    union_ref);
 }
 
-static void
+static JSValueRef
 seed_gi_importer_handle_callback (JSContextRef ctx,
-				  JSObjectRef namespace_ref,
 				  GICallbackInfo * info,
 				  JSValueRef * exception)
 {
   JSObjectRef callback_ref = JSObjectMake (ctx,
 					   seed_callback_class,
 					   info);
-  seed_object_set_property (ctx, namespace_ref,
-			    g_base_info_get_name ((GIBaseInfo *) info),
-			    (JSValueRef) callback_ref);
+  return callback_ref;
+ // seed_object_set_property (ctx, namespace_ref,
+//			    g_base_info_get_name ((GIBaseInfo *) info),
+//			    (JSValueRef) callback_ref);
 }
 
 /*
  * Define constants toplevel. Uses the casing as in the typelib
  */
-static void
+static JSValueRef
 seed_gi_importer_handle_constant (JSContextRef ctx,
-				  JSObjectRef namespace_ref,
 				  GIConstantInfo * info,
 				  JSValueRef * exception)
 {
@@ -351,11 +357,14 @@ seed_gi_importer_handle_constant (JSContextRef ctx,
   g_constant_info_get_value (info, &argument);
   constant_value =
     seed_value_from_gi_argument (ctx, &argument, constant_type, exception);
-  seed_object_set_property (ctx, namespace_ref,
-			    g_base_info_get_name ((GIBaseInfo *) info),
-			    constant_value);
+g_base_info_unref ((GIBaseInfo *) constant_type);
+  return constant_value;
+  
+  //seed_object_set_property (ctx, namespace_ref,
+	//		    g_base_info_get_name ((GIBaseInfo *) info),
+	//		    constant_value);
 
-  g_base_info_unref ((GIBaseInfo *) constant_type);
+  
 }
 
 static gchar *
@@ -373,6 +382,13 @@ seed_gi_importer_get_version (JSContextRef ctx,
   return version;
 }
 
+/**
+ * original code creates a huge object, when even a large namespace is pulled in.
+ * let's try and create a fake object, representing the namespace,
+ * and see what happens
+ * 
+ */
+
 JSObjectRef
 seed_gi_importer_do_namespace (JSContextRef ctx,
 			       gchar * namespace, JSValueRef * exception)
@@ -380,7 +396,6 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
   GIBaseInfo *info;
   JSObjectRef namespace_ref;
   GError *e = NULL;
-  guint n, i;
   gchar *version = NULL;
   gchar *jsextension;
   JSStringRef extension_script;
@@ -397,6 +412,7 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
 
   if (gi_importer_versions != NULL)
     version = seed_gi_importer_get_version (ctx, namespace, exception);
+  
   if (!g_irepository_require (NULL, namespace, version, 0, &e))
     {
       seed_make_exception_from_gerror (ctx, exception, e);
@@ -407,6 +423,16 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
   if (version != NULL)
     g_free (version);
 
+ // at this point we have loaded the namespace (eg. proved it exists)
+  namespace_ref = JSObjectMake (ctx, gi_importer_namespace, 
+                		g_strdup (namespace));
+  
+  SEED_NOTE (IMPORTER, "Constructing namespace ref (%p) for %s",
+	     namespace_ref, namespace);
+
+  JSValueProtect (ctx, namespace_ref);
+
+  /*
   n = g_irepository_get_n_infos (NULL, namespace);
 
   namespace_ref = JSObjectMake (ctx, NULL, NULL);
@@ -461,9 +487,13 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
 	}
       g_base_info_unref (info);
     }
-
+*/
+  // store it for quick lookup
+  
   g_hash_table_insert (gi_imports, g_strdup (namespace), namespace_ref);
 
+  // run a specific extension relating to this namespace..
+  
   jsextension = g_strdup_printf ("imports.extensions.%s", namespace);
   extension_script = JSStringCreateWithUTF8CString (jsextension);
   JSEvaluateScript (ctx, extension_script, NULL, NULL, 0, exception);
@@ -476,6 +506,117 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
 }
 
 static JSValueRef
+seed_gi_importer_namespace_get_property (JSContextRef ctx,
+			       JSObjectRef object,
+			       JSStringRef property_name,
+			       JSValueRef * exception)
+{
+   JSObjectRef ret;
+   guint len;
+   gchar *prop;
+    gchar * namespace;
+   guint n, i;
+ GIBaseInfo *info;  
+ 
+    //what prop are we trying to get...
+    len = JSStringGetMaximumUTF8CStringSize (property_name);
+    prop = g_alloca (len * sizeof (gchar));
+    JSStringGetUTF8CString (property_name, prop, len);
+
+    // what are we trying to get it from 
+    namespace = (gchar*) JSObjectGetPrivate (object);
+
+  SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s",
+              namespace, prop);
+
+  
+    n = g_irepository_get_n_infos (NULL, namespace);
+
+    ret = NULL;
+  
+    for (i = 0; i < n; i++)
+    {
+      GIInfoType info_type;
+
+      info = g_irepository_get_info (NULL, namespace, i);
+      info_type = g_base_info_get_type (info);
+      // does the name need freeing???
+      //info_name =  if (g_strcmp0 (g_base_info_get_name ((GIBaseInfo *) info), "init"))
+
+      if (g_strcmp0 (g_base_info_get_name ((GIBaseInfo *) info), prop)) {
+	g_base_info_unref (info);
+	continue;
+      }
+      
+      switch (info_type)
+	{
+	case GI_INFO_TYPE_FUNCTION:
+	  SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a function",
+              namespace, prop);
+
+	   ret =  seed_gi_importer_handle_function (ctx,   (GIFunctionInfo *) info,
+			exception);
+	 
+	     
+	  break;
+	case GI_INFO_TYPE_ENUM:
+	case GI_INFO_TYPE_FLAGS:
+		SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a enum/flag",
+      			namespace, prop);
+
+	   ret =   seed_gi_importer_handle_enum (ctx, 
+	 				(GIEnumInfo *) info, exception);
+	     
+	     g_base_info_unref (info);
+	  return ret; 
+	
+	  break;
+	case GI_INFO_TYPE_OBJECT:
+	  ret = seed_gi_importer_handle_object (ctx, 
+					  (GIObjectInfo *) info, exception);
+	   break;
+	case GI_INFO_TYPE_STRUCT:
+	    SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a struct",
+              namespace, prop);
+
+	  ret = seed_gi_importer_handle_struct (ctx, 
+					  (GIStructInfo *) info, exception);
+	   break;
+	case GI_INFO_TYPE_UNION:
+	    SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a union",
+              namespace, prop);
+
+	 ret = seed_gi_importer_handle_union (ctx,  
+					 (GIUnionInfo *) info, exception);
+	 
+	    break;
+	case GI_INFO_TYPE_CALLBACK:
+	    SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a callback",
+              namespace, prop);
+
+	ret =   seed_gi_importer_handle_callback (ctx, 
+	 				    (GICallbackInfo *) info,
+	 				    exception);
+	  break;
+	case GI_INFO_TYPE_CONSTANT:
+	    SEED_NOTE (IMPORTER, "seed_gi_importer_namespace_get_property %s::%s :: is a constant",
+              namespace, prop);
+
+	ret =   seed_gi_importer_handle_constant (ctx, 
+	 				    (GIConstantInfo *) info,
+	 				    exception);
+	  break;
+	default:
+	  break;
+	}
+      g_base_info_unref (info);
+    }
+  
+    return ret;
+
+}
+
+static JSValueRef
 seed_gi_importer_get_property (JSContextRef ctx,
 			       JSObjectRef object,
 			       JSStringRef property_name,
@@ -1040,6 +1181,28 @@ JSClassDefinition gi_importer_class_def = {
   NULL				/* Convert To Type */
 };
 
+JSClassDefinition gi_importer_namespace_def = {
+  0,				/* Version, always 0 */
+  0,
+  "gi_namespace_importer",	/* Class Name */
+  NULL,				/* Parent Class */
+  NULL,				/* Static Values */
+  NULL,				/* Static Functions */
+  NULL,				/* Initialize */
+  NULL,				/* Finalize */
+  NULL,				/* Has Property */
+  seed_gi_importer_namespace_get_property,	/* Get Property */
+  NULL,				/* Set Property */
+  NULL,				/* Delete Property */
+  NULL,				/* Get Property Names */
+  NULL,				/* Call As Function */
+  NULL,				/* Call As Constructor */
+  NULL,				/* Has Instance */
+  NULL				/* Convert To Type */
+};
+
+
+
 JSClassDefinition importer_dir_class_def = {
   0,				/* Version, always 0 */
   0,
@@ -1075,6 +1238,10 @@ seed_initialize_importer (JSContextRef ctx, JSObjectRef global)
   JSValueProtect (ctx, gi_importer);
   JSValueProtect (ctx, gi_importer_versions);
 
+   gi_importer_namespace = JSClassCreate (&gi_importer_namespace_def);
+   //JSValueProtect (ctx, gi_importer_namespace);
+  
+  
   importer_dir_class = JSClassCreate (&importer_dir_class_def);
 
   gi_imports = g_hash_table_new (g_str_hash, g_str_equal);
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 5f17d9b..e68ab89 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -45,6 +45,10 @@ seed_toggle_ref (gpointer data, GObject * object, gboolean is_last_ref)
   if (!g_object_get_data (object, "js-ref"))
     return;
 
+ SEED_NOTE (MISC,
+		 "seed_toggle_ref %d", is_last_ref ? 1 : 0);
+  
+  
   wrapper = (JSValueRef) data;
 
   if (is_last_ref)
@@ -60,6 +64,9 @@ seed_toggle_ref (gpointer data, GObject * object, gboolean is_last_ref)
 static void
 seed_gobject_destroyed (gpointer object)
 {
+SEED_NOTE (MISC,
+		 "seed_gobject_destroyed ");
+ 
   JSValueUnprotect (eng->context, (JSValueRef) object);
   JSObjectSetPrivate ((JSObjectRef) object, 0);
 }
@@ -110,7 +117,7 @@ seed_wrap_object (JSContextRef ctx, GObject * object)
   g_object_set_qdata_full (object, js_ref_quark, (gpointer) js_ref,
 			   seed_gobject_destroyed);
 
-  JSValueProtect (eng->context, js_ref);
+  //JSValueProtect (eng->context, js_ref);
   g_object_add_toggle_ref (object, seed_toggle_ref, (gpointer) js_ref);
 
   seed_add_signals_to_object (ctx, js_ref, object);