[seed] Change seed_make_gclosure to seed_closure_new in the API and add a description parameter. Change cal



commit 72c991b5f191b6d5ae1d75936a87217292012ca6
Author: Robert Carr <racarr svn gnome org>
Date:   Mon May 11 17:55:26 2009 -0400

    Change seed_make_gclosure to seed_closure_new in the API and add a description parameter. Change calls in libseed to use the new function
---
 libseed/seed-closure.c |    7 ++++++-
 libseed/seed-closure.h |   10 +++++-----
 libseed/seed-signals.c |    2 +-
 libseed/seed-types.c   |    2 +-
 libseed/seed.h         |    7 ++++---
 5 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/libseed/seed-closure.c b/libseed/seed-closure.c
index 9f0c6bb..ee7532f 100644
--- a/libseed/seed-closure.c
+++ b/libseed/seed-closure.c
@@ -328,6 +328,8 @@ closure_invalidated (gpointer data, GClosure * c)
     JSValueUnprotect(eng->context, closure->user_data);
   if (!JSValueIsUndefined (eng->context, closure->function))
     JSValueUnprotect (eng->context, closure->function);
+  
+  g_free (closure->description);
 
 }
 
@@ -373,7 +375,7 @@ seed_closure_invoke_with_context (JSContextRef ctx, GClosure *closure, JSValueRe
 }
 
 GClosure *
-seed_make_gclosure (JSContextRef ctx, JSObjectRef function, JSObjectRef user_data)
+seed_closure_new (JSContextRef ctx, JSObjectRef function, JSObjectRef user_data, const gchar *description)
 {
   GClosure *closure;
 
@@ -388,6 +390,9 @@ seed_make_gclosure (JSContextRef ctx, JSObjectRef function, JSObjectRef user_dat
       ((SeedClosure *) closure)->user_data = user_data;
       JSValueProtect(ctx, user_data);
     }
+  
+  if (description)
+    ((SeedClosure *) closure)->description = g_strdup (description);
 
   return closure;
 }
diff --git a/libseed/seed-closure.h b/libseed/seed-closure.h
index 57797bd..165ab4c 100644
--- a/libseed/seed-closure.h
+++ b/libseed/seed-closure.h
@@ -32,6 +32,7 @@ typedef struct _SeedClosure
   JSValueRef user_data;
 
   GType return_type;
+  gchar *description;
 } SeedClosure;
 
 typedef struct _SeedNativeClosure
@@ -48,11 +49,10 @@ extern JSClassRef seed_native_callback_class;
 SeedNativeClosure *seed_make_native_closure (JSContextRef ctx,
 					     GICallableInfo * info,
 					     JSValueRef function);
-GClosure *seed_make_gclosure (JSContextRef ctx,
-			      JSObjectRef function, 
-			      JSObjectRef user_data);
-
-
+GClosure *seed_closure_new (JSContextRef ctx,
+			    JSObjectRef function, 
+			    JSObjectRef user_data,
+			    const gchar *description);
 
 JSObjectRef
 seed_closure_get_callable (GClosure *c);
diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index 4ebd756..5e46155 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -67,7 +67,7 @@ seed_gobject_signal_connect (JSContextRef ctx,
   }
 #endif
 
-  closure = seed_make_gclosure (ctx, func, user_data);
+  closure = seed_closure_new (ctx, func, user_data, "signal handler");
   // This seems wrong...
   ((SeedClosure *) closure)->return_type = query.return_type;
   g_signal_connect_closure (on_obj, signal_name, closure, FALSE);
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index d6467d7..bff09e6 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -600,7 +600,7 @@ seed_gi_make_argument (JSContextRef ctx,
 		    if (JSObjectIsFunction (ctx, (JSObjectRef) value))
 		      {
 			arg->v_pointer =
-			  seed_make_gclosure (ctx, (JSObjectRef) value, 0);
+				seed_closure_new (ctx, (JSObjectRef) value, NULL, NULL);
 		      }
 		  }
 		else
diff --git a/libseed/seed.h b/libseed/seed.h
index 3df71fb..2b20e7a 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -391,9 +391,10 @@ seed_value_from_binary_string (SeedContext ctx,
 			       gint n_bytes,
 			       SeedException *exception);
 
-GClosure *seed_make_gclosure (SeedContext ctx,
-			      SeedObject function, 
-			      SeedObject user_data);
+GClosure *seed_closure_new (SeedContext ctx,
+			    SeedObject function, 
+			    SeedObject user_data,
+			    const gchar *description);
 
 SeedObject
 seed_closure_get_callable (GClosure *c);



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