[virt-tools-list] [PATCH 1/5] app: Set the resource base path
Fabiano Fidêncio
fidencio at redhat.com
Sat Dec 17 16:50:08 UTC 2016
GApplication's resource base path is based on the application-id, for
instamce:
- virt-viewer's resource base path: /org/virt-manager/virt-viewer, as
the virt-viewer's application id is: org.virt-manager.virt-viewer.
- remote-viewer's resource bash path: /org/virt-manager/remote-viewer
as remote-viewer's application id is: org.virt-manager.remote-viewer
It's a issue because our resources have /org/virt-manager/virt-viewer
and Gtk, when trying to automatically load ui files (as done for
gtk/menu.ui, gtk/menus-appmenu.ui, gtk/menus-tradicional.ui and
gtk/help-overlay.ui), searches for these files in the base path.
For solving this issue, we can basically set the resource path using
g_application_set_resource_base_path() method. A check could be done and
this method could be called only when running remote-viewer, but as it's
a simple call, called only when the application starts I decided to go
without the application-id's check.
g_application_set_resource_base_path() was introduced in GLib 2.42 and
that's the reason I'm also bumping GLib dependency's version. Currently
it makes impossible to build virt-viewer on SLES 12 SP1 as it still has
GLib 2.38, so postponing this patch till SLES 12 SP2 release is
desirable.
Signed-off-by: Fabiano Fidêncio <fabiano at fidencio.org>
---
configure.ac | 4 ++--
src/virt-viewer-app.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ce71349..b9b6550 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,8 +13,8 @@ m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes])
# Keep these two definitions in agreement.
-GLIB2_REQUIRED="2.38"
-GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
+GLIB2_REQUIRED="2.42"
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_42"
# Keep these two definitions in agreement.
GTK_REQUIRED="3.12"
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index bf32315..28b4f60 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1792,6 +1792,8 @@ virt_viewer_app_on_application_startup(GApplication *app)
VirtViewerApp *self = VIRT_VIEWER_APP(app);
GError *error = NULL;
+ g_application_set_resource_base_path(app, "/org/virt-manager/virt-viewer");
+
G_APPLICATION_CLASS(virt_viewer_app_parent_class)->startup(app);
self->priv->resource = virt_viewer_get_resource();
--
2.9.3
More information about the virt-tools-list
mailing list