Version information

Version information — Variables and functions to check the library version

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <thunarx/thunarx.h>

extern const guint  thunarx_major_version;
extern const guint  thunarx_minor_version;
extern const guint  thunarx_micro_version;
const gchar *       thunarx_check_version               (guint required_major,
                                                         guint required_minor,
                                                         guint required_micro);
#define             THUNARX_MAJOR_VERSION
#define             THUNARX_MINOR_VERSION
#define             THUNARX_MICRO_VERSION
#define             THUNARX_CHECK_VERSION               (major,
                                                         minor,
                                                         micro)

Description

The Thunar Extension library provides version information, which should be used by extensions.

Details

thunarx_major_version

extern const guint thunarx_major_version;

The major version number of the thunarx library (e.g. in version 0.5.1 this is 0).

This variable is in the library, so represents the thunarx library you have linked against. Contrast with the THUNARX_MAJOR_VERSION macro, which represents the major version of the thunarx headers you have included.


thunarx_minor_version

extern const guint thunarx_minor_version;

The minor version number of the thunarx library (e.g. in version 0.5.1 this is 5).

This variable is in the library, so represents the thunarx library you have linked against. Contrast with the THUNARX_MINOR_VERSION macro, which represents the minor version of the thunarx headers you have included.


thunarx_micro_version

extern const guint thunarx_micro_version;

The micro version number of the thunarx library (e.g. in version 0.5.1 this is 1).

This variable is in the library, so represents the thunarx library you have linked against. Contrast with the THUNARX_MICRO_VERSION macro, which represents the micro version of the thunarx headers you have included.


thunarx_check_version ()

const gchar *       thunarx_check_version               (guint required_major,
                                                         guint required_minor,
                                                         guint required_micro);

Checks that the thunarx library in use is compatible with the given version. Generally you would pass in the constants THUNARX_MAJOR_VERSION, THUNARX_MINOR_VERSION and THUNARX_VERSION_MICRO as the three arguments to this function; that produces a check that the library in use is compatible with the version of thunarx the extension was compiled against.

This function should be called by extensions in the thunar_extension_initialize() method to verify that the thunarx library used by file manager is compatible with the version the extension was compiled with.

Example 3. Checking the runtime version of the Thunar Extension library

const gchar *mismatch;
mismatch = thunarx_check_version (THUNARX_VERSION_MAJOR,
                                  THUNARX_VERSION_MINOR,
                                  THUNARX_VERSION_MICRO);
if (G_UNLIKELY (mismatch != NULL))
  g_error ("Version mismatch: %s", mismatch);


required_major :

the required major version.

required_minor :

the required minor version.

required_micro :

the required micro version.

Returns :

NULL if the library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by the library and must not be freed or modified by the caller.

THUNARX_MAJOR_VERSION

#define THUNARX_MAJOR_VERSION 1

The major version number of the thunarx library. Like thunarx_major_version, but from the headers used at application compile time, rather than from the library linked against at application run time.


THUNARX_MINOR_VERSION

#define THUNARX_MINOR_VERSION 4

The minor version number of the thunarx library. Like thunarx_minor_version, but from the headers used at application compile time, rather than from the library linked against at application run time.


THUNARX_MICRO_VERSION

#define THUNARX_MICRO_VERSION 0

The micro version number of the thunarx library. Like thunarx_micro_version, but from the headers used at application compile time, rather than from the library linked against at application run time.


THUNARX_CHECK_VERSION()

#define             THUNARX_CHECK_VERSION(major,minor,micro)

Checks the version of the thunarx library. Returns TRUE if the version of the thunarx header files is the same as or newer than the passed-in version.

Example 4. Checking the version of the Thunar Extension library

if (!THUNARX_CHECK_VERSION (0, 1, 0))
  g_error ("Thunarx version 0.1.0 or above is required");

major :

the major version number.

minor :

the minor version number

micro :

the micro version number.