[gjs: 13/13] repo: Don't warn about 0 namespace versions



commit 1e0bbae1c1934aa1ef8cf38b6e387b56d6dd303a
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Apr 17 20:21:15 2017 -0700

    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

 gi/repo.cpp                     |    2 +-
 installed-tests/js/testCairo.js |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 2f2bbcd..10fd465 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 75066be..eb8e775 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;


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