mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 06:23:42 +00:00
build: generate enums type boilerplate
This commit is contained in:
parent
c6c335799d
commit
7cf00ea8d2
@ -72,6 +72,9 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],"$GETTEXT_PACKAGE", [GETTEXT package name])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
IT_PROG_INTLTOOL([0.35.0])
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
|
||||
AC_SUBST(GLIB_MKENUMS)
|
||||
|
||||
PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gthread-2.0 gmodule-export-2.0)
|
||||
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
|
||||
|
||||
@ -10,11 +10,28 @@ builderxml_DATA = \
|
||||
virt-viewer-auth.xml \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = $(builderxml_DATA) \
|
||||
gbinding.c \
|
||||
gbinding.h
|
||||
EXTRA_DIST = \
|
||||
$(builderxml_DATA) \
|
||||
virt-viewer-enums.c.etemplate \
|
||||
virt-viewer-enums.h.etemplate \
|
||||
gbinding.c \
|
||||
gbinding.h \
|
||||
$(NULL)
|
||||
|
||||
ENUMS_FILES = \
|
||||
virt-viewer-display.h \
|
||||
$(NULL)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
virt-viewer-enums.h \
|
||||
virt-viewer-enums.c \
|
||||
$(NULL)
|
||||
|
||||
$(BUILT_SOURCES): %: %.etemplate $(ENUMS_FILES)
|
||||
$(AM_V_GEN)$(GLIB_MKENUMS) --template $^ | sed -e 's/VIRT_TYPE_VIEWER/VIRT_VIEWER_TYPE/' > $@
|
||||
|
||||
COMMON_SOURCES = \
|
||||
$(BUILT_SOURCES) \
|
||||
virt-gtk-compat.h \
|
||||
virt-viewer-util.h virt-viewer-util.c \
|
||||
virt-viewer-auth.h virt-viewer-auth.c \
|
||||
|
||||
60
src/virt-viewer-enums.c.etemplate
Normal file
60
src/virt-viewer-enums.c.etemplate
Normal file
@ -0,0 +1,60 @@
|
||||
/*** BEGIN file-header ***/
|
||||
/*
|
||||
* Virt Viewer: A virtual machine console viewer
|
||||
*
|
||||
* Copyright (C) 2007-2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
*/
|
||||
|
||||
#include "virt-viewer-enums.h"
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
#include "@filename@"
|
||||
/*** END file-production ***/
|
||||
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
static const G@Type@Value values[] = {
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN value-production ***/
|
||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
||||
/*** END value-production ***/
|
||||
|
||||
/*** BEGIN value-tail ***/
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
GType g_define_type_id =
|
||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/*** END value-tail ***/
|
||||
41
src/virt-viewer-enums.h.etemplate
Normal file
41
src/virt-viewer-enums.h.etemplate
Normal file
@ -0,0 +1,41 @@
|
||||
/*** BEGIN file-header ***/
|
||||
/*
|
||||
* Virt Viewer: A virtual machine console viewer
|
||||
*
|
||||
* Copyright (C) 2007-2012 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef VIRT_VIEWER_ENUMS_H
|
||||
#define VIRT_VIEWER_ENUMS_H
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
/*** END value-header ***/
|
||||
|
||||
/*** BEGIN file-tail ***/
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
/*** END file-tail ***/
|
||||
Loading…
Reference in New Issue
Block a user