mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 23:00:54 +00:00
Load ui files first from installed location
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.
This commit is contained in:
parent
9e2d9ba857
commit
9f6878c35a
@ -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)
|
||||
|
||||
@ -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);
|
||||
gchar *path = g_build_filename(PACKAGE_DATADIR, "ui", name, NULL);
|
||||
gboolean success = (gtk_builder_add_from_file(builder, path, NULL) != 0);
|
||||
g_free(path);
|
||||
|
||||
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) {
|
||||
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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user