[virt-viewer 3/5] app: Set the resource base path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <fidencio@xxxxxxxxxx>
---
 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 9426350..f7e537d 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.10"
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 4c3a373..d9f46ab 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1784,6 +1784,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.7.4

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux