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

Eduardo Lima (Etrunko) etrunko at redhat.com
Tue Jun 14 22:16:29 UTC 2016


On 06/14/2016 06:40 PM, Fabiano Fidêncio wrote:
> GApplication's resource base path is based on the application-id, for
> instamce:

type (instance)

>  - 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

s/For solving/To solve

> 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 at redhat.com>
> ---
>  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();
> 

Other than that, patch is good. Does anyone know when the new SLES is due?

-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list