summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2017-04-17 20:21:15 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2017-04-18 19:40:42 -0700
commit1e0bbae1c1934aa1ef8cf38b6e387b56d6dd303a (patch)
tree6753ff774ced571962374d0c2a8a96d86c165269
parent113ba8d73bd381e15ee367263d971c5a62759f16 (diff)
downloadgjs-1e0bbae1c1934aa1ef8cf38b6e387b56d6dd303a.tar.gz
repo: Don't warn about 0 namespace versions
If there are 0 namespace versions, we just need to error out. Don't print the warning about there being more than one version. Also, select the correct version in testCairo.js so we don't get the warning there either. https://bugzilla.gnome.org/show_bug.cgi?id=689654
-rw-r--r--gi/repo.cpp2
-rw-r--r--installed-tests/js/testCairo.js3
2 files changed, 4 insertions, 1 deletions
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 2f2bbcdc..10fd4658 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -101,7 +101,7 @@ resolve_namespace_object(JSContext *context,
repo = g_irepository_get_default();
GList *versions = g_irepository_enumerate_versions(repo, ns_name);
unsigned nversions = g_list_length(versions);
- if (nversions != 1 && !version &&
+ if (nversions > 1 && !version &&
!g_irepository_is_registered(repo, ns_name, NULL)) {
GjsAutoChar warn_text = g_strdup_printf("Requiring %s but it has %u "
"versions available; use "
diff --git a/installed-tests/js/testCairo.js b/installed-tests/js/testCairo.js
index 75066be7..eb8e775a 100644
--- a/installed-tests/js/testCairo.js
+++ b/installed-tests/js/testCairo.js
@@ -1,3 +1,6 @@
+imports.gi.versions.Gdk = '3.0';
+imports.gi.versions.Gtk = '3.0';
+
const Cairo = imports.cairo;
const Gdk = imports.gi.Gdk;
const Gtk = imports.gi.Gtk;