From 55739055fd3c4461c3d8ffd0793714a0a6810d0b Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Fri, 19 Sep 2014 21:15:50 -0400 Subject: [PATCH] ui: Set all files to minimum requirement of gtk 3.8 That way gives us better feedback from glade --- tests/misc.py | 36 ++++++++++++++++++++++-------------- ui/about.ui | 2 +- ui/addhardware.ui | 2 +- ui/asyncjob.ui | 2 +- ui/choosecd.ui | 2 +- ui/clone.ui | 2 +- ui/connect.ui | 2 +- ui/create.ui | 2 +- ui/createinterface.ui | 2 +- ui/createnet.ui | 2 +- ui/createpool.ui | 2 +- ui/createvol.ui | 2 +- ui/delete.ui | 2 +- ui/details.ui | 2 +- ui/fsdetails.ui | 2 +- ui/host.ui | 2 +- ui/manager.ui | 2 +- ui/migrate.ui | 2 +- ui/preferences.ui | 2 +- ui/snapshots.ui | 2 +- ui/storagebrowse.ui | 2 +- 21 files changed, 42 insertions(+), 34 deletions(-) diff --git a/tests/misc.py b/tests/misc.py index ca91595e..51628f4f 100644 --- a/tests/misc.py +++ b/tests/misc.py @@ -15,12 +15,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301 USA. +import fileinput import fnmatch +import glob import imp import importlib import os import sys import unittest +import xml.etree.ElementTree as ET _badmodules = ["gi.repository.Gtk", "gi.repository.Gdk"] @@ -91,24 +94,29 @@ class TestMisc(unittest.TestCase): def test_ui_minimum_version(self): - import glob - import xml.etree.ElementTree as ET failures = [] for filename in glob.glob("ui/*.ui"): - root = ET.parse(filename).getroot() + required_version = None + for line in fileinput.input(filename): + # This is much faster than XML parsing the whole file + if not line.strip().startswith(' 3 or - int(version.split(".")[1]) > 8): - failures.append((filename, req.attrib["version"])) + if required_version is None: + raise AssertionError("ui file=%s doesn't have a " + "tag for gtk+, it should say 3.8") + + if (int(required_version.split(".")[0]) != 3 or + int(required_version.split(".")[1]) != 8): + failures.append((filename, required_version)) if failures: - raise AssertionError("The following files require a gtk version " - "higher than our target of gtk-3.8:\n" + + raise AssertionError("The following files should require gtk " + "version of gtk-3.8, which is what we target:\n" + "\n".join([("%s version=%s" % tup) for tup in failures])) diff --git a/ui/about.ui b/ui/about.ui index d7a9ccce..d665b997 100644 --- a/ui/about.ui +++ b/ui/about.ui @@ -1,7 +1,7 @@ - + False True diff --git a/ui/addhardware.ui b/ui/addhardware.ui index 999afc33..7e9304dd 100644 --- a/ui/addhardware.ui +++ b/ui/addhardware.ui @@ -1,7 +1,7 @@ - + 67000 1 diff --git a/ui/asyncjob.ui b/ui/asyncjob.ui index e6704d2a..dbbdf8aa 100644 --- a/ui/asyncjob.ui +++ b/ui/asyncjob.ui @@ -1,7 +1,7 @@ - + False 12 diff --git a/ui/choosecd.ui b/ui/choosecd.ui index 4ac4c647..88066387 100644 --- a/ui/choosecd.ui +++ b/ui/choosecd.ui @@ -1,7 +1,7 @@ - + True True diff --git a/ui/clone.ui b/ui/clone.ui index c256f20b..59ca4324 100644 --- a/ui/clone.ui +++ b/ui/clone.ui @@ -1,7 +1,7 @@ - + True False diff --git a/ui/connect.ui b/ui/connect.ui index 06844d3f..34fea784 100644 --- a/ui/connect.ui +++ b/ui/connect.ui @@ -1,7 +1,7 @@ - + True False diff --git a/ui/create.ui b/ui/create.ui index 7a4f500d..e083827e 100644 --- a/ui/create.ui +++ b/ui/create.ui @@ -1,7 +1,7 @@ - + 128 1 diff --git a/ui/createinterface.ui b/ui/createinterface.ui index 084eb705..f249b6d4 100644 --- a/ui/createinterface.ui +++ b/ui/createinterface.ui @@ -1,7 +1,7 @@ - + 4095 1 diff --git a/ui/createnet.ui b/ui/createnet.ui index 1e4f547d..77bd6401 100644 --- a/ui/createnet.ui +++ b/ui/createnet.ui @@ -1,7 +1,7 @@ - + True False diff --git a/ui/createpool.ui b/ui/createpool.ui index e82bc1da..57d11fda 100644 --- a/ui/createpool.ui +++ b/ui/createpool.ui @@ -1,7 +1,7 @@ - + 350 False diff --git a/ui/createvol.ui b/ui/createvol.ui index 3d936c95..dc90dfb5 100644 --- a/ui/createvol.ui +++ b/ui/createvol.ui @@ -1,7 +1,7 @@ - + 100000 1 diff --git a/ui/delete.ui b/ui/delete.ui index d2119b92..1a61fa14 100644 --- a/ui/delete.ui +++ b/ui/delete.ui @@ -1,7 +1,7 @@ - + 450 350 diff --git a/ui/details.ui b/ui/details.ui index 4080a147..1b5f9294 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -1,7 +1,7 @@ - + 1 diff --git a/ui/fsdetails.ui b/ui/fsdetails.ui index 8e8e62c3..ad22c046 100644 --- a/ui/fsdetails.ui +++ b/ui/fsdetails.ui @@ -1,7 +1,7 @@ - + 18446744073709 100 diff --git a/ui/host.ui b/ui/host.ui index 018bfffe..cc5201b2 100644 --- a/ui/host.ui +++ b/ui/host.ui @@ -1,7 +1,7 @@ - + True diff --git a/ui/manager.ui b/ui/manager.ui index c70ee5d3..2f3d4656 100644 --- a/ui/manager.ui +++ b/ui/manager.ui @@ -1,7 +1,7 @@ - + True diff --git a/ui/migrate.ui b/ui/migrate.ui index 0fa517c0..fa0a6f09 100644 --- a/ui/migrate.ui +++ b/ui/migrate.ui @@ -1,7 +1,7 @@ - + 70000 1 diff --git a/ui/preferences.ui b/ui/preferences.ui index 8533e2b0..cbabaff9 100644 --- a/ui/preferences.ui +++ b/ui/preferences.ui @@ -1,7 +1,7 @@ - + 1 60 diff --git a/ui/snapshots.ui b/ui/snapshots.ui index e7db0ec6..cc177280 100644 --- a/ui/snapshots.ui +++ b/ui/snapshots.ui @@ -1,7 +1,7 @@ - + True False diff --git a/ui/storagebrowse.ui b/ui/storagebrowse.ui index b1417f44..7dca9112 100644 --- a/ui/storagebrowse.ui +++ b/ui/storagebrowse.ui @@ -1,7 +1,7 @@ - + True False