virt_viewer_util_load_ui() looks first in the current directory, and then looks in the system data dirs for a ui file to load, but if you install virt-viewer in a different prefix, it will load the system UI file rather than the one from the install prefix. Try to load the ui file from pkgdatadir first. --- src/Makefile.am | 2 ++ src/virt-viewer-util.c | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 12f71f3..b3a9637 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -135,6 +135,8 @@ if OS_WIN32 remote_viewer_LDFLAGS += -Wl,--subsystem,windows endif +AM_CPPFLAGS = -DPACKAGE_DATADIR=\""$(pkgdatadir)"\" + VIRT_VIEWER_RES = virt-viewer.rc virt-viewer.manifest ICONDIR = $(top_builddir)/icons MANIFESTDIR = $(srcdir) diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c index e4db928..9deddad 100644 --- a/src/virt-viewer-util.c +++ b/src/virt-viewer-util.c @@ -57,20 +57,26 @@ GtkBuilder *virt_viewer_util_load_ui(const char *name) if (stat(name, &sb) >= 0) { gtk_builder_add_from_file(builder, name, &error); } else { - const gchar * const * dirs = g_get_system_data_dirs(); - g_return_val_if_fail(dirs != NULL, NULL); - - while (dirs[0] != NULL) { - gchar *path = g_build_filename(dirs[0], PACKAGE, "ui", name, NULL); - if (gtk_builder_add_from_file(builder, path, NULL) != 0) { + gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL); + gboolean success = (gtk_builder_add_from_file(builder, path, NULL) != 0); + g_free(path); + + if (!success) { + const gchar * const * dirs = g_get_system_data_dirs(); + g_return_val_if_fail(dirs != NULL, NULL); + + while (dirs[0] != NULL) { + path = g_build_filename(dirs[0], PACKAGE, "ui", name, NULL); + if (gtk_builder_add_from_file(builder, path, NULL) != 0) { + g_free(path); + break; + } g_free(path); - break; + dirs++; } - g_free(path); - dirs++; + if (dirs[0] == NULL) + goto failed; } - if (dirs[0] == NULL) - goto failed; } if (error) { -- 1.8.4.2 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list