[gtk+/gtk-3-16] testdialog: Error out if templates are missing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-16] testdialog: Error out if templates are missing
- Date: Fri, 17 Jul 2015 20:13:06 +0000 (UTC)
commit ff7d67b33cfa2b070eb94e21f2cf42f5497ff221
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 17 15:59:23 2015 -0400
testdialog: Error out if templates are missing
Coverity complained about us ignoring the return value
here, and it is nicer to get an error message about this.
tests/testdialog.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/tests/testdialog.c b/tests/testdialog.c
index 3c95507..df36f0f 100644
--- a/tests/testdialog.c
+++ b/tests/testdialog.c
@@ -215,7 +215,9 @@ my_dialog_class_init (MyDialogClass *class)
gsize size;
GBytes *bytes;
- g_file_get_contents ("mydialog.ui", &buffer, &size, NULL);
+ if (!g_file_get_contents ("mydialog.ui", &buffer, &size, NULL))
+ g_error ("Template file mydialog.ui not found");
+
bytes = g_bytes_new_static (buffer, size);
gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
g_bytes_unref (bytes);
@@ -283,7 +285,9 @@ my_dialog2_class_init (MyDialog2Class *class)
gsize size;
GBytes *bytes;
- g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL);
+ if (!g_file_get_contents ("mydialog2.ui", &buffer, &size, NULL))
+ g_error ("Template file mydialog2.ui not found");
+
bytes = g_bytes_new_static (buffer, size);
gtk_widget_class_set_template (GTK_WIDGET_CLASS (class), bytes);
g_bytes_unref (bytes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]