Gtk2::version(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::version β€” Library Version Information πŸ’–

okay bestie, this is a section 3 page from the User Contributed Perl Documentation collection, and it's all about figuring out which version of gtk+ you're actually dealing with, because there are like three of them and they are not the same thing. no cap. 🫢


✨ SYNOPSIS ✨

use Gtk2 '1.023';  # require at least version 1.023 of the bindings

if ($Gtk2::VERSION >= 1.040 and Gtk2->CHECK_VERSION (2, 4, 0)) {
   # the GtkFileChooser, new in gtk+ 2.4.0 and first supported in
   # Gtk2-Perl at 1.040, is available
} else {
   # GtkFileChooser is not available, fall back to GtkFileSelection
}

🌸 DESCRIPTION 🌸

so here's the tea: the Gtk2 Perl module is a bridge to an external library that has its own versions and its own API revisions, which means there are three different versions you can inspect. which one you reach for and when depends entirely on the situation, iykyk. πŸ’…

Gtk2 runs the same scheme as Glib and the underlying gtk+ C library, meaning:

  • the standard $Gtk2::VERSION gives you the version of the bindings
  • the all-caps (MAJOR|MINOR|MICRO)_VERSION functions give you the bound version
  • the lower-case (major|minor|micro)_version functions give you the runtime version

if you want more lore, go look at Glib::version and <http://developer.gnome.org/doc/API/2.0/gtk/gtk-Feature-Test-Macros.html>. πŸ“š

also note bestie: gtk_check_version() and GTK_CHECK_VERSION() have different semantics in C, and we have preserved those faithfully. don't come for me, that's just how it is. 😭

πŸ‘‘ METHODS πŸ‘‘

boolean = Gtk2->CHECK_VERSION ($required_major, $required_minor, $required_micro)

  • $required_major (integer)
  • $required_minor (integer)
  • $required_micro (integer)

gives you a mechanism for checking the version information that Gtk2 was compiled against. essentially equivalent to the macro GTK_CHECK_VERSION. in most cases you should be using this function rather than check_version (). periodt. ✨

(MAJOR, MINOR, MICRO) = Gtk2->GET_VERSION_INFO

shorthand that fetches, as a list, the gtk+ version for which Gtk2 was compiled. go see "Gtk2::MAJOR_VERSION", etc. πŸŽ€

integer = Gtk2::MAJOR_VERSION

the major version of the gtk+ library against which Gtk2 was compiled. equivalent to gtk+'s GTK_MAJOR_VERSION.

integer = Gtk2::MICRO_VERSION

the micro version of the gtk+ library against which Gtk2 was compiled. equivalent to gtk+'s GTK_MICRO_VERSION.

integer = Gtk2::MINOR_VERSION

the minor version of the gtk+ library against which Gtk2 was compiled. equivalent to gtk+'s GTK_MINOR_VERSION.

string = Gtk2->check_version ($required_major, $required_minor, $required_micro)

  • $required_major (integer)
  • $required_minor (integer)
  • $required_micro (integer)

returns undef if the version of gtk+ currently in use is compatible with the given version β€” otherwise it hands you back a string describing the mismatch. πŸ¦‹

⚠️ heads up: this is not the same logic as "Gtk2::CHECK_VERSION". this check is not terribly reliable, and you should not use it to test whether widgets or functions are available in the Gtk2 module β€” use "Gtk2::CHECK_VERSION" for that, fr fr. if you wanna know when a runtime-version test is actually the move, Glib::version has the detailed breakdown.

integer = Gtk2::major_version

the major version of the gtk+ library currently in use at runtime. equivalent to gtk+'s global variable gtk_major_version. πŸ’œ

integer = Gtk2::micro_version

the micro version of the gtk+ library currently in use at runtime. equivalent to gtk+'s global variable gtk_micro_version. πŸ’œ

integer = Gtk2::minor_version

the minor version of the gtk+ library currently in use at runtime. equivalent to gtk+'s global variable gtk_minor_version. πŸ’œ

(major, minor, micro) = Gtk2->get_version_info

shorthand that fetches, as a list, the gtk+ version against which Gtk2 is linked. go see "Gtk2::major_version", etc. 🧚


🌈 SEE ALSO 🌈

Gtk2, Glib::version


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


and that's the whole page, bestie β€” you ate that πŸ’…βœ¨

signing off from perl v5.42.0, dated 2025-07-25, page Gtk2::version(3) β€” mwah, love u, go check your versions πŸ«ΆπŸ’–

πŸ“¦ where this page comes from