mirror of https://github.com/GNOME/gimp.git
Got rid of the last global variables except the_gimp:
2003-09-09 Michael Natterer <mitch@gimp.org> Got rid of the last global variables except the_gimp: * app/Makefile.am * app/appenv.h: removed this file. * app/errors.[ch] (gimp_errors_init): new function which lets the error system know about "full_prog_name", "stack_trace_mode" and "debug_handlers". Remember these values privately. * app/app_procs.[ch] (app_init): added "full_prog_name" and "stack_trace_mode" parameters here too. * app/main.c (main): call gimp_errors_init() and pass the additional parameters to app_init().
This commit is contained in:
parent
8ca0050a52
commit
85dfbe46c2
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2003-09-09 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Got rid of the last global variables except the_gimp:
|
||||
|
||||
* app/Makefile.am
|
||||
* app/appenv.h: removed this file.
|
||||
|
||||
* app/errors.[ch] (gimp_errors_init): new function which lets the
|
||||
error system know about "full_prog_name", "stack_trace_mode" and
|
||||
"debug_handlers". Remember these values privately.
|
||||
|
||||
* app/app_procs.[ch] (app_init): added "full_prog_name" and
|
||||
"stack_trace_mode" parameters here too.
|
||||
|
||||
* app/main.c (main): call gimp_errors_init() and pass the
|
||||
additional parameters to app_init().
|
||||
|
||||
2003-09-09 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/vectors/gimpvectors-compat.[ch]: Made
|
||||
|
|
|
@ -27,7 +27,6 @@ scriptdata =
|
|||
bin_PROGRAMS = gimp-1.3
|
||||
|
||||
gimp_1_3_SOURCES = \
|
||||
appenv.h \
|
||||
app_procs.c \
|
||||
app_procs.h \
|
||||
main.c \
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include "gui/splash.h"
|
||||
#include "gui/user-install-dialog.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "batch.h"
|
||||
#include "errors.h"
|
||||
|
@ -80,14 +79,6 @@ static gboolean app_exit_finish_callback (Gimp *gimp,
|
|||
|
||||
Gimp *the_gimp = NULL;
|
||||
|
||||
/* command-line options */
|
||||
|
||||
gboolean use_debug_handler = FALSE;
|
||||
GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
|
||||
|
||||
/* other global variables */
|
||||
gchar *prog_name = NULL; /* our executable name */
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
@ -99,20 +90,22 @@ app_gui_libs_init (gint *argc,
|
|||
}
|
||||
|
||||
void
|
||||
app_init (gint gimp_argc,
|
||||
gchar **gimp_argv,
|
||||
const gchar *alternate_system_gimprc,
|
||||
const gchar *alternate_gimprc,
|
||||
const gchar **batch_cmds,
|
||||
gboolean no_interface,
|
||||
gboolean no_data,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_mmx,
|
||||
gboolean console_messages,
|
||||
gboolean restore_session)
|
||||
app_init (const gchar *full_prog_name,
|
||||
gint gimp_argc,
|
||||
gchar **gimp_argv,
|
||||
const gchar *alternate_system_gimprc,
|
||||
const gchar *alternate_gimprc,
|
||||
const gchar **batch_cmds,
|
||||
gboolean no_interface,
|
||||
gboolean no_data,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_mmx,
|
||||
gboolean console_messages,
|
||||
GimpStackTraceMode stack_trace_mode,
|
||||
gboolean restore_session)
|
||||
{
|
||||
GimpInitStatusFunc update_status_func;
|
||||
const gchar *gimp_dir;
|
||||
|
@ -133,7 +126,7 @@ app_init (gint gimp_argc,
|
|||
console_messages,
|
||||
stack_trace_mode);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (the_gimp), prog_name);
|
||||
gimp_object_set_name (GIMP_OBJECT (the_gimp), full_prog_name);
|
||||
|
||||
g_log_set_handler ("Gimp",
|
||||
G_LOG_LEVEL_MESSAGE,
|
||||
|
|
|
@ -37,20 +37,22 @@ extern Gimp *the_gimp;
|
|||
gboolean app_gui_libs_init (gint *gimp_argc,
|
||||
gchar ***gimp_argv);
|
||||
|
||||
void app_init (gint gimp_argc,
|
||||
gchar **gimp_argv,
|
||||
const gchar *alternate_system_gimprc,
|
||||
const gchar *alternate_gimprc,
|
||||
const gchar **batch_cmds,
|
||||
gboolean no_interface,
|
||||
gboolean no_data,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_mmx,
|
||||
gboolean console_messages,
|
||||
gboolean restore_session);
|
||||
void app_init (const gchar *full_prog_name,
|
||||
gint gimp_argc,
|
||||
gchar **gimp_argv,
|
||||
const gchar *alternate_system_gimprc,
|
||||
const gchar *alternate_gimprc,
|
||||
const gchar **batch_cmds,
|
||||
gboolean no_interface,
|
||||
gboolean no_data,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_mmx,
|
||||
gboolean console_messages,
|
||||
GimpStackTraceMode stack_trace_mode,
|
||||
gboolean restore_session);
|
||||
|
||||
|
||||
#endif /* __APP_PROCS_H__ */
|
||||
|
|
35
app/appenv.h
35
app/appenv.h
|
@ -1,35 +0,0 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef __APPENV_H__
|
||||
#define __APPENV_H__
|
||||
|
||||
#ifndef GIMP_APP_GLUE_COMPILATION
|
||||
#error You must not #include "appenv.h" from an app/ subdir
|
||||
#endif
|
||||
|
||||
|
||||
/* command line options */
|
||||
extern gboolean use_debug_handler;
|
||||
extern GimpStackTraceMode stack_trace_mode;
|
||||
|
||||
/* other global variables */
|
||||
extern gchar *prog_name;
|
||||
|
||||
|
||||
#endif /* __APPENV_H__ */
|
27
app/errors.c
27
app/errors.c
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "errors.h"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
@ -40,6 +39,12 @@
|
|||
#endif
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static gboolean use_debug_handler = FALSE;
|
||||
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
|
||||
static gchar *full_prog_name = NULL;
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
|
@ -50,6 +55,18 @@ static void gimp_eek (const gchar *reason,
|
|||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
gimp_errors_init (const gchar *_full_prog_name,
|
||||
gboolean _use_debug_handler,
|
||||
GimpStackTraceMode _stack_trace_mode)
|
||||
{
|
||||
g_return_if_fail (_full_prog_name != NULL);
|
||||
|
||||
use_debug_handler = _use_debug_handler ? TRUE : FALSE;
|
||||
stack_trace_mode = _stack_trace_mode;
|
||||
full_prog_name = g_strdup (_full_prog_name);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_message_log_func (const gchar *log_domain,
|
||||
GLogLevelFlags flags,
|
||||
|
@ -64,7 +81,7 @@ gimp_message_log_func (const gchar *log_domain,
|
|||
return;
|
||||
}
|
||||
|
||||
g_printerr ("%s: %s\n", prog_name, message);
|
||||
g_printerr ("%s: %s\n", full_prog_name, message);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -112,7 +129,7 @@ gimp_eek (const gchar *reason,
|
|||
{
|
||||
#ifndef G_OS_WIN32
|
||||
|
||||
g_printerr ("%s: %s: %s\n", prog_name, reason, message);
|
||||
g_printerr ("%s: %s: %s\n", full_prog_name, reason, message);
|
||||
|
||||
if (use_handler)
|
||||
{
|
||||
|
@ -127,7 +144,7 @@ gimp_eek (const gchar *reason,
|
|||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_query (prog_name);
|
||||
g_on_error_query (full_prog_name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -137,7 +154,7 @@ gimp_eek (const gchar *reason,
|
|||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_stack_trace (prog_name);
|
||||
g_on_error_stack_trace (full_prog_name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
26
app/errors.h
26
app/errors.h
|
@ -24,17 +24,23 @@
|
|||
#endif
|
||||
|
||||
|
||||
void gimp_message_log_func (const gchar *log_domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *message,
|
||||
gpointer data);
|
||||
void gimp_error_log_func (const gchar *domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *message,
|
||||
gpointer data);
|
||||
void gimp_errors_init (const gchar *full_prog_name,
|
||||
gboolean use_debug_handler,
|
||||
GimpStackTraceMode stack_trace_mode);
|
||||
|
||||
void gimp_fatal_error (const gchar *, ...);
|
||||
void gimp_terminate (const gchar *, ...);
|
||||
void gimp_message_log_func (const gchar *log_domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *message,
|
||||
gpointer data);
|
||||
void gimp_error_log_func (const gchar *domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *message,
|
||||
gpointer data);
|
||||
|
||||
void gimp_fatal_error (const gchar *message,
|
||||
...);
|
||||
void gimp_terminate (const gchar *message,
|
||||
...);
|
||||
|
||||
|
||||
#endif /* __ERRORS_H__ */
|
||||
|
|
45
app/main.c
45
app/main.c
|
@ -44,7 +44,6 @@
|
|||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "appenv.h"
|
||||
#include "app_procs.h"
|
||||
#include "errors.h"
|
||||
|
||||
|
@ -88,19 +87,22 @@ int
|
|||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
gchar *alternate_system_gimprc = NULL;
|
||||
gchar *alternate_gimprc = NULL;
|
||||
gchar **batch_cmds = NULL;
|
||||
gboolean show_help = FALSE;
|
||||
gboolean no_interface = FALSE;
|
||||
gboolean no_data = FALSE;
|
||||
gboolean no_splash = FALSE;
|
||||
gboolean no_splash_image = FALSE;
|
||||
gboolean be_verbose = FALSE;
|
||||
gboolean use_shm = FALSE;
|
||||
gboolean use_mmx = TRUE;
|
||||
gboolean console_messages = FALSE;
|
||||
gboolean restore_session = FALSE;
|
||||
gchar *full_prog_name = NULL;
|
||||
gchar *alternate_system_gimprc = NULL;
|
||||
gchar *alternate_gimprc = NULL;
|
||||
gchar **batch_cmds = NULL;
|
||||
gboolean show_help = FALSE;
|
||||
gboolean no_interface = FALSE;
|
||||
gboolean no_data = FALSE;
|
||||
gboolean no_splash = FALSE;
|
||||
gboolean no_splash_image = FALSE;
|
||||
gboolean be_verbose = FALSE;
|
||||
gboolean use_shm = FALSE;
|
||||
gboolean use_mmx = TRUE;
|
||||
gboolean console_messages = FALSE;
|
||||
gboolean use_debug_handler = FALSE;
|
||||
GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_QUERY;
|
||||
gboolean restore_session = FALSE;
|
||||
gint i, j;
|
||||
|
||||
#if 0
|
||||
|
@ -110,7 +112,7 @@ main (int argc,
|
|||
|
||||
/* Initialize variables */
|
||||
|
||||
prog_name = argv[0];
|
||||
full_prog_name = argv[0];
|
||||
|
||||
/* Initialize i18n support */
|
||||
|
||||
|
@ -148,7 +150,7 @@ main (int argc,
|
|||
else if ((strcmp (argv[i], "--help") == 0) ||
|
||||
(strcmp (argv[i], "-h") == 0))
|
||||
{
|
||||
gimp_show_help (argv[0]);
|
||||
gimp_show_help (full_prog_name);
|
||||
gimp_text_console_exit (FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -337,7 +339,7 @@ main (int argc,
|
|||
|
||||
if (show_help)
|
||||
{
|
||||
gimp_show_help (argv[0]);
|
||||
gimp_show_help (full_prog_name);
|
||||
gimp_text_console_exit (TRUE);
|
||||
}
|
||||
|
||||
|
@ -377,8 +379,12 @@ main (int argc,
|
|||
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
/* Initialize the application */
|
||||
app_init (argc - 1,
|
||||
gimp_errors_init (full_prog_name,
|
||||
use_debug_handler,
|
||||
stack_trace_mode);
|
||||
|
||||
app_init (full_prog_name,
|
||||
argc - 1,
|
||||
argv + 1,
|
||||
alternate_system_gimprc,
|
||||
alternate_gimprc,
|
||||
|
@ -391,6 +397,7 @@ main (int argc,
|
|||
use_shm,
|
||||
use_mmx,
|
||||
console_messages,
|
||||
stack_trace_mode,
|
||||
restore_session);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue