Don't use the same name for a function that used to be a variable

Rename the gtk_major_version() etc functions I introduced yesterday to
start with gtk_get. Avoids misleading results in client programs whose
developers that don't notice the change or the compiler warnings, and
when recompiling against gtk3 then use the function addresses as the
version numbers.
This commit is contained in:
Tor Lillqvist 2010-09-09 11:03:22 +03:00
parent 91d0728dfa
commit dd36afc207
5 changed files with 49 additions and 33 deletions

View File

@ -126,9 +126,9 @@ about_cb (GtkAction *action,
"program-name", "GTK+ Code Demos",
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
PACKAGE_VERSION,
gtk_major_version (),
gtk_minor_version (),
gtk_micro_version ()),
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ()),
"copyright", "(C) 1997-2009 The GTK+ Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",

View File

@ -1853,11 +1853,11 @@ gtk_events_pending
gtk_disable_setlocale
gtk_distribute_natural_allocation
gtk_set_locale
gtk_binary_age
gtk_interface_age
gtk_major_version
gtk_minor_version
gtk_micro_version
gtk_get_major_version
gtk_get_minor_version
gtk_get_micro_version
gtk_get_binary_age
gtk_get_interface_age
gtk_check_version
gtk_get_default_language
gtk_get_event_widget

View File

@ -213,7 +213,7 @@ static const GDebugKey gtk_debug_keys[] = {
#endif /* G_ENABLE_DEBUG */
/**
* gtk_major_version:
* gtk_get_major_version:
*
* Returns the major version number of the GTK+ library. (e.g. in GTK+ version
* 3.1.5 this is 3.)
@ -223,16 +223,18 @@ static const GDebugKey gtk_debug_keys[] = {
* macro, which represents the major version of the GTK+ headers you
* have included when compiling your code.
*
* Returns the major version number of the GTK+ library.
* Returns: the major version number of the GTK+ library.
*
* Since: 3.0
*/
guint
gtk_major_version (void)
gtk_get_major_version (void)
{
return GTK_MAJOR_VERSION;
}
/**
* gtk_minor_version:
* gtk_get_minor_version:
*
* Returns the minor version number of the GTK+ library. (e.g. in GTK+ version
* 3.1.5 this is 1.)
@ -242,16 +244,18 @@ gtk_major_version (void)
* #GTK_MINOR_VERSION macro, which represents the minor version of the
* GTK+ headers you have included when compiling your code.
*
* Returns the minor version number of the GTK+ library.
* Returns: the minor version number of the GTK+ library.
*
* Since: 3.0
*/
guint
gtk_minor_version (void)
gtk_get_minor_version (void)
{
return GTK_MINOR_VERSION;
}
/**
* gtk_micro_version:
* gtk_get_micro_version:
*
* Returns the micro version number of the GTK+ library. (e.g. in GTK+ version
* 3.1.5 this is 5.)
@ -261,16 +265,18 @@ gtk_minor_version (void)
* #GTK_MICRO_VERSION macro, which represents the micro version of the
* GTK+ headers you have included when compiling your code.
*
* Returns the micro version number of the GTK+ library.
* Returns: the micro version number of the GTK+ library.
*
* Since: 3.0
*/
guint
gtk_micro_version (void)
gtk_get_micro_version (void)
{
return GTK_MICRO_VERSION;
}
/**
* gtk_binary_age:
* gtk_get_binary_age:
*
* Returns the binary age as passed to
* <application>libtool</application> when building the GTK+ library
@ -278,16 +284,18 @@ gtk_micro_version (void)
* <application>libtool</application> means nothing to you, don't
* worry about it.
*
* Returns the binary age of the GTK+ library.
* Returns: the binary age of the GTK+ library.
*
* Since: 3.0
*/
guint
gtk_binary_age (void)
gtk_get_binary_age (void)
{
return GTK_BINARY_AGE;
}
/**
* gtk_interface_age:
* gtk_get_interface_age:
*
* Returns the interface age as passed to
* <application>libtool</application> when building the GTK+ library
@ -295,10 +303,12 @@ gtk_binary_age (void)
* <application>libtool</application> means nothing to you, don't
* worry about it.
*
* Returns the interface age of the GTK+ library.
* Returns: the interface age of the GTK+ library.
*
* Since: 3.0
*/
guint
gtk_interface_age (void)
gtk_get_interface_age (void)
{
return GTK_INTERFACE_AGE;
}

View File

@ -51,11 +51,17 @@ typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
/* Gtk version.
*/
guint gtk_major_version (void) G_GNUC_CONST;
guint gtk_minor_version (void) G_GNUC_CONST;
guint gtk_micro_version (void) G_GNUC_CONST;
guint gtk_binary_age (void) G_GNUC_CONST;
guint gtk_interface_age (void) G_GNUC_CONST;
guint gtk_get_major_version (void) G_GNUC_CONST;
guint gtk_get_minor_version (void) G_GNUC_CONST;
guint gtk_get_micro_version (void) G_GNUC_CONST;
guint gtk_get_binary_age (void) G_GNUC_CONST;
guint gtk_get_interface_age (void) G_GNUC_CONST;
#define gtk_major_version gtk_get_major_version ()
#define gtk_minor_version gtk_get_minor_version ()
#define gtk_micro_version gtk_get_micro_version ()
#define gtk_binary_age gtk_get_binary_age ()
#define gtk_interface_age gtk_get_interface_age ()
const gchar* gtk_check_version (guint required_major,
guint required_minor,

View File

@ -10333,14 +10333,14 @@ create_main_window (void)
if (gtk_micro_version > 0)
sprintf (buffer,
"Gtk+ v%d.%d.%d",
gtk_major_version (),
gtk_minor_version (),
gtk_micro_version ());
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
else
sprintf (buffer,
"Gtk+ v%d.%d",
gtk_major_version (),
gtk_minor_version ());
gtk_get_major_version (),
gtk_get_minor_version ());
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);