Pino Toscano
2017-Mar-30 11:37 UTC
[Libguestfs] [PATCH 1/2] p2v: move the license text to gui.c
It is used only for the about dialog, and this way it will be easier to disable. --- p2v/Makefile.am | 1 - p2v/about-license.c | 38 -------------------------------------- p2v/gui.c | 16 ++++++++++++++++ p2v/p2v.h | 3 --- 4 files changed, 16 insertions(+), 42 deletions(-) delete mode 100644 p2v/about-license.c diff --git a/p2v/Makefile.am b/p2v/Makefile.am index 3526d7a..c78f4ab 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -78,7 +78,6 @@ noinst_PROGRAMS = virt-p2v virt_p2v_SOURCES = \ about-authors.c \ - about-license.c \ config.c \ conversion.c \ cpuid.c \ diff --git a/p2v/about-license.c b/p2v/about-license.c deleted file mode 100644 index 70d7b77..0000000 --- a/p2v/about-license.c +++ /dev/null @@ -1,38 +0,0 @@ -/* virt-p2v - * Copyright (C) 2009-2017 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <config.h> - -#include "p2v.h" - -/* The license of virt-p2v, for the About dialog. */ - -const char *gplv2plus - "This program is free software; you can redistribute it and/or modify\n" - "it under the terms of the GNU General Public License as published by\n" - "the Free Software Foundation; either version 2 of the License, or\n" - "(at your option) any later version.\n" - "\n" - "This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" - "GNU General Public License for more details.\n" - "\n" - "You should have received a copy of the GNU General Public License\n" - "along with this program; if not, write to the Free Software\n" - "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"; diff --git a/p2v/gui.c b/p2v/gui.c index 82c2402..563e1a7 100644 --- a/p2v/gui.c +++ b/p2v/gui.c @@ -134,6 +134,22 @@ static GtkWidget *run_dlg, /* Colour tags used in the v2v_output GtkTextBuffer. */ static GtkTextTag *v2v_output_tags[16]; +/* The license of virt-p2v, for the About dialog. */ +static const char gplv2plus[] + "This program is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation; either version 2 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program; if not, write to the Free Software\n" + "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"; + /** * The entry point from the main program. * diff --git a/p2v/p2v.h b/p2v/p2v.h index bd4b484..4a47e9f 100644 --- a/p2v/p2v.h +++ b/p2v/p2v.h @@ -194,7 +194,4 @@ extern const char *qa[]; extern const char *documenters[]; extern const char *others[]; -/* about-license.c */ -extern const char *gplv2plus; - #endif /* P2V_H */ -- 2.9.3
Pino Toscano
2017-Mar-30 11:37 UTC
[Libguestfs] [PATCH 2/2] p2v: use standard license type in about dialog
GtkAboutDialog in GTK+ 3 can be configured with few standard licenses, including GPL2+. Thus, just set that property, so the about dialog will show its own license text, and there is no need for our custom one. --- p2v/gui.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/p2v/gui.c b/p2v/gui.c index 563e1a7..203ca2c 100644 --- a/p2v/gui.c +++ b/p2v/gui.c @@ -134,6 +134,7 @@ static GtkWidget *run_dlg, /* Colour tags used in the v2v_output GtkTextBuffer. */ static GtkTextTag *v2v_output_tags[16]; +#if !GTK_CHECK_VERSION(3,0,0) /* gtk < 3 */ /* The license of virt-p2v, for the About dialog. */ static const char gplv2plus[] "This program is free software; you can redistribute it and/or modify\n" @@ -149,6 +150,7 @@ static const char gplv2plus[] "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"; +#endif /** * The entry point from the main program. @@ -639,7 +641,11 @@ about_button_clicked (GtkWidget *w, gpointer data) "copyright", "\u00A9 2009-2017 Red Hat Inc.", "comments", _("Virtualize a physical machine to run on KVM"), +#if GTK_CHECK_VERSION(3,0,0) /* gtk >= 3 */ + "license-type", GTK_LICENSE_GPL_2_0, +#else "license", gplv2plus, +#endif "website", "http://libguestfs.org/", "authors", authors, NULL); -- 2.9.3
Richard W.M. Jones
2017-Mar-30 13:51 UTC
Re: [Libguestfs] [PATCH 2/2] p2v: use standard license type in about dialog
On Thu, Mar 30, 2017 at 01:37:51PM +0200, Pino Toscano wrote:> GtkAboutDialog in GTK+ 3 can be configured with few standard licenses, > including GPL2+. Thus, just set that property, so the about dialog will > show its own license text, and there is no need for our custom one. > --- > p2v/gui.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/p2v/gui.c b/p2v/gui.c > index 563e1a7..203ca2c 100644 > --- a/p2v/gui.c > +++ b/p2v/gui.c > @@ -134,6 +134,7 @@ static GtkWidget *run_dlg, > /* Colour tags used in the v2v_output GtkTextBuffer. */ > static GtkTextTag *v2v_output_tags[16]; > > +#if !GTK_CHECK_VERSION(3,0,0) /* gtk < 3 */ > /* The license of virt-p2v, for the About dialog. */ > static const char gplv2plus[] > "This program is free software; you can redistribute it and/or modify\n" > @@ -149,6 +150,7 @@ static const char gplv2plus[] > "You should have received a copy of the GNU General Public License\n" > "along with this program; if not, write to the Free Software\n" > "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"; > +#endif > > /** > * The entry point from the main program. > @@ -639,7 +641,11 @@ about_button_clicked (GtkWidget *w, gpointer data) > "copyright", "\u00A9 2009-2017 Red Hat Inc.", > "comments", > _("Virtualize a physical machine to run on KVM"), > +#if GTK_CHECK_VERSION(3,0,0) /* gtk >= 3 */ > + "license-type", GTK_LICENSE_GPL_2_0, > +#else > "license", gplv2plus, > +#endif > "website", "http://libguestfs.org/", > "authors", authors, > NULL);ACK series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org