[seed] [libseed] Commit c7daca0f removed set/get_property on gtype class.
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seed] [libseed] Commit c7daca0f removed set/get_property on gtype class.
- Date: Fri, 31 Jul 2009 00:55:04 +0000 (UTC)
commit a5abcd40e738bc9d30cfec5369aca74b06cbab24
Author: Tim Horton <hortont424 gmail com>
Date: Thu Jul 30 20:53:28 2009 -0400
[libseed] Commit c7daca0f removed set/get_property on gtype class.
This fixes breakage in adding properties to JS-side GTypes.
libseed/seed-gtype.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/libseed/seed-gtype.c b/libseed/seed-gtype.c
index 0d02aff..e69b3c4 100644
--- a/libseed/seed-gtype.c
+++ b/libseed/seed-gtype.c
@@ -193,6 +193,44 @@ seed_gsignal_method_invoked (JSContextRef ctx,
return (JSValueRef) seed_value_from_uint (ctx, signal_id, exception);
}
+static void
+seed_gtype_set_property (GObject * object,
+ guint property_id,
+ const GValue * value, GParamSpec * spec)
+{
+ JSContextRef ctx = JSGlobalContextCreateInGroup (context_group, 0);
+ gchar *name = g_strjoin (NULL, "_", spec->name, NULL);
+ JSObjectRef jsobj = (JSObjectRef) seed_value_from_object (ctx, object, 0);
+
+ seed_prepare_global_context (ctx);
+
+ seed_object_set_property (ctx, jsobj, name,
+ seed_value_from_gvalue (ctx, (GValue *) value, 0));
+
+ g_free (name);
+ JSGlobalContextRelease ((JSGlobalContextRef) ctx);
+}
+
+static void
+seed_gtype_get_property (GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * spec)
+{
+ // TODO: Exceptions
+ JSContextRef ctx = JSGlobalContextCreateInGroup (context_group, 0);
+ gchar *name = g_strjoin (NULL, "_", spec->name, NULL);
+ JSObjectRef jsobj = (JSObjectRef) seed_value_from_object (ctx, object, 0);
+ JSValueRef jsval = seed_object_get_property (ctx, jsobj,
+ name);
+
+ seed_prepare_global_context (ctx);
+
+ seed_gvalue_from_seed_value (ctx, jsval, spec->value_type, value, 0);
+
+ g_free (name);
+ JSGlobalContextRelease ((JSGlobalContextRef) ctx);
+}
+
static GIBaseInfo *
seed_get_class_info_for_type (GType type)
{
@@ -396,6 +434,8 @@ seed_gtype_class_init (gpointer g_class, gpointer class_data)
priv = (SeedGClassPrivates *) class_data;
+ ((GObjectClass *) g_class)->get_property = seed_gtype_get_property;
+ ((GObjectClass *) g_class)->set_property = seed_gtype_set_property;
((GObjectClass *) g_class)->constructor = seed_gtype_construct;
ctx = JSGlobalContextCreateInGroup (context_group, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]