[virt-tools-list] [virt-viewer PATCH 01/14] po: provide custom make rules for po file management

2019-02-20 Thread Daniel P . Berrangé
Historically we have relied on intltool to install a standard
po/Makefile.in.in which has very limited scope for customization.
intltool is deprecated in favour of standard gettextize tools,
but these share the same disadvantages.

Writing make rules for po file management is no more difficult
than any other rules libvirt-glib has, so stop using intltool
and don't use gettextize ether.

Signed-off-by: Daniel P. Berrangé 
---
 Makefile.am   |   7 --
 autogen.sh|   1 -
 configure.ac  |   6 +-
 data/Makefile.am  |  12 +-
 data/remote-viewer.appdata.xml.in |  12 +-
 data/remote-viewer.desktop.in |   4 +-
 ...iewer-mime.xml.in => virt-viewer-mime.xml} |   0
 m4/virt-nls.m4|  45 
 mingw-virt-viewer.spec.in |   2 +-
 po/Makefile.am| 105 ++
 po/POTFILES   |  26 +
 po/POTFILES.in|  27 -
 po/README.md  |  38 +++
 po/lt.po  |   2 +-
 virt-viewer.spec.in   |   2 +-
 15 files changed, 234 insertions(+), 55 deletions(-)
 rename data/{virt-viewer-mime.xml.in => virt-viewer-mime.xml} (100%)
 create mode 100644 m4/virt-nls.m4
 create mode 100644 po/Makefile.am
 create mode 100644 po/POTFILES
 delete mode 100644 po/POTFILES.in
 create mode 100644 po/README.md

diff --git a/Makefile.am b/Makefile.am
index d33367a..4cfdd59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,9 +8,6 @@ AM_DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb
 EXTRA_DIST =   \
$(PACKAGE).spec $(PACKAGE).spec.in  \
mingw-$(PACKAGE).spec.in\
-   intltool-extract.in \
-   intltool-merge.in   \
-   intltool-update.in  \
GNUmakefile \
maint.mk\
cfg.mk  \
@@ -24,9 +21,6 @@ EXTRA_DIST =  \
 DISTCLEAN_FILES =  \
$(PACKAGE).spec \
mingw-$(PACKAGE).spec   \
-   intltool-extract\
-   intltool-merge  \
-   intltool-update \
$(NULL)
 
 MAINTAINERCLEANFILES = \
@@ -34,7 +28,6 @@ MAINTAINERCLEANFILES =\
$(srcdir)/INSTALL   \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL)  \
$(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)\
-   $(srcdir)/m4/intltool.m4\
$(NULL)
 
 dist-hook: gen-ChangeLog gen-AUTHORS
diff --git a/autogen.sh b/autogen.sh
index b77ac33..9c8968f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -29,7 +29,6 @@ touch ChangeLog AUTHORS
 
 mkdir -p m4
 autoreconf -vfi
-intltoolize --force
 
 cd $THEDIR
 
diff --git a/configure.ac b/configure.ac
index 5598c61..a03d846 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,8 +96,8 @@ GETTEXT_PACKAGE=virt-viewer
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],"$GETTEXT_PACKAGE", [GETTEXT package 
name])
 
-AM_GLIB_GNU_GETTEXT
-IT_PROG_INTLTOOL([0.35.0])
+VIRT_VIEWER_ARG_NLS
+VIRT_VIEWER_CHECK_NLS
 
 PKG_PROG_PKG_CONFIG
 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
@@ -261,7 +261,7 @@ AC_CONFIG_FILES([
 icons/256x256/Makefile
 man/Makefile
 mingw-virt-viewer.spec
-po/Makefile.in
+po/Makefile
 src/Makefile
 src/virt-viewer.rc
 tests/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 1f6c8bf..0e50f3d 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -68,17 +68,17 @@ else #!WIN32
 desktopdir   = $(datadir)/applications
 DESKTOPFILES = remote-viewer.desktop.in
 desktop_DATA = $(DESKTOPFILES:.desktop.in=.desktop)
-@INTLTOOL_DESKTOP_RULE@
+%.desktop: %.desktop.in
+   $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
 
-MIMEFILES = virt-viewer-mime.xml.in
 mimedir = $(datadir)/mime/packages
 mime_DATA = virt-viewer-mime.xml
-@INTLTOOL_XML_RULE@
 
 appdatadir   = $(datadir)/appdata
 APPDATAFILES = remote-viewer.appdata.xml.in
 appdata_DATA = $(APPDATAFILES:.xml.in=.xml)
-@INTLTOOL_XML_RULE@
+%.appdata.xml: %.appdata.xml.in
+   $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
 
 install-data-hook:
 if ENABLE_UPDATE_MIMEDB
@@ -92,8 +92,8 @@ if ENABLE_UPDATE_MIMEDB
$(UPDATE_MIME_DATABASE) "$(DESTDIR)$(datadir)/mime";
 endif
 
-CLEANFILES += $(mime_DATA) $(desktop_DATA) $(appdata_DATA)
-EXTRA_DIST += $(MIMEFILES) $(DESKTOPFILES) $(APPDATAFILES)
+CLEANFILES += 

[virt-tools-list] [virt-viewer PATCH 00/14] po: improve translation handling

2019-02-20 Thread Daniel P . Berrangé
This applies the same improvements previously done in libvirt:

  https://www.redhat.com/archives/libvir-list/2018-April/msg01004.html
  
https://www.berrange.com/posts/2018/11/29/improved-translation-po-file-handling-by-ditching-gettext-autotools-integration/

The key problems with our current approach are:

 - The pot & po files stored in GIT contain huge set of
   annotations about source file names & line numbers.
   These are out of date as soon as a change is commited
   to git following a translation refresh. This makes
   diffs impossible to meaningfully review, as they are
   98% noise, 2% signal.

 - The po file messages are sorted by source location,
   so when we move code between files, or rename files,
   the po file message order changes for no good reason.
   This makes diffs even more impossible to review.

 - The po files contain entries for all messages even
   if most have no translation, bloating size of po/
   data stored in git

 - Whenever 'make dist' is run, it alters all the pot
   and po files, so developers need to then reset their
   content to match git HEAD manually. This is caused
   by having auto-generated content (source file locations)
   mixed in with the static content (the actual translated
   strings)

After this series, we only minimized po files in git, with
the redundated & outdated source locations info stripped.
This stripped info is re-added automatically during build
to create the real .po files, that we distribute, and/or
upload to translators in Zanata.

As a result the po directory is smaller in size, and
when refreshing from Zanata, we have git commits that
clearly show *only* the altered translations, nothing
else. The importance of this cannot be overstated - by
having these clear diffs when doing this change in libvirt,
I discovered a serious bug in the Zanata client that has
been screwing up translations in every project that uses
Zanata by adding bogus "fuzzy" annotations.

The particularly attractive statistic:

 193 files changed, 11904 insertions(+), 80334 deletions(-)

Daniel P. Berrangé (14):
  po: provide custom make rules for po file management
  po: remove language list from zanata configuration
  po: add rules for integration with zanata
  po: minimize & canonicalize translations stored in git
  po: minimize af am anp ar as ast bal be bg
  po: minimize bn_IN bn bo br brx bs ca cs cy da
  po: minimize de_CH de el en_GB eo es et eu fa fi
  po: minimize fr gl gu he hi hr hu ia
  po: minimize id ilo is it ja ka kk km kn ko
  po: minimize kw_GB kw@kkcor kw kw@uccor ky lt lv mai mk ml
  po: minimize mn mr ms nb nds ne nl nn nso
  po: minimize or pa pl pt_BR pt ro ru si sk sl
  po: minimize sq sr@latin sr sv ta te tg th tr tw
  po: minimize uk ur vi wba yo zh_CN zh_HK zh_TW zu

 Makefile.am   |7 -
 autogen.sh|1 -
 build-aux/minimize-po.pl  |   37 +
 configure.ac  |6 +-
 data/Makefile.am  |   12 +-
 data/remote-viewer.appdata.xml.in |   12 +-
 data/remote-viewer.desktop.in |4 +-
 ...iewer-mime.xml.in => virt-viewer-mime.xml} |0
 m4/virt-nls.m4|   45 +
 mingw-virt-viewer.spec.in |2 +-
 po/Makefile.am|  115 ++
 po/POTFILES   |   26 +
 po/POTFILES.in|   27 -
 po/README.md  |   76 ++
 po/af.mini.po |   19 +
 po/af.po  |  864 -
 po/am.mini.po |   19 +
 po/am.po  |  864 -
 po/anp.mini.po|   19 +
 po/anp.po |  864 -
 po/ar.mini.po |   20 +
 po/ar.po  |  869 -
 po/as.mini.po |  327 +
 po/as.po  |  884 -
 po/ast.mini.po|   19 +
 po/ast.po |  864 -
 po/bal.mini.po|   19 +
 po/bal.po |  863 -
 po/be.mini.po |   20 +
 po/be.po  |  866 -
 po/bg.mini.po |  307 +
 po/bg.po  |  881 -
 po/bn.mini.po |  256 
 po/bn.po  |  885 -
 po/bn_IN.mini.po  |  329 +
 po/bn_IN.po   |  886 -
 po/bo.mini.po

Re: [virt-tools-list] [PATCH virt-viewer v2 1/2] Update usage of GObject private structures

2019-02-20 Thread Christophe Fergeau
Series looks good to me,
Reviewed-by: Christophe Fergeau 

On Wed, Feb 20, 2019 at 11:05:36AM -0300, Eduardo Lima (Etrunko) wrote:
> ping
> 
> On 2/13/19 12:46 PM, Eduardo Lima (Etrunko) wrote:
> > New functions and macros have been added in glib 2.38 to better handle
> > this case.
> > 
> > https://gitlab.gnome.org/GNOME/glib/blob/c8de2b11bbbf5705ee20bf68d0c11e455b441312/NEWS
> > 
> > The old method is being deprecated as of version 2.58.
> > 
> > https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits
> > 
> > Signed-off-by: Eduardo Lima (Etrunko) 
> > ---
> > 
> > v2: Removed iso-list dialog patch which is dealt separately.
> > 
> > ---
> > 
> >  src/ovirt-foreign-menu.c   |  8 ++--
> >  src/remote-viewer.c|  8 ++--
> >  src/virt-viewer-app.c  |  8 ++--
> >  src/virt-viewer-display-spice.c|  8 ++--
> >  src/virt-viewer-display-vnc.c  |  8 ++--
> >  src/virt-viewer-display-vte.c  |  8 ++--
> >  src/virt-viewer-display.c  |  8 ++--
> >  src/virt-viewer-file-transfer-dialog.c |  6 +-
> >  src/virt-viewer-file.c |  7 ++-
> >  src/virt-viewer-notebook.c | 11 +++
> >  src/virt-viewer-session-spice.c|  8 ++--
> >  src/virt-viewer-session-vnc.c  |  8 ++--
> >  src/virt-viewer-session.c  |  9 ++---
> >  src/virt-viewer-timed-revealer.c   | 11 +++
> >  src/virt-viewer-window.c   | 11 +++
> >  src/virt-viewer.c  |  8 ++--
> >  16 files changed, 34 insertions(+), 101 deletions(-)
> > 
> > diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> > index d234a27..c6d360b 100644
> > --- a/src/ovirt-foreign-menu.c
> > +++ b/src/ovirt-foreign-menu.c
> > @@ -59,8 +59,6 @@ static void 
> > ovirt_foreign_menu_fetch_vm_cdrom_async(OvirtForeignMenu *menu, GTas
> >  static void ovirt_foreign_menu_refresh_cdrom_file_async(OvirtForeignMenu 
> > *menu, GTask *task);
> >  static void ovirt_foreign_menu_fetch_iso_list_async(OvirtForeignMenu 
> > *menu, GTask *task);
> >  
> > -G_DEFINE_TYPE (OvirtForeignMenu, ovirt_foreign_menu, G_TYPE_OBJECT)
> > -
> >  
> >  struct _OvirtForeignMenuPrivate {
> >  OvirtProxy *proxy;
> > @@ -87,7 +85,7 @@ struct _OvirtForeignMenuPrivate {
> >  };
> >  
> >  
> > -#define OVIRT_FOREIGN_MENU_GET_PRIVATE(o) 
> > (G_TYPE_INSTANCE_GET_PRIVATE((o), OVIRT_TYPE_FOREIGN_MENU, 
> > OvirtForeignMenuPrivate))
> > +G_DEFINE_TYPE_WITH_PRIVATE (OvirtForeignMenu, ovirt_foreign_menu, 
> > G_TYPE_OBJECT)
> >  
> >  
> >  enum {
> > @@ -229,8 +227,6 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass 
> > *klass)
> >  oclass->set_property = ovirt_foreign_menu_set_property;
> >  oclass->dispose = ovirt_foreign_menu_dispose;
> >  
> > -g_type_class_add_private(klass, sizeof(OvirtForeignMenuPrivate));
> > -
> >  g_object_class_install_property(oclass,
> >  PROP_PROXY,
> >  g_param_spec_object("proxy",
> > @@ -286,7 +282,7 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass 
> > *klass)
> >  static void
> >  ovirt_foreign_menu_init(OvirtForeignMenu *self)
> >  {
> > -self->priv = OVIRT_FOREIGN_MENU_GET_PRIVATE(self);
> > +self->priv = ovirt_foreign_menu_get_instance_private(self);
> >  }
> >  
> >  
> > diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> > index 989466b..91eb39e 100644
> > --- a/src/remote-viewer.c
> > +++ b/src/remote-viewer.c
> > @@ -54,9 +54,7 @@ struct _RemoteViewerPrivate {
> >  gboolean open_recent_dialog;
> >  };
> >  
> > -G_DEFINE_TYPE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP)
> > -#define GET_PRIVATE(o) 
> >\
> > -(G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, 
> > RemoteViewerPrivate))
> > +G_DEFINE_TYPE_WITH_PRIVATE (RemoteViewer, remote_viewer, 
> > VIRT_VIEWER_TYPE_APP)
> >  
> >  enum RemoteViewerProperties {
> >  PROP_0,
> > @@ -196,8 +194,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
> >  VirtViewerAppClass *app_class = VIRT_VIEWER_APP_CLASS (klass);
> >  GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
> >  
> > -g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
> > -
> >  object_class->get_property = remote_viewer_get_property;
> >  object_class->dispose = remote_viewer_dispose;
> >  
> > @@ -221,7 +217,7 @@ remote_viewer_class_init (RemoteViewerClass *klass)
> >  static void
> >  remote_viewer_init(RemoteViewer *self)
> >  {
> > -self->priv = GET_PRIVATE(self);
> > +self->priv = remote_viewer_get_instance_private(self);
> >  }
> >  
> >  RemoteViewer *
> > diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> > index fd48014..861f8f3 100644
> > --- a/src/virt-viewer-app.c
> > +++ b/src/virt-viewer-app.c
> > @@ -160,9 +160,7 @@ struct _VirtViewerAppPrivate {

Re: [virt-tools-list] [PATCH virt-viewer v2 1/2] Update usage of GObject private structures

2019-02-20 Thread Eduardo Lima (Etrunko)
ping

On 2/13/19 12:46 PM, Eduardo Lima (Etrunko) wrote:
> New functions and macros have been added in glib 2.38 to better handle
> this case.
> 
> https://gitlab.gnome.org/GNOME/glib/blob/c8de2b11bbbf5705ee20bf68d0c11e455b441312/NEWS
> 
> The old method is being deprecated as of version 2.58.
> 
> https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits
> 
> Signed-off-by: Eduardo Lima (Etrunko) 
> ---
> 
> v2: Removed iso-list dialog patch which is dealt separately.
> 
> ---
> 
>  src/ovirt-foreign-menu.c   |  8 ++--
>  src/remote-viewer.c|  8 ++--
>  src/virt-viewer-app.c  |  8 ++--
>  src/virt-viewer-display-spice.c|  8 ++--
>  src/virt-viewer-display-vnc.c  |  8 ++--
>  src/virt-viewer-display-vte.c  |  8 ++--
>  src/virt-viewer-display.c  |  8 ++--
>  src/virt-viewer-file-transfer-dialog.c |  6 +-
>  src/virt-viewer-file.c |  7 ++-
>  src/virt-viewer-notebook.c | 11 +++
>  src/virt-viewer-session-spice.c|  8 ++--
>  src/virt-viewer-session-vnc.c  |  8 ++--
>  src/virt-viewer-session.c  |  9 ++---
>  src/virt-viewer-timed-revealer.c   | 11 +++
>  src/virt-viewer-window.c   | 11 +++
>  src/virt-viewer.c  |  8 ++--
>  16 files changed, 34 insertions(+), 101 deletions(-)
> 
> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> index d234a27..c6d360b 100644
> --- a/src/ovirt-foreign-menu.c
> +++ b/src/ovirt-foreign-menu.c
> @@ -59,8 +59,6 @@ static void 
> ovirt_foreign_menu_fetch_vm_cdrom_async(OvirtForeignMenu *menu, GTas
>  static void ovirt_foreign_menu_refresh_cdrom_file_async(OvirtForeignMenu 
> *menu, GTask *task);
>  static void ovirt_foreign_menu_fetch_iso_list_async(OvirtForeignMenu *menu, 
> GTask *task);
>  
> -G_DEFINE_TYPE (OvirtForeignMenu, ovirt_foreign_menu, G_TYPE_OBJECT)
> -
>  
>  struct _OvirtForeignMenuPrivate {
>  OvirtProxy *proxy;
> @@ -87,7 +85,7 @@ struct _OvirtForeignMenuPrivate {
>  };
>  
>  
> -#define OVIRT_FOREIGN_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), 
> OVIRT_TYPE_FOREIGN_MENU, OvirtForeignMenuPrivate))
> +G_DEFINE_TYPE_WITH_PRIVATE (OvirtForeignMenu, ovirt_foreign_menu, 
> G_TYPE_OBJECT)
>  
>  
>  enum {
> @@ -229,8 +227,6 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass 
> *klass)
>  oclass->set_property = ovirt_foreign_menu_set_property;
>  oclass->dispose = ovirt_foreign_menu_dispose;
>  
> -g_type_class_add_private(klass, sizeof(OvirtForeignMenuPrivate));
> -
>  g_object_class_install_property(oclass,
>  PROP_PROXY,
>  g_param_spec_object("proxy",
> @@ -286,7 +282,7 @@ ovirt_foreign_menu_class_init(OvirtForeignMenuClass 
> *klass)
>  static void
>  ovirt_foreign_menu_init(OvirtForeignMenu *self)
>  {
> -self->priv = OVIRT_FOREIGN_MENU_GET_PRIVATE(self);
> +self->priv = ovirt_foreign_menu_get_instance_private(self);
>  }
>  
>  
> diff --git a/src/remote-viewer.c b/src/remote-viewer.c
> index 989466b..91eb39e 100644
> --- a/src/remote-viewer.c
> +++ b/src/remote-viewer.c
> @@ -54,9 +54,7 @@ struct _RemoteViewerPrivate {
>  gboolean open_recent_dialog;
>  };
>  
> -G_DEFINE_TYPE (RemoteViewer, remote_viewer, VIRT_VIEWER_TYPE_APP)
> -#define GET_PRIVATE(o)   
>  \
> -(G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, 
> RemoteViewerPrivate))
> +G_DEFINE_TYPE_WITH_PRIVATE (RemoteViewer, remote_viewer, 
> VIRT_VIEWER_TYPE_APP)
>  
>  enum RemoteViewerProperties {
>  PROP_0,
> @@ -196,8 +194,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>  VirtViewerAppClass *app_class = VIRT_VIEWER_APP_CLASS (klass);
>  GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
>  
> -g_type_class_add_private (klass, sizeof (RemoteViewerPrivate));
> -
>  object_class->get_property = remote_viewer_get_property;
>  object_class->dispose = remote_viewer_dispose;
>  
> @@ -221,7 +217,7 @@ remote_viewer_class_init (RemoteViewerClass *klass)
>  static void
>  remote_viewer_init(RemoteViewer *self)
>  {
> -self->priv = GET_PRIVATE(self);
> +self->priv = remote_viewer_get_instance_private(self);
>  }
>  
>  RemoteViewer *
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index fd48014..861f8f3 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -160,9 +160,7 @@ struct _VirtViewerAppPrivate {
>  };
>  
>  
> -G_DEFINE_ABSTRACT_TYPE(VirtViewerApp, virt_viewer_app, GTK_TYPE_APPLICATION)
> -#define GET_PRIVATE(o)   
>  \
> -(G_TYPE_INSTANCE_GET_PRIVATE ((o), VIRT_VIEWER_TYPE_APP, 
> VirtViewerAppPrivate))
> +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(VirtViewerApp, virt_viewer_app, 
> GTK_TYPE_APPLICATION)
>  
>  enum {
>