[seed] Expose seed_value_to_gvalue



commit a655d0136520b156088327284c5a0377476008e7
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Mar 24 10:19:59 2011 -0700

    Expose seed_value_to_gvalue

 libseed/seed-engine.c  |    6 +++---
 libseed/seed-gtype.c   |    2 +-
 libseed/seed-signals.c |   10 +++++-----
 libseed/seed-structs.c |    2 +-
 libseed/seed-types.c   |   24 ++++++++++++------------
 libseed/seed-types.h   |    7 ++++---
 libseed/seed.h         |    4 ++++
 7 files changed, 30 insertions(+), 25 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 68bfefb..1053fb8 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -243,8 +243,8 @@ seed_gobject_constructor_invoked (JSContextRef ctx,
       else
 	type = param_spec->value_type;
 
-      seed_gvalue_from_seed_value (ctx, jsprop_value,
-				   type, &params[ri].value, exception);
+      seed_value_to_gvalue (ctx, jsprop_value,
+			    type, &params[ri].value, exception);
 
       if (*exception)
 	{
@@ -1209,7 +1209,7 @@ seed_gobject_set_property (JSContextRef context,
   else
     type = spec->value_type;
 
-  seed_gvalue_from_seed_value (context, value, type, &gval, exception);
+  seed_value_to_gvalue (context, value, type, &gval, exception);
   if (*exception)
     {
       return FALSE;
diff --git a/libseed/seed-gtype.c b/libseed/seed-gtype.c
index 73465b6..04be107 100644
--- a/libseed/seed-gtype.c
+++ b/libseed/seed-gtype.c
@@ -231,7 +231,7 @@ seed_gtype_builtin_get_property (GObject * object,
 
   seed_prepare_global_context (ctx);
 
-  seed_gvalue_from_seed_value (ctx, jsval, spec->value_type, value, 0);
+  seed_value_to_gvalue (ctx, jsval, spec->value_type, value, 0);
 
   g_free (name);
   JSGlobalContextRelease ((JSGlobalContextRef) ctx);
diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index fe2be47..2d58fcf 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -194,8 +194,8 @@ seed_signal_marshal_func (GClosure * closure,
   if (ret && !JSValueIsNull (ctx, ret)
       && (seed_closure->return_type != G_TYPE_NONE))
     {
-      seed_gvalue_from_seed_value (ctx, ret, seed_closure->return_type,
-				   return_value, &exception);
+      seed_value_to_gvalue (ctx, ret, seed_closure->return_type,
+			    return_value, &exception);
     }
 
   if (exception)
@@ -249,9 +249,9 @@ seed_gobject_signal_emit (JSContextRef ctx,
   g_value_init (&params[0], G_TYPE_OBJECT);
   g_value_set_object (&params[0], privates->object);
   for (i = 0; i < argumentCount; i++)
-    seed_gvalue_from_seed_value (ctx, arguments[i],
-				 query.param_types[i],
-				 &params[i + 1], exception);
+    seed_value_to_gvalue (ctx, arguments[i],
+			  query.param_types[i],
+			  &params[i + 1], exception);
 
 
   if (query.return_type != G_TYPE_NONE)
diff --git a/libseed/seed-structs.c b/libseed/seed-structs.c
index be79ca5..b697f5b 100644
--- a/libseed/seed-structs.c
+++ b/libseed/seed-structs.c
@@ -721,7 +721,7 @@ seed_construct_struct_type_with_parameters (JSContextRef ctx,
               return (JSObjectRef) JSValueMakeNull (ctx);
             }
           SEED_NOTE (CONSTRUCTION, "Created a GValue  struct");
-          seed_gvalue_from_seed_value (ctx,   parameters , 0,  gval, exception);
+          seed_value_to_gvalue (ctx,   parameters , 0,  gval, exception);
           ret = seed_make_struct (ctx, (gpointer)gval, info);
           return ret;
         }
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 0ca0ac3..11e259c 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -451,9 +451,9 @@ seed_gi_make_array (JSContextRef ctx,
 		    elem = JSObjectGetPropertyAtIndex (ctx,
 						       (JSObjectRef) array,
 						       i, exception);
-		    seed_gvalue_from_seed_value (ctx, elem,
-						 (GType) 0,
-						 &gvalresult[i], exception);
+		    seed_value_to_gvalue (ctx, elem,
+					  (GType) 0,
+					  &gvalresult[i], exception);
 		  }
 		*array_p = gvalresult;
 
@@ -657,10 +657,10 @@ seed_gi_make_argument (JSContextRef ctx,
 		else if (type == G_TYPE_VALUE)
 		  {
 		    GValue *gval = g_slice_alloc0 (sizeof (GValue));
-		    seed_gvalue_from_seed_value (ctx,
-						 value,
-						 (GType) NULL,
-						 gval, exception);
+		    seed_value_to_gvalue (ctx,
+					  value,
+					  (GType) NULL,
+					  gval, exception);
 		    arg->v_pointer = gval;
 
 		    g_base_info_unref (interface);
@@ -1069,9 +1069,9 @@ seed_value_from_gvalue (JSContextRef ctx,
 }
 
 gboolean
-seed_gvalue_from_seed_value (JSContextRef ctx,
-			     JSValueRef val,
-			     GType type, GValue * ret, JSValueRef * exception)
+seed_value_to_gvalue (JSContextRef ctx,
+		      JSValueRef val,
+		      GType type, GValue * ret, JSValueRef * exception)
 {
   if (G_IS_VALUE (ret))
     g_value_unset (ret);
@@ -1282,8 +1282,8 @@ seed_gvalue_from_seed_value (JSContextRef ctx,
 					      exception);
 		if (type)	// Prevents recursion.
 		  {
-		    return seed_gvalue_from_seed_value (ctx, val,
-							type, ret, exception);
+		    return seed_value_to_gvalue (ctx, val,
+						 type, ret, exception);
 		  }
 		// TODO: FIXME: Handle better?
 		else
diff --git a/libseed/seed-types.h b/libseed/seed-types.h
index eda08a4..44ca648 100644
--- a/libseed/seed-types.h
+++ b/libseed/seed-types.h
@@ -27,14 +27,15 @@ extern GQuark js_ref_quark;
 JSValueRef seed_value_from_gvalue (JSContextRef ctx,
 				   GValue * gval, JSValueRef * exception);
 
+gboolean seed_value_to_gvalue (JSContextRef ctx,
+			       JSValueRef val, GType type,
+			       GValue * gval, JSValueRef * exception);
+
 JSValueRef seed_object_get_property (JSContextRef ctx,
 				     JSObjectRef val, const gchar * name);
 
 gboolean seed_object_set_property (JSContextRef ctx, JSObjectRef object,
 				   const gchar * name, JSValueRef value);
-gboolean seed_gvalue_from_seed_value (JSContextRef ctx,
-				      JSValueRef val, GType type,
-				      GValue * gval, JSValueRef * exception);
 
 gboolean seed_gi_make_argument (JSContextRef ctx,
 				JSValueRef value,
diff --git a/libseed/seed.h b/libseed/seed.h
index 2b3dfa5..c1bb7d2 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -159,6 +159,10 @@ gboolean seed_value_is_number (SeedContext ctx, SeedValue value);
 void seed_value_unprotect (SeedContext ctx, SeedValue value);
 void seed_value_protect (SeedContext ctx, SeedValue value);
 
+gboolean seed_value_to_gvalue (SeedContext ctx,
+			       SeedValue val, GType type,
+			       GValue * gval, SeedException * exception);
+
 SeedValue seed_value_from_gvalue (SeedContext ctx,
 				  GValue * gval, SeedException * exception);
 



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