From 8b6812805dd4cbdb21dcd6693ab316534e2e5f88 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 9 Feb 2004 15:29:03 +0000 Subject: [PATCH] added runtime check for fontconfig > 2.2.0 and abort with a dialog box 2004-02-09 Michael Natterer * 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. --- ChangeLog | 7 ++++ app/gui/gui.c | 91 ++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 76 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index abd7f6d131..6a53e56958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-02-09 Michael Natterer + + * 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 * plug-ins/common/curve_bend.c: applied patch from Wolfgang Hofer diff --git a/app/gui/gui.c b/app/gui/gui.c index 676b8f0757..17694b6d4a 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -22,6 +22,7 @@ #include #include +#include #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 - - mismatch = gtk_check_version (REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO); - - if (mismatch) + if (! abort_message) { - gchar *message; + const gchar *mismatch; - 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_major_version, gtk_minor_version, gtk_micro_version, - REQUIRED_MAJOR, REQUIRED_MINOR, REQUIRED_MICRO); +#define GTK_REQUIRED_MAJOR 2 +#define GTK_REQUIRED_MINOR 2 +#define GTK_REQUIRED_MICRO 2 - gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, message, + mismatch = gtk_check_version (GTK_REQUIRED_MAJOR, + GTK_REQUIRED_MINOR, + GTK_REQUIRED_MICRO); + + if (mismatch) + { + 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, + GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO, + gtk_major_version, gtk_minor_version, gtk_micro_version, + GTK_REQUIRED_MAJOR, GTK_REQUIRED_MINOR, GTK_REQUIRED_MICRO); + } + +#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);