
2001-07-10 Michael Natterer <mitch@gimp.org> * app/app_procs.[ch]: removed the gimp_busy boolean, check whether user_installation is needed here, not in user_install.c, parse gtkrc an friends only if(!no_interface), create the Gimp object before parsing gimp's rc files an pas it to the parse functions, many other cleanups. * app/appenums.h: added MessageHandlerType and StackTraceMode. * app/appenv.h: removed MessageHandlerType, declare all global variables from main.c (no more hidden global stuff please). * app/errors.[ch]: added the fatal message func here (from main.c), removed the StackTraceMode enum. * app/gimprc.[ch]: renamed functions to gimprc_*(), pass a Gimp pointer to some functions. * app/gimpunit.c * app/unitrc.h: ok, this is ugly: renamed all functions to _gimp_unit_*() and made them public. The unit list is part of the Gimp object now, so pass a Gimp* to all functions. * app/libgimp_glue.[ch]: added EEKy wrappers for all gimp_unit_*() functions which are used by widgets. * app/main.c: cleaned up the global variables, removed the fatal message handler, call app_init() directly, not via the user_install stuff, misc. cleanups. * app/user_install.[ch]: removed the check if user_installation is needed (done by app_procs.c now). * app/core/gimp.[ch]: added the user_unit list and the "busy" boolean. Moved gimp_[set|unset]_busy() here. Added gimp_initialize() which is called after unitrc and gimprc are parsed. * app/batch.c * app/colormaps.c * app/devices.c * app/disp_callbacks.c * app/gdisplay_ops.c * app/gimphelp.c * app/module_db.c * app/nav_window.c * app/plug_in.c * app/core/gimpcontext.c * app/core/gimpdatafiles.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/core/gimpparasite.c * app/core/gimpparasitelist.h * app/gui/file-open-dialog.c * app/gui/gui.[ch] * app/gui/info-dialog.c * app/gui/info-window.c * app/gui/preferences-dialog.c * app/gui/session.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * app/tools/tool_manager.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcursor.c * app/xcf/xcf-load.c * app/xcf/xcf-save.c * app/xcf/xcf.c * tools/pdbgen/Makefile.am * tools/pdbgen/app.pl * tools/pdbgen/enums.pl * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/message.pdb * tools/pdbgen/pdb/unit.pdb * app/pdb/image_cmds.c * app/pdb/message_cmds.c * app/pdb/unit_cmds.c: changed accordingly, minor cleanups.
192 lines
3.6 KiB
C
192 lines
3.6 KiB
C
/* The GIMP -- an image manipulation program
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <signal.h>
|
|
#include <stdarg.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "core/core-types.h"
|
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
|
|
|
#include "appenv.h"
|
|
#include "errorconsole.h"
|
|
#include "errors.h"
|
|
|
|
#ifdef G_OS_WIN32
|
|
#include <windows.h>
|
|
#endif
|
|
|
|
|
|
void
|
|
gimp_message_log_func (const gchar *log_domain,
|
|
GLogLevelFlags flags,
|
|
const gchar *message,
|
|
gpointer data)
|
|
{
|
|
if (console_messages == FALSE)
|
|
{
|
|
switch (message_handler)
|
|
{
|
|
case MESSAGE_BOX:
|
|
gimp_message_box ((gchar *) message, NULL, NULL);
|
|
break;
|
|
|
|
case ERROR_CONSOLE:
|
|
error_console_add ((gchar *) message);
|
|
break;
|
|
|
|
default:
|
|
g_printerr ("%s: %s\n", prog_name, (gchar *) message);
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_printerr ("%s: %s\n", prog_name, (gchar *) message);
|
|
}
|
|
}
|
|
|
|
void
|
|
gimp_error_log_func (const gchar *domain,
|
|
GLogLevelFlags flags,
|
|
const gchar *message,
|
|
gpointer data)
|
|
{
|
|
gimp_fatal_error ("%s", message);
|
|
}
|
|
|
|
void
|
|
gimp_fatal_error (gchar *fmt, ...)
|
|
{
|
|
va_list args;
|
|
gchar *message;
|
|
|
|
va_start (args, fmt);
|
|
message = g_strdup_vprintf (fmt, args);
|
|
va_end (args);
|
|
|
|
#ifndef G_OS_WIN32
|
|
|
|
g_printerr ("%s: fatal error: %s\n", prog_name, message);
|
|
|
|
switch (stack_trace_mode)
|
|
{
|
|
case STACK_TRACE_NEVER:
|
|
break;
|
|
|
|
case STACK_TRACE_QUERY:
|
|
{
|
|
sigset_t sigset;
|
|
|
|
sigemptyset (&sigset);
|
|
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
|
g_on_error_query (prog_name);
|
|
}
|
|
break;
|
|
|
|
case STACK_TRACE_ALWAYS:
|
|
{
|
|
sigset_t sigset;
|
|
|
|
sigemptyset (&sigset);
|
|
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
|
g_on_error_stack_trace (prog_name);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
#else
|
|
|
|
/* g_on_error_* don't do anything reasonable on Win32. */
|
|
|
|
MessageBox (NULL, message, prog_name, MB_OK|MB_ICONERROR);
|
|
|
|
#endif /* ! G_OS_WIN32 */
|
|
|
|
gdk_exit (1);
|
|
}
|
|
|
|
void
|
|
gimp_terminate (gchar *fmt, ...)
|
|
{
|
|
va_list args;
|
|
gchar *message;
|
|
|
|
va_start (args, fmt);
|
|
message = g_strdup_vprintf (fmt, args);
|
|
va_end (args);
|
|
|
|
#ifndef G_OS_WIN32
|
|
|
|
g_printerr ("%s terminated: %s\n", prog_name, message);
|
|
|
|
if (use_debug_handler)
|
|
{
|
|
switch (stack_trace_mode)
|
|
{
|
|
case STACK_TRACE_NEVER:
|
|
break;
|
|
|
|
case STACK_TRACE_QUERY:
|
|
{
|
|
sigset_t sigset;
|
|
|
|
sigemptyset (&sigset);
|
|
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
|
g_on_error_query (prog_name);
|
|
}
|
|
break;
|
|
|
|
case STACK_TRACE_ALWAYS:
|
|
{
|
|
sigset_t sigset;
|
|
|
|
sigemptyset (&sigset);
|
|
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
|
g_on_error_stack_trace (prog_name);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
#else
|
|
|
|
/* g_on_error_* don't do anything reasonable on Win32. */
|
|
|
|
MessageBox (NULL, message, prog_name, MB_OK|MB_ICONERROR);
|
|
|
|
#endif /* ! G_OS_WIN32 */
|
|
|
|
gdk_exit (1);
|
|
}
|