added runtime check for fontconfig > 2.2.0 and abort with a dialog box

2004-02-09  Michael Natterer  <mitch@gimp.org>

	* app/gui/gui.c (gui_libs_init): added runtime check for
	fontconfig > 2.2.0 and abort with a dialog box telling the
	user to upgrade fontconfig if the requirement is not met.
	Fixes all bugs like #133818.
This commit is contained in:
Michael Natterer 2004-02-09 15:29:03 +00:00 committed by Michael Natterer
parent 01ea8d5587
commit 8b6812805d
2 changed files with 76 additions and 22 deletions

View File

@ -1,3 +1,10 @@
2004-02-09 Michael Natterer <mitch@gimp.org>
* app/gui/gui.c (gui_libs_init): added runtime check for
fontconfig > 2.2.0 and abort with a dialog box telling the
user to upgrade fontconfig if the requirement is not met.
Fixes all bugs like #133818.
2004-02-09 Sven Neumann <sven@gimp.org>
* plug-ins/common/curve_bend.c: applied patch from Wolfgang Hofer

View File

@ -22,6 +22,7 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include <fontconfig/fontconfig.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
@ -119,7 +120,7 @@ gboolean
gui_libs_init (gint *argc,
gchar ***argv)
{
const gchar *mismatch;
gchar *abort_message = NULL;
g_return_val_if_fail (argc != NULL, FALSE);
g_return_val_if_fail (argv != NULL, FALSE);
@ -134,32 +135,78 @@ gui_libs_init (gint *argc,
g_type_class_ref (GIMP_TYPE_COLOR_SELECT);
#define REQUIRED_MAJOR 2
#define REQUIRED_MINOR 2
#define REQUIRED_MICRO 2
if (! abort_message)
{
const gchar *mismatch;
mismatch = gtk_check_version (REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO);
#define GTK_REQUIRED_MAJOR 2
#define GTK_REQUIRED_MINOR 2
#define GTK_REQUIRED_MICRO 2
mismatch = gtk_check_version (GTK_REQUIRED_MAJOR,
GTK_REQUIRED_MINOR,
GTK_REQUIRED_MICRO);
if (mismatch)
{
gchar *message;
message =
g_strdup_printf ("%s\n\n"
abort_message =
g_strdup_printf
("%s\n\n"
"The GIMP requires Gtk+ version %d.%d.%d or later.\n"
"Installed Gtk+ version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older Gtk+ version.\n\n"
"Please upgrade to Gtk+ version %d.%d.%d or later.",
mismatch,
REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO,
GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO,
gtk_major_version, gtk_minor_version, gtk_micro_version,
REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO);
GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO);
}
gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, message,
#undef GTK_REQUIRED_MAJOR
#undef GTK_REQUIRED_MINOR
#undef GTK_REQUIRED_MICRO
}
if (! abort_message)
{
gint fc_version = FcGetVersion ();
gint fc_major_version = fc_version / 100 / 100;
gint fc_minor_version = fc_version / 100 % 100;
gint fc_micro_version = fc_version % 100;
#define FC_REQUIRED_MAJOR 2
#define FC_REQUIRED_MINOR 2
#define FC_REQUIRED_MICRO 0
if (fc_version < ((FC_REQUIRED_MAJOR * 10000) +
(FC_REQUIRED_MINOR * 100) +
(FC_REQUIRED_MICRO * 1)))
{
abort_message =
g_strdup_printf
("Fontconfig version too old!\n\n"
"The GIMP requires fontconfig version %d.%d.%d or later.\n"
"Installed fontconfig version is %d.%d.%d.\n\n"
"Somehow you or your software packager managed\n"
"to install The GIMP with an older fontconfig version.\n\n"
"Please upgrade to fontconfig version %d.%d.%d or later.",
FC_REQUIRED_MAJOR, FC_REQUIRED_MINOR, FC_REQUIRED_MICRO,
fc_major_version, fc_minor_version, fc_micro_version,
FC_REQUIRED_MAJOR, FC_REQUIRED_MINOR, FC_REQUIRED_MICRO);
}
#undef FC_REQUIRED_MAJOR
#undef FC_REQUIRED_MINOR
#undef FC_REQUIRED_MICRO
}
if (abort_message)
{
gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, abort_message,
(GtkCallback) gtk_main_quit, NULL);
g_free (message);
g_free (abort_message);
gtk_main ();
exit (EXIT_FAILURE);