diff options
author | Jonathon Jongsma <jjongsma@redhat.com> | 2014-01-20 10:28:40 -0600 |
---|---|---|
committer | Jonathon Jongsma <jjongsma@redhat.com> | 2014-02-11 11:56:37 -0600 |
commit | bee13a6a59e44a9184f8c548207f0bddf8845d2e (patch) | |
tree | 2d978633653d800d52e1d7fcf153bad11eb56465 /src/virt-viewer-util.c | |
parent | 03a3ba68a57f60ab1d3ddfb9f592912533649ce3 (diff) | |
download | virt-viewer-bee13a6a59e44a9184f8c548207f0bddf8845d2e.tar.gz virt-viewer-bee13a6a59e44a9184f8c548207f0bddf8845d2e.tar.xz virt-viewer-bee13a6a59e44a9184f8c548207f0bddf8845d2e.zip |
Display warning if UI file fails
When trying to load ui files, we try to find the file in several directories.
If a file is not found in one directory, try to load it from the next directory.
However, if a file is found in a directory but we are not able to load it (e.g.
due to unsupported versions of glade used to generate it, etc), we should print
a warning to the terminal to help the developer debug the issue.
This is an unexpected failure (whereas not finding the file in that directory at
all is an 'expected' failure).
Diffstat (limited to 'src/virt-viewer-util.c')
-rw-r--r-- | src/virt-viewer-util.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c index 9deddad..4c60583 100644 --- a/src/virt-viewer-util.c +++ b/src/virt-viewer-util.c @@ -58,7 +58,12 @@ GtkBuilder *virt_viewer_util_load_ui(const char *name) gtk_builder_add_from_file(builder, name, &error); } else { gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL); - gboolean success = (gtk_builder_add_from_file(builder, path, NULL) != 0); + 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); + g_clear_error(&error); + } g_free(path); if (!success) { |