[seed: 8/15] Add support for versions
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed: 8/15] Add support for versions
- Date: Sun, 12 Apr 2009 02:11:24 -0400 (EDT)
commit 2aeab1a8094ae99177610b46dc22e89b346f8fea
Author: Robert Carr <racarr mireia (none)>
Date: Sat Apr 11 18:40:00 2009 -0400
Add support for versions
---
libseed/seed-importer.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 7620c44..103c94c 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -244,6 +244,21 @@ seed_gi_importer_handle_constant (JSContextRef ctx,
g_base_info_unref ((GIBaseInfo *) constant_type);
}
+static gchar *
+seed_gi_importer_get_version (JSContextRef ctx,
+ gchar *namespace,
+ JSValueRef *exception)
+{
+ JSValueRef version_ref;
+ gchar *version = NULL;
+
+ version_ref = seed_object_get_property (ctx, gi_importer_versions, namespace);
+ if (!JSValueIsUndefined(ctx, version_ref))
+ version = seed_value_to_string (ctx, version_ref, exception);
+
+ return version;
+}
+
static JSObjectRef
seed_gi_importer_do_namespace (JSContextRef ctx,
gchar *namespace,
@@ -253,19 +268,21 @@ seed_gi_importer_do_namespace (JSContextRef ctx,
JSObjectRef namespace_ref;
GError *e = NULL;
guint n, i;
+ gchar *version;
if (namespace_ref = g_hash_table_lookup (gi_imports, namespace))
{
return namespace_ref;
}
- // TODO: Versions.
+ version = seed_gi_importer_get_version (ctx, namespace, exception);
if (!g_irepository_require (NULL, namespace,
- NULL, 0, &e))
+ version, 0, &e))
{
seed_make_exception_from_gerror (ctx, exception, e);
return NULL;
}
+ g_free (version);
n = g_irepository_get_n_infos (NULL, namespace);
namespace_ref = JSObjectMake (ctx, NULL, NULL);
@@ -405,7 +422,7 @@ void seed_initialize_importer(JSContextRef ctx,
gi_importer_class = JSClassCreate (&gi_importer_class_def);
gi_importer = JSObjectMake (ctx, gi_importer_class, NULL);
- gi_importer_versions = JSObjectMake (ctx, gi_importer_class, NULL);
+ gi_importer_versions = JSObjectMake (ctx, NULL, NULL);
gi_imports = g_hash_table_new (g_str_hash, g_str_equal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]