[gtk+] Don't use the same name for a function that used to be a variable



commit dd36afc2078dc0072b3dd4d17841b271b4ed770c
Author: Tor Lillqvist <tml iki fi>
Date:   Thu Sep 9 11:03:22 2010 +0300

    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.

 demos/gtk-demo/appwindow.c |    6 +++---
 gtk/gtk.symbols            |   10 +++++-----
 gtk/gtkmain.c              |   40 +++++++++++++++++++++++++---------------
 gtk/gtkmain.h              |   16 +++++++++++-----
 tests/testgtk.c            |   10 +++++-----
 5 files changed, 49 insertions(+), 33 deletions(-)
---
diff --git a/demos/gtk-demo/appwindow.c b/demos/gtk-demo/appwindow.c
index 2953bb8..a3bbf47 100644
--- a/demos/gtk-demo/appwindow.c
+++ b/demos/gtk-demo/appwindow.c
@@ -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";,
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 36ef632..a89347d 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -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
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 03f33c6..6d9eca5 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -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;
 }
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index ca7bd66..39171f5 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -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,
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 8d408b3..6f0bf10 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]