1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*-
2 * gtksourceversion.c
3 * This file is part of GtkSourceView
4 *
5 * Copyright (C) 2015 - Paolo Borelli <pborelli@gnome.org>
6 *
7 * GtkSourceView is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * GtkSourceView is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include "gtksourceversion.h"
27
28 /**
29 * SECTION:version
30 * @short_description: Macros and functions to check the GtkSourceView version
31 **/
32
33 /**
34 * gtk_source_get_major_version:
35 *
36 * Returns the major version number of the GtkSourceView library.
37 * (e.g. in GtkSourceView version 3.20.0 this is 3.)
38 *
39 * This function is in the library, so it represents the GtkSourceView library
40 * your code is running against. Contrast with the #GTK_SOURCE_MAJOR_VERSION
41 * macro, which represents the major version of the GtkSourceView headers you
42 * have included when compiling your code.
43 *
44 * Returns: the major version number of the GtkSourceView library
45 *
46 * Since: 3.20
47 */
48 guint
gtk_source_get_major_version(void)49 gtk_source_get_major_version (void)
50 {
51 return GTK_SOURCE_MAJOR_VERSION;
52 }
53
54 /**
55 * gtk_source_get_minor_version:
56 *
57 * Returns the minor version number of the GtkSourceView library.
58 * (e.g. in GtkSourceView version 3.20.0 this is 20.)
59 *
60 * This function is in the library, so it represents the GtkSourceView library
61 * your code is running against. Contrast with the #GTK_SOURCE_MINOR_VERSION
62 * macro, which represents the minor version of the GtkSourceView headers you
63 * have included when compiling your code.
64 *
65 * Returns: the minor version number of the GtkSourceView library
66 *
67 * Since: 3.20
68 */
69 guint
gtk_source_get_minor_version(void)70 gtk_source_get_minor_version (void)
71 {
72 return GTK_SOURCE_MINOR_VERSION;
73 }
74
75 /**
76 * gtk_source_get_micro_version:
77 *
78 * Returns the micro version number of the GtkSourceView library.
79 * (e.g. in GtkSourceView version 3.20.0 this is 0.)
80 *
81 * This function is in the library, so it represents the GtkSourceView library
82 * your code is running against. Contrast with the #GTK_SOURCE_MICRO_VERSION
83 * macro, which represents the micro version of the GtkSourceView headers you
84 * have included when compiling your code.
85 *
86 * Returns: the micro version number of the GtkSourceView library
87 *
88 * Since: 3.20
89 */
90 guint
gtk_source_get_micro_version(void)91 gtk_source_get_micro_version (void)
92 {
93 return GTK_SOURCE_MICRO_VERSION;
94 }
95
96 /**
97 * gtk_source_check_version:
98 * @major: the major version to check
99 * @minor: the minor version to check
100 * @micro: the micro version to check
101 *
102 * Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is
103 * at runtime instead of compile time. This is useful for compiling
104 * against older versions of GtkSourceView, but using features from newer
105 * versions.
106 *
107 * Returns: %TRUE if the version of the GtkSourceView currently loaded
108 * is the same as or newer than the passed-in version.
109 *
110 * Since: 3.20
111 */
112 gboolean
gtk_source_check_version(guint major,guint minor,guint micro)113 gtk_source_check_version (guint major,
114 guint minor,
115 guint micro)
116 {
117 return GTK_SOURCE_CHECK_VERSION (major, minor, micro);
118 }
119