fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0007-testdialog-Error-out-if-templates-are-missing.patch

25dd04
From f333df93941b33daef6d71856ac1b3b9115f9e17 Mon Sep 17 00:00:00 2001
25dd04
From: Matthias Clasen <mclasen@redhat.com>
25dd04
Date: Fri, 17 Jul 2015 15:59:23 -0400
25dd04
Subject: [PATCH 7/7] testdialog: Error out if templates are missing
25dd04
25dd04
Coverity complained about us ignoring the return value
25dd04
here, and it is nicer to get an error message about this.
25dd04
---
25dd04
 tests/testdialog.c | 8 ++++++--
25dd04
 1 file changed, 6 insertions(+), 2 deletions(-)
25dd04
25dd04
diff --git a/tests/testdialog.c b/tests/testdialog.c
25dd04
index 3c95507..df36f0f 100644
25dd04
--- a/tests/testdialog.c
25dd04
+++ b/tests/testdialog.c
25dd04
@@ -215,7 +215,9 @@ my_dialog_class_init (MyDialogClass *class)
25dd04
   gsize size;
25dd04
   GBytes *bytes;
25dd04
 
25dd04
-  g_file_get_contents ("mydialog.ui", &buffer, &size, NULL);
25dd04
+  if (!g_file_get_contents ("mydialog.ui", &buffer, &size, NULL))
25dd04
+    g_error ("Template file mydialog.ui not found");
25dd04
+
25dd04
   bytes = g_bytes_new_static (buffer, size);
25dd04
   gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
25dd04
   g_bytes_unref (bytes);
25dd04
@@ -283,7 +285,9 @@ my_dialog2_class_init (MyDialog2Class *class)
25dd04
   gsize size;
25dd04
   GBytes *bytes;
25dd04
 
25dd04
-  g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL);
25dd04
+  if (!g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL))
25dd04
+    g_error ("Template file mydialog2.ui not found");
25dd04
+
25dd04
   bytes = g_bytes_new_static (buffer, size);
25dd04
   gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
25dd04
   g_bytes_unref (bytes);
25dd04
-- 
25dd04
2.4.5
25dd04