1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU Lesser General Public
7 * License as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include "eds-version.h"
22 const guint eds_major_version = EDS_MAJOR_VERSION;
23 const guint eds_minor_version = EDS_MINOR_VERSION;
24 const guint eds_micro_version = EDS_MICRO_VERSION;
28 * @required_major: the required major version
29 * @required_minor: the required minor version
30 * @required_micro: the required micro version
32 * Checks that the Evolution-Data-Server library in use is compatible with
33 * the given version. Generally you would pass in the constants
34 * #EDS_MAJOR_VERSION, #EDS_MINOR_VERSION, #EDS_MICRO_VERSION as the three
35 * arguments to this function. That produces a check that the library in
36 * use is compatible with the version of Evolution-Data-Server the
37 * application or module was compiled against.
39 * Returns: %NULL if the Evolution-Data-Server library is compatible with
40 * the given version, or a string describing the version mismatch. The
41 * returned string is owned by libedataserver and must not be modified or
47 eds_check_version (guint required_major,
51 gint eds_effective_micro = 100 * EDS_MINOR_VERSION + EDS_MICRO_VERSION;
52 gint required_effective_micro = 100 * required_minor + required_micro;
54 if (required_major > EDS_MAJOR_VERSION)
55 return "EDS version too old (major mismatch)";
56 if (required_major < EDS_MAJOR_VERSION)
57 return "EDS version too new (major mismatch)";
58 if (required_effective_micro > eds_effective_micro)
59 return "EDS version too old (micro mismatch)";