[virt-tools-list] [virt-viewer v2 1/3] util: Use g_error_matches() in _load_ui()

Fabiano Fidêncio fidencio at redhat.com
Thu Feb 25 13:03:38 UTC 2016


Just because it's way cleaner.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 src/virt-viewer-util.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
index 76b61a1..8e60659 100644
--- a/src/virt-viewer-util.c
+++ b/src/virt-viewer-util.c
@@ -59,9 +59,8 @@ GtkBuilder *virt_viewer_util_load_ui(const char *name)
     } else {
         gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL);
         gboolean success = (gtk_builder_add_from_file(builder, path, &error) != 0);
-        if (error) {
-            if (!(error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_NOENT))
-                g_warning("Failed to add ui file '%s': %s", path, error->message);
+        if (!g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
+            g_warning("Failed to add ui file '%s': %s", path, error->message);
             g_clear_error(&error);
         }
         g_free(path);
-- 
2.5.0




More information about the virt-tools-list mailing list