]> Pileus Git - ~andy/gtk/commitdiff
Turn the gtk version and age variables into functions
authorTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 14:36:10 +0000 (17:36 +0300)
committerTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 18:31:33 +0000 (21:31 +0300)
Having variables exported from a DLL is slightly painful and
potentially error-prone on Windows, so let's try get rid of them now
when we can. Starting with these.

demos/gtk-demo/appwindow.c
docs/reference/gtk/tmpl/gtkfeatures.sgml
gtk/gtk.symbols
gtk/gtkmain.c
gtk/gtkmain.h
tests/testgtk.c

index 57cb0cea49cafe6de7c169d711d12b28ee70564f..2953bb8a012eaf67b289d0f94c9512ed4fa69129 100644 (file)
@@ -124,7 +124,11 @@ about_cb (GtkAction *action,
   gtk_about_dialog_set_url_hook (activate_url, NULL, NULL);
   gtk_show_about_dialog (GTK_WINDOW (window),
                         "program-name", "GTK+ Code Demos",
-                        "version", PACKAGE_VERSION,
+                        "version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
+                                                    PACKAGE_VERSION,
+                                                    gtk_major_version (),
+                                                    gtk_minor_version (),
+                                                    gtk_micro_version ()),
                         "copyright", "(C) 1997-2009 The GTK+ Team",
                         "license-type", GTK_LICENSE_LGPL_2_1,
                         "website", "http://www.gtk.org",
index 16e0adddc54ad479b5a97b24659e34f5c8006d67..f6f7d95d0e78b74ac7b3190c3fa5264bca92b1c5 100644 (file)
@@ -22,64 +22,6 @@ typically use the features described here.
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### VARIABLE gtk_major_version ##### -->
-<para>
-The major version number of the GTK+ library.  (e.g. in GTK+ version
-1.2.5 this is 1.) 
-</para>
-
-<para>
-This variable is in the library, so represents the
-GTK+ library you have linked against. Contrast with the
-#GTK_MAJOR_VERSION macro, which represents the major version of the
-GTK+ headers you have included.
-</para>
-
-
-<!-- ##### VARIABLE gtk_minor_version ##### -->
-<para>
-The minor version number of the GTK+ library.
-(e.g. in GTK+ version 1.2.5 this is 2.)
-</para>
-
-<para>
-This variable is in the library, so represents the
-GTK+ library you have linked against. Contrast with the
-#GTK_MINOR_VERSION macro, which represents the minor version of the
-GTK+ headers you have included.
-</para>
-
-
-<!-- ##### VARIABLE gtk_micro_version ##### -->
-<para>
-The micro version number of the GTK+ library.
-(e.g. in GTK+ version 1.2.5 this is 5.)
-</para>
-
-
-<para>
-This variable is in the library, so represents the GTK+ library you
-have linked against. Contrast with the #GTK_MICRO_VERSION macro, which
-represents the micro version of the GTK+ headers you have included.
-</para>
-
-
-<!-- ##### VARIABLE gtk_binary_age ##### -->
-<para>
-This is the binary age passed to <application>libtool</application>. If 
-<application>libtool</application> means nothing to you, don't worry 
-about it. ;-)
-</para>
-
-
-<!-- ##### VARIABLE gtk_interface_age ##### -->
-<para>
-This is the interface age passed to <application>libtool</application>. If 
-<application>libtool</application> means nothing to you, don't worry 
-about it. ;-)
-</para>
-
-
 <!-- ##### FUNCTION gtk_check_version ##### -->
 <para>
 </para>
index 3ba5bb8d4efc50b7cc535e9315fa3a5d54e890fd..64792c91bdae0ba4151719cbfd0640f1ce415938 100644 (file)
@@ -1860,6 +1860,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_check_version
 gtk_get_default_language
 gtk_get_event_widget
@@ -4535,11 +4540,6 @@ gtk_info_bar_get_message_type
 #endif
 
 #ifdef INCLUDE_VARIABLES
-gtk_binary_age
-gtk_interface_age
-gtk_major_version
-gtk_minor_version
-gtk_micro_version
 gtk_debug_flags
 gtk_text_attr_appearance_type
 gtk_text_char_type
index a7cd8461f1114fd47001bdbba7f24f902f6ebbd5..89c2c303016c14fa03ff2b69a5b212a0cd8d8647 100644 (file)
@@ -179,12 +179,6 @@ static gint  gtk_invoke_key_snoopers        (GtkWidget          *grab_widget,
 
 static GtkWindowGroup *gtk_main_get_window_group (GtkWidget   *widget);
 
-const guint gtk_major_version = GTK_MAJOR_VERSION;
-const guint gtk_minor_version = GTK_MINOR_VERSION;
-const guint gtk_micro_version = GTK_MICRO_VERSION;
-const guint gtk_binary_age = GTK_BINARY_AGE;
-const guint gtk_interface_age = GTK_INTERFACE_AGE;
-
 static guint gtk_main_loop_level = 0;
 static gint pre_initialized = FALSE;
 static gint gtk_initialized = FALSE;
@@ -218,6 +212,97 @@ static const GDebugKey gtk_debug_keys[] = {
 };
 #endif /* G_ENABLE_DEBUG */
 
+/**
+ * gtk_major_version:
+ *
+ * Returns the major version number of the GTK+ library.  (e.g. in GTK+ version
+ * 3.1.5 this is 3.) 
+ *
+ * This function is in the library, so it represents the GTK+ library
+ * your code is running against. Contrast with the #GTK_MAJOR_VERSION
+ * 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.
+ */
+guint
+gtk_major_version (void)
+{
+  return GTK_MAJOR_VERSION;
+}
+
+/**
+ * gtk_minor_version:
+ *
+ * Returns the minor version number of the GTK+ library.  (e.g. in GTK+ version
+ * 3.1.5 this is 1.) 
+ *
+ * This function is in the library, so it represents the GTK+ library
+ * your code is are running against. Contrast with the
+ * #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.
+ */
+guint
+gtk_minor_version (void)
+{
+  return GTK_MINOR_VERSION;
+}
+
+/**
+ * gtk_micro_version:
+ *
+ * Returns the micro version number of the GTK+ library.  (e.g. in GTK+ version
+ * 3.1.5 this is 5.) 
+ *
+ * This function is in the library, so it represents the GTK+ library
+ * your code is are running against. Contrast with the
+ * #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.
+ */
+guint
+gtk_micro_version (void)
+{
+  return GTK_MICRO_VERSION;
+}
+
+/**
+ * gtk_binary_age:
+ *
+ * Returns the binary age as passed to
+ * <application>libtool</application> when building the GTK+ library
+ * the process is running against. If
+ * <application>libtool</application> means nothing to you, don't
+ * worry about it.
+ *
+ * Returns the binary age of the GTK+ library.
+ */
+guint
+gtk_binary_age (void)
+{
+  return GTK_BINARY_AGE;
+}
+
+/**
+ * gtk_interface_age:
+ *
+ * Returns the interface age as passed to
+ * <application>libtool</application> when building the GTK+ library
+ * the process is running against. If
+ * <application>libtool</application> means nothing to you, don't
+ * worry about it.
+ *
+ * Returns the interface age of the GTK+ library.
+ */
+guint
+gtk_interface_age (void)
+{
+  return GTK_INTERFACE_AGE;
+}
+
 /**
  * gtk_check_version:
  * @required_major: the required major version.
index fe4ff99490dafad551625914a153a2ed9da6c2b4..ca7bd669d77275f4c8c8e974a21e2f794d322a84 100644 (file)
@@ -51,21 +51,12 @@ typedef gint        (*GtkKeySnoopFunc)          (GtkWidget    *grab_widget,
 
 /* Gtk version.
  */
-#ifdef G_PLATFORM_WIN32
-#ifdef GTK_COMPILATION
-#define GTKMAIN_C_VAR __declspec(dllexport)
-#else
-#define GTKMAIN_C_VAR extern __declspec(dllimport)
-#endif
-#else
-#define GTKMAIN_C_VAR extern
-#endif
+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;
 
-GTKMAIN_C_VAR const guint gtk_major_version;
-GTKMAIN_C_VAR const guint gtk_minor_version;
-GTKMAIN_C_VAR const guint gtk_micro_version;
-GTKMAIN_C_VAR const guint gtk_binary_age;
-GTKMAIN_C_VAR const guint gtk_interface_age;
 const gchar* gtk_check_version (guint  required_major,
                                guint   required_minor,
                                guint   required_micro);
index cddb7dfe562ac8cd50641c49a747c5a71dca8b15..b29c4d4be07070619e4cd2b69c4467f650b5961d 100644 (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_major_version (),
+            gtk_minor_version (),
+            gtk_micro_version ());
   else
     sprintf (buffer,
             "Gtk+ v%d.%d",
-            gtk_major_version,
-            gtk_minor_version);
+            gtk_major_version (),
+            gtk_minor_version ());
 
   label = gtk_label_new (buffer);
   gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);