forked from AuroraMiddleware/gtk
Turn the gtk version and age variables into functions
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.
This commit is contained in:
parent
b654afcb48
commit
cb24bcc613
@ -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",
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user