36
33
#include <malloc.h>
43
36
#include <locale.h>
45
38
#include <glib-object.h>
41
#include <dbus/dbus-glib.h>
44
#ifndef GIMP_CONSOLE_COMPILATION
47
48
#include "libgimpbase/gimpbase.h"
50
#include "core/core-types.h"
52
#include "base/tile.h"
49
54
#include "config/gimpconfig-dump.h"
51
#include "core/core-types.h"
52
56
#include "core/gimp.h"
54
#include "app_procs.h"
58
#include "widgets/gimpdbusservice.h"
55
62
#include "errors.h"
56
63
#include "sanity.h"
59
71
#include "gimp-intl.h"
65
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
66
static void gimp_sigchld_handler (gint sig_num);
69
static void gimp_show_version (void);
70
static void gimp_show_help (const gchar *progname);
75
* Arguments are either switches, their associated
76
* values, or image files. As switches and their
77
* associated values are processed, those slots in
78
* the argv[] array are NULLed. We do this because
79
* unparsed args are treated as images to load on
82
* The GTK switches are processed first (X switches are
83
* processed here, not by any X routines). Then the
84
* general GIMP switches are processed. Any args
85
* left are assumed to be image files the GIMP should
88
* The exception is the batch switch. When this is
89
* encountered, all remaining args are treated as batch
74
static gboolean gimp_option_fatal_warnings (const gchar *option_name,
78
static gboolean gimp_option_stack_trace_mode (const gchar *option_name,
82
static gboolean gimp_option_pdb_compat_mode (const gchar *option_name,
86
static gboolean gimp_option_dump_gimprc (const gchar *option_name,
91
static void gimp_show_version_and_exit (void) G_GNUC_NORETURN;
92
static void gimp_show_license_and_exit (void) G_GNUC_NORETURN;
94
static void gimp_init_i18n (void);
95
static void gimp_init_malloc (void);
96
static void gimp_init_signal_handlers (void);
99
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
102
#if defined (G_OS_WIN32) && !defined (GIMP_CONSOLE_COMPILATION)
103
static void gimp_open_console_window (void);
105
#define gimp_open_console_window() /* as nothing */
108
static gboolean gimp_dbus_open (const gchar **filenames,
110
gboolean be_verbose);
113
static const gchar *system_gimprc = NULL;
114
static const gchar *user_gimprc = NULL;
115
static const gchar *session_name = NULL;
116
static const gchar *batch_interpreter = NULL;
117
static const gchar **batch_commands = NULL;
118
static const gchar **filenames = NULL;
119
static gboolean as_new = FALSE;
120
static gboolean no_interface = FALSE;
121
static gboolean no_data = FALSE;
122
static gboolean no_fonts = FALSE;
123
static gboolean no_splash = FALSE;
124
static gboolean be_verbose = FALSE;
125
static gboolean new_instance = FALSE;
126
#if defined (USE_SYSV_SHM) || defined (USE_POSIX_SHM) || defined (G_OS_WIN32)
127
static gboolean use_shm = TRUE;
129
static gboolean use_shm = FALSE;
131
static gboolean use_cpu_accel = TRUE;
132
static gboolean console_messages = FALSE;
133
static gboolean use_debug_handler = FALSE;
136
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
137
static GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_WARN;
139
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
140
static GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_ON;
144
static const GOptionEntry main_entries[] =
146
{ "version", 'v', G_OPTION_FLAG_NO_ARG,
147
G_OPTION_ARG_CALLBACK, (GOptionArgFunc) gimp_show_version_and_exit,
148
N_("Show version information and exit"), NULL
151
"license", 0, G_OPTION_FLAG_NO_ARG,
152
G_OPTION_ARG_CALLBACK, (GOptionArgFunc) gimp_show_license_and_exit,
153
N_("Show license information and exit"), NULL
157
G_OPTION_ARG_NONE, &be_verbose,
158
N_("Be more verbose"), NULL
161
"new-instance", 'n', 0,
162
G_OPTION_ARG_NONE, &new_instance,
163
N_("Start a new GIMP instance"), NULL
167
G_OPTION_ARG_NONE, &as_new,
168
N_("Open images as new"), NULL
171
"no-interface", 'i', 0,
172
G_OPTION_ARG_NONE, &no_interface,
173
N_("Run without a user interface"), NULL
177
G_OPTION_ARG_NONE, &no_data,
178
N_("Do not load brushes, gradients, patterns, ..."), NULL
182
G_OPTION_ARG_NONE, &no_fonts,
183
N_("Do not load any fonts"), NULL
187
G_OPTION_ARG_NONE, &no_splash,
188
N_("Do not show a startup window"), NULL
191
"no-shm", 0, G_OPTION_FLAG_REVERSE,
192
G_OPTION_ARG_NONE, &use_shm,
193
N_("Do not use shared memory between GIMP and plugins"), NULL
196
"no-cpu-accel", 0, G_OPTION_FLAG_REVERSE,
197
G_OPTION_ARG_NONE, &use_cpu_accel,
198
N_("Do not use special CPU acceleration functions"), NULL
202
G_OPTION_ARG_FILENAME, &session_name,
203
N_("Use an alternate sessionrc file"), "<name>"
207
G_OPTION_ARG_FILENAME, &user_gimprc,
208
N_("Use an alternate user gimprc file"), "<filename>"
211
"system-gimprc", 0, 0,
212
G_OPTION_ARG_FILENAME, &system_gimprc,
213
N_("Use an alternate system gimprc file"), "<filename>"
217
G_OPTION_ARG_STRING_ARRAY, &batch_commands,
218
N_("Batch command to run (can be used multiple times)"), "<command>"
221
"batch-interpreter", 0, 0,
222
G_OPTION_ARG_STRING, &batch_interpreter,
223
N_("The procedure to process batch commands with"), "<proc>"
226
"console-messages", 0, 0,
227
G_OPTION_ARG_NONE, &console_messages,
228
N_("Send messages to console instead of using a dialog"), NULL
231
"pdb-compat-mode", 0, 0,
232
G_OPTION_ARG_CALLBACK, gimp_option_pdb_compat_mode,
233
/* don't translate the mode names (off|on|warn) */
234
N_("PDB compatibility mode (off|on|warn)"), "<mode>"
237
"stack-trace-mode", 0, 0,
238
G_OPTION_ARG_CALLBACK, gimp_option_stack_trace_mode,
239
/* don't translate the mode names (never|query|always) */
240
N_("Debug in case of a crash (never|query|always)"), "<mode>"
243
"debug-handlers", 0, G_OPTION_FLAG_NO_ARG,
244
G_OPTION_ARG_NONE, &use_debug_handler,
245
N_("Enable non-fatal debugging signal handlers"), NULL
248
"g-fatal-warnings", 0, G_OPTION_FLAG_NO_ARG,
249
G_OPTION_ARG_CALLBACK, gimp_option_fatal_warnings,
250
N_("Make all warnings fatal"), NULL
253
"dump-gimprc", 0, G_OPTION_FLAG_NO_ARG,
254
G_OPTION_ARG_CALLBACK, gimp_option_dump_gimprc,
255
N_("Output a gimprc file with default settings"), NULL
258
"dump-gimprc-system", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN,
259
G_OPTION_ARG_CALLBACK, gimp_option_dump_gimprc,
263
"dump-gimprc-manpage", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN,
264
G_OPTION_ARG_CALLBACK, gimp_option_dump_gimprc,
268
G_OPTION_REMAINING, 0, 0,
269
G_OPTION_ARG_FILENAME_ARRAY, &filenames,
97
const gchar *abort_message = NULL;
98
const gchar *full_prog_name = NULL;
99
const gchar *alternate_system_gimprc = NULL;
100
const gchar *alternate_gimprc = NULL;
101
const gchar *session_name = NULL;
102
const gchar *batch_interpreter = NULL;
103
const gchar **batch_commands = NULL;
104
gboolean show_help = FALSE;
105
gboolean no_interface = FALSE;
106
gboolean no_data = FALSE;
107
gboolean no_fonts = FALSE;
108
gboolean no_splash = FALSE;
109
gboolean be_verbose = FALSE;
110
gboolean use_shm = FALSE;
111
gboolean use_cpu_accel = TRUE;
112
gboolean console_messages = FALSE;
113
gboolean use_debug_handler = FALSE;
280
GOptionContext *context;
281
GError *error = NULL;
282
const gchar *abort_message;
287
if (! g_thread_supported ())
288
g_thread_init (NULL);
114
291
#ifdef GIMP_UNSTABLE
115
GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
116
GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_WARN;
118
GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
119
GimpPDBCompatMode pdb_compat_mode = GIMP_PDB_COMPAT_ON;
124
g_mem_set_vtable (glib_mem_profiler_table);
125
g_atexit (g_mem_profile);
128
/* Initialize variables */
130
full_prog_name = argv[0];
132
/* Initialize i18n support */
134
setlocale (LC_ALL, "");
136
bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
137
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
138
bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
141
bindtextdomain (GETTEXT_PACKAGE, gimp_locale_directory ());
142
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
143
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
146
textdomain (GETTEXT_PACKAGE);
148
/* Check argv[] for "--no-interface" before trying to initialize gtk+.
149
* We also check for "--help" or "--version" here since those shouldn't
150
* require gui libs either.
292
gimp_open_console_window ();
297
gimp_env_init (FALSE);
301
g_set_application_name (GIMP_NAME);
303
basename = g_path_get_basename (argv[0]);
304
g_set_prgname (basename);
307
/* Check argv[] for "--no-interface" before trying to initialize gtk+. */
152
308
for (i = 1; i < argc; i++)
154
310
const gchar *arg = argv[i];
156
312
if (arg[0] != '-')
159
if ((strcmp (arg, "--no-interface") == 0) ||
160
(strcmp (arg, "-i") == 0))
164
else if ((strcmp (arg, "--version") == 0) ||
165
(strcmp (arg, "-v") == 0))
167
gimp_show_version ();
168
app_exit (EXIT_SUCCESS);
315
if ((strcmp (arg, "--no-interface") == 0) || (strcmp (arg, "-i") == 0))
319
else if ((strcmp (arg, "--version") == 0) || (strcmp (arg, "-v") == 0))
321
gimp_open_console_window ();
322
gimp_show_version_and_exit ();
324
#if defined (G_OS_WIN32) && !defined (GIMP_CONSOLE_COMPILATION)
170
325
else if ((strcmp (arg, "--help") == 0) ||
171
(strcmp (arg, "-h") == 0))
173
gimp_show_help (full_prog_name);
174
app_exit (EXIT_SUCCESS);
176
else if (strncmp (arg, "--dump-gimprc", 13) == 0)
326
(strcmp (arg, "-?") == 0) ||
327
(strncmp (arg, "--help-", 7) == 0))
178
GimpConfigDumpFormat format = GIMP_CONFIG_DUMP_NONE;
180
if (strcmp (arg, "--dump-gimprc") == 0)
181
format = GIMP_CONFIG_DUMP_GIMPRC;
182
if (strcmp (arg, "--dump-gimprc-system") == 0)
183
format = GIMP_CONFIG_DUMP_GIMPRC_SYSTEM;
184
else if (strcmp (arg, "--dump-gimprc-manpage") == 0)
185
format = GIMP_CONFIG_DUMP_GIMPRC_MANPAGE;
194
gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
198
success = gimp_config_dump (format);
200
g_object_unref (gimp);
202
app_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
329
gimp_open_console_window ();
207
if (! app_libs_init (&no_interface, &argc, &argv))
334
#ifdef GIMP_CONSOLE_COMPILATION
338
context = g_option_context_new (_("[FILE|URI...]"));
339
g_option_context_set_summary (context, GIMP_NAME);
341
g_option_context_add_main_entries (context, main_entries, GETTEXT_PACKAGE);
343
app_libs_init (context, no_interface);
345
if (! g_option_context_parse (context, &argc, &argv, &error))
211
msg = _("GIMP could not initialize the graphical user interface.\n"
212
"Make sure a proper setup for your display environment exists.");
213
g_print ("%s\n\n", msg);
349
gimp_open_console_window ();
350
g_print ("%s\n", error->message);
351
g_error_free (error);
356
_("GIMP could not initialize the graphical user interface.\n"
357
"Make sure a proper setup for your display environment "
215
361
app_exit (EXIT_FAILURE);
364
if (no_interface || be_verbose || console_messages || batch_commands != NULL)
365
gimp_open_console_window ();
372
if (gimp_dbus_open (filenames, as_new, be_verbose))
218
376
abort_message = sanity_check ();
219
377
if (abort_message)
220
378
app_abort (no_interface, abort_message);
222
g_set_application_name (_("The GIMP"));
224
#if defined (USE_SYSV_SHM) || defined (USE_POSIX_SHM) || defined (G_OS_WIN32)
229
/* Tweak memory allocation so that memory allocated in chunks >= 4k
230
* (64x64 pixel 1bpp tile) gets returned to the system when free'd ().
232
mallopt (M_MMAP_THRESHOLD, 64 * 64 - 1);
235
batch_commands = g_new (const gchar *, argc);
236
batch_commands[0] = NULL;
238
for (i = 1; i < argc; i++)
240
if (strcmp (argv[i], "--g-fatal-warnings") == 0)
242
GLogLevelFlags fatal_mask;
244
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
245
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
246
g_log_set_always_fatal (fatal_mask);
249
else if ((strcmp (argv[i], "--no-interface") == 0) ||
250
(strcmp (argv[i], "-i") == 0))
255
else if (strcmp (argv[i], "--batch-interpreter") == 0)
264
batch_interpreter = argv[i];
268
else if ((strcmp (argv[i], "--batch") == 0) ||
269
(strcmp (argv[i], "-b") == 0))
272
for (j = 0, i++ ; i < argc; j++, i++)
274
batch_commands[j] = argv[i];
277
batch_commands[j] = NULL;
279
/* We need at least one batch command */
280
if (batch_commands[0] == NULL)
283
else if (strcmp (argv[i], "--system-gimprc") == 0)
292
alternate_system_gimprc = argv[i];
296
else if ((strcmp (argv[i], "--gimprc") == 0) ||
297
(strcmp (argv[i], "-g") == 0))
306
alternate_gimprc = argv[i];
310
else if ((strcmp (argv[i], "--no-data") == 0) ||
311
(strcmp (argv[i], "-d") == 0))
316
else if ((strcmp (argv[i], "--no-fonts") == 0) ||
317
(strcmp (argv[i], "-f") == 0))
322
else if ((strcmp (argv[i], "--no-splash") == 0) ||
323
(strcmp (argv[i], "-s") == 0))
328
else if (strcmp (argv[i], "--verbose") == 0)
333
else if (strcmp (argv[i], "--no-shm") == 0)
338
else if (strcmp (argv[i], "--no-cpu-accel") == 0)
340
use_cpu_accel = FALSE;
343
else if (strcmp (argv[i], "--debug-handlers") == 0)
345
use_debug_handler = TRUE;
348
else if ((strcmp (argv[i], "--console-messages") == 0) ||
349
(strcmp (argv[i], "-c") == 0))
351
console_messages = TRUE;
354
else if (strcmp (argv[i], "--session") == 0)
363
session_name = argv[i];
367
else if (strcmp (argv[i], "--stack-trace-mode") == 0)
376
if (! strcmp (argv[i], "never"))
377
stack_trace_mode = GIMP_STACK_TRACE_NEVER;
378
else if (! strcmp (argv[i], "query"))
379
stack_trace_mode = GIMP_STACK_TRACE_QUERY;
380
else if (! strcmp (argv[i], "always"))
381
stack_trace_mode = GIMP_STACK_TRACE_ALWAYS;
388
else if (strcmp (argv[i], "--pdb-compat-mode") == 0)
397
if (! strcmp (argv[i], "off"))
398
pdb_compat_mode = GIMP_PDB_COMPAT_OFF;
399
else if (! strcmp (argv[i], "on"))
400
pdb_compat_mode = GIMP_PDB_COMPAT_ON;
401
else if (! strcmp (argv[i], "warn"))
402
pdb_compat_mode = GIMP_PDB_COMPAT_WARN;
409
else if (strcmp (argv[i], "--") == 0)
412
* everything after "--" is a parameter (i.e. image to load)
417
else if (argv[i][0] == '-')
420
* anything else starting with a '-' is an error.
422
g_print (_("\nInvalid option \"%s\"\n"), argv[i]);
429
gimp_show_help (full_prog_name);
430
app_exit (EXIT_FAILURE);
435
/* No use catching these on Win32, the user won't get any
436
* stack trace from glib anyhow. It's better to let Windows inform
437
* about the program error, and offer debugging (if the user
438
* has installed MSVC or some other compiler that knows how to
439
* install itself as a handler for program errors).
442
/* Handle fatal signals */
444
/* these are handled by gimp_terminate() */
445
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
446
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
447
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
448
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
449
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
451
if (stack_trace_mode != GIMP_STACK_TRACE_NEVER)
453
/* these are handled by gimp_fatal_error() */
454
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
455
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
456
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
459
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
461
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
463
/* Collect dead children */
465
gimp_signal_private (SIGCHLD, gimp_sigchld_handler, SA_RESTART);
467
#endif /* G_OS_WIN32 */
469
gimp_errors_init (full_prog_name,
473
app_run (full_prog_name,
476
alternate_system_gimprc,
380
gimp_init_signal_handlers ();
479
387
batch_interpreter,
550
419
WinMain (struct HINSTANCE__ *hInstance,
551
struct HINSTANCE__ *hPrevInstance,
420
struct HINSTANCE__ *hPrevInstance,
555
424
return main (__argc, __argv);
558
#endif /* G_OS_WIN32 */
427
#ifndef GIMP_CONSOLE_COMPILATION
430
wait_console_window (void)
432
FILE *console = fopen ("CONOUT$", "w");
434
SetConsoleTitleW (g_utf8_to_utf16 (_("GIMP output. Type any character to close this window."), -1, NULL, NULL, NULL));
435
fprintf (console, _("(Type any character to close this window)\n"));
441
gimp_open_console_window (void)
443
if (((HANDLE) _get_osfhandle (fileno (stdout)) == INVALID_HANDLE_VALUE ||
444
(HANDLE) _get_osfhandle (fileno (stderr)) == INVALID_HANDLE_VALUE) && AllocConsole ())
446
if ((HANDLE) _get_osfhandle (fileno (stdout)) == INVALID_HANDLE_VALUE)
447
freopen ("CONOUT$", "w", stdout);
449
if ((HANDLE) _get_osfhandle (fileno (stderr)) == INVALID_HANDLE_VALUE)
450
freopen ("CONOUT$", "w", stderr);
452
SetConsoleTitleW (g_utf8_to_utf16 (_("GIMP output. You can minimize this window, but don't close it."), -1, NULL, NULL, NULL));
454
atexit (wait_console_window);
459
#endif /* G_OS_WIN32 */
463
gimp_option_fatal_warnings (const gchar *option_name,
468
GLogLevelFlags fatal_mask;
470
fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
471
fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
473
g_log_set_always_fatal (fatal_mask);
479
gimp_option_stack_trace_mode (const gchar *option_name,
484
if (strcmp (value, "never") == 0)
485
stack_trace_mode = GIMP_STACK_TRACE_NEVER;
486
else if (strcmp (value, "query") == 0)
487
stack_trace_mode = GIMP_STACK_TRACE_QUERY;
488
else if (strcmp (value, "always") == 0)
489
stack_trace_mode = GIMP_STACK_TRACE_ALWAYS;
497
gimp_option_pdb_compat_mode (const gchar *option_name,
502
if (! strcmp (value, "off"))
503
pdb_compat_mode = GIMP_PDB_COMPAT_OFF;
504
else if (! strcmp (value, "on"))
505
pdb_compat_mode = GIMP_PDB_COMPAT_ON;
506
else if (! strcmp (value, "warn"))
507
pdb_compat_mode = GIMP_PDB_COMPAT_WARN;
515
gimp_option_dump_gimprc (const gchar *option_name,
520
GimpConfigDumpFormat format = GIMP_CONFIG_DUMP_NONE;
522
gimp_open_console_window ();
524
if (strcmp (option_name, "--dump-gimprc") == 0)
525
format = GIMP_CONFIG_DUMP_GIMPRC;
526
if (strcmp (option_name, "--dump-gimprc-system") == 0)
527
format = GIMP_CONFIG_DUMP_GIMPRC_SYSTEM;
528
else if (strcmp (option_name, "--dump-gimprc-manpage") == 0)
529
format = GIMP_CONFIG_DUMP_GIMPRC_MANPAGE;
536
gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
540
success = gimp_config_dump (format);
542
g_object_unref (gimp);
544
app_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
551
gimp_show_version (void)
553
gimp_open_console_window ();
554
g_print (_("%s version %s"), GIMP_NAME, GIMP_VERSION);
559
gimp_show_version_and_exit (void)
561
gimp_show_version ();
563
app_exit (EXIT_SUCCESS);
567
gimp_show_license_and_exit (void)
569
gimp_show_version ();
572
g_print (GIMP_LICENSE);
575
app_exit (EXIT_SUCCESS);
579
gimp_init_malloc (void)
581
#ifdef GIMP_GLIB_MEM_PROFILER
582
g_mem_set_vtable (glib_mem_profiler_table);
583
g_atexit (g_mem_profile);
587
/* Tweak memory allocation so that memory allocated in chunks >= 4k
588
* (64x64 pixel 1bpp tile) gets returned to the system when free()'d.
590
* The default value for M_MMAP_THRESHOLD in glibc-2.3 is 128k.
591
* This is said to be an empirically derived value that works well
592
* in most systems. Lowering it to 4k is thus probably not the ideal
595
* An alternative to tuning this parameter would be to use
596
* malloc_trim(), for example after releasing a large tile-manager.
598
* Another possibility is to switch to using GSlice as soon as this
599
* API is available in a stable GLib release.
601
mallopt (M_MMAP_THRESHOLD, TILE_WIDTH * TILE_HEIGHT);
606
gimp_init_i18n (void)
608
setlocale (LC_ALL, "");
610
bindtextdomain (GETTEXT_PACKAGE"-libgimp", gimp_locale_directory ());
611
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
612
bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8");
615
bindtextdomain (GETTEXT_PACKAGE, gimp_locale_directory ());
616
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
617
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
620
textdomain (GETTEXT_PACKAGE);
624
gimp_init_signal_handlers (void)
627
/* No use catching these on Win32, the user won't get any
628
* stack trace from glib anyhow. It's better to let Windows inform
629
* about the program error, and offer debugging (if the user
630
* has installed MSVC or some other compiler that knows how to
631
* install itself as a handler for program errors).
634
/* Handle fatal signals */
636
/* these are handled by gimp_terminate() */
637
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
638
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
639
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
640
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
641
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
643
if (stack_trace_mode != GIMP_STACK_TRACE_NEVER)
645
/* these are handled by gimp_fatal_error() */
646
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
647
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
648
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
651
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
652
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
654
/* Restart syscalls on SIGCHLD */
655
gimp_signal_private (SIGCHLD, SIG_DFL, SA_RESTART);
657
#endif /* G_OS_WIN32 */
561
661
#ifndef G_OS_WIN32