mirror of https://github.com/GNOME/gimp.git
Made the gimp-console binary compile. Finishes core/GUI separation and
2004-07-12 Michael Natterer <mitch@gimp.org> Made the gimp-console binary compile. Finishes core/GUI separation and fixes bug #71514: * configure.in: removed the crazy-hacker warning for --enable-gimp-console. * app/Makefile.am: for gimp-console, copy app_procs.c to app_procs_console.c and compile it instead of app_procs.c with -DGIMP_CONSOLE_COMPILATION * app/app_procs.[ch]: added some #ifndef GIMP_CONSOLE_COMPILATION to skip GUI stuff for the gimp-console case. Renamed app_gui_libs_init() to app_libs_init(), renamed app_gui_abort() to app_abort() and added app_exit() so everything that needs #ifdefs lives here now. * app/main.c: changed accordingly. * app/gui/gui.c (gui_abort): really abort (call exit()).
This commit is contained in:
parent
58a91da574
commit
84c29b4861
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
||||||
|
2004-07-12 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
Made the gimp-console binary compile.
|
||||||
|
Finishes core/GUI separation and fixes bug #71514:
|
||||||
|
|
||||||
|
* configure.in: removed the crazy-hacker warning for
|
||||||
|
--enable-gimp-console.
|
||||||
|
|
||||||
|
* app/Makefile.am: for gimp-console, copy app_procs.c to
|
||||||
|
app_procs_console.c and compile it instead of app_procs.c with
|
||||||
|
-DGIMP_CONSOLE_COMPILATION
|
||||||
|
|
||||||
|
* app/app_procs.[ch]: added some #ifndef GIMP_CONSOLE_COMPILATION
|
||||||
|
to skip GUI stuff for the gimp-console case.
|
||||||
|
Renamed app_gui_libs_init() to app_libs_init(), renamed
|
||||||
|
app_gui_abort() to app_abort() and added app_exit() so everything
|
||||||
|
that needs #ifdefs lives here now.
|
||||||
|
|
||||||
|
* app/main.c: changed accordingly.
|
||||||
|
|
||||||
|
* app/gui/gui.c (gui_abort): really abort (call exit()).
|
||||||
|
|
||||||
2004-07-12 Sven Neumann <sven@gimp.org>
|
2004-07-12 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* INSTALL: made the suggestion to use binary packages more
|
* INSTALL: made the suggestion to use binary packages more
|
||||||
|
|
|
@ -4,3 +4,4 @@ makefile.mingw
|
||||||
.deps
|
.deps
|
||||||
.libs
|
.libs
|
||||||
gimp-2.1
|
gimp-2.1
|
||||||
|
app_procs_console.c
|
||||||
|
|
|
@ -35,8 +35,7 @@ else
|
||||||
bin_PROGRAMS = gimp-2.1
|
bin_PROGRAMS = gimp-2.1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
gimp_2_1_SOURCES = \
|
COMMON_SOURCES = \
|
||||||
app_procs.c \
|
|
||||||
app_procs.h \
|
app_procs.h \
|
||||||
main.c \
|
main.c \
|
||||||
batch.c \
|
batch.c \
|
||||||
|
@ -49,11 +48,18 @@ gimp_2_1_SOURCES = \
|
||||||
units.h \
|
units.h \
|
||||||
gimp-intl.h
|
gimp-intl.h
|
||||||
|
|
||||||
|
gimp_2_1_SOURCES = \
|
||||||
|
$(COMMON_SOURCES) \
|
||||||
|
app_procs.c
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
makefile.msc \
|
makefile.msc \
|
||||||
gimp.rc \
|
gimp.rc \
|
||||||
wilber.ico
|
wilber.ico
|
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
|
app_procs_console.c
|
||||||
|
|
||||||
if HAVE_GLIBC_REGEX
|
if HAVE_GLIBC_REGEX
|
||||||
REGEXREPL =
|
REGEXREPL =
|
||||||
else
|
else
|
||||||
|
@ -133,7 +139,17 @@ gimp_2_1_LDADD = \
|
||||||
$(REGEXREPL)
|
$(REGEXREPL)
|
||||||
|
|
||||||
if ENABLE_GIMP_CONSOLE
|
if ENABLE_GIMP_CONSOLE
|
||||||
gimp_console_2_1_SOURCES = $(gimp_2_1_SOURCES)
|
app_procs_console.c: $(srcdir)/app_procs.c
|
||||||
|
cp -f $(srcdir)/app_procs.c app_procs_console.c
|
||||||
|
|
||||||
|
gimp_console_2_1_SOURCES = \
|
||||||
|
$(COMMON_SOURCES) \
|
||||||
|
app_procs_console.c
|
||||||
|
|
||||||
|
gimp_console_2_1_CPPFLAGS = \
|
||||||
|
$(AM_CPPFLAGS) \
|
||||||
|
-DGIMP_CONSOLE_COMPILATION
|
||||||
|
|
||||||
gimp_console_2_1_LDFLAGS = $(gimp_2_1_LDFLAGS)
|
gimp_console_2_1_LDFLAGS = $(gimp_2_1_LDFLAGS)
|
||||||
|
|
||||||
gimp_console_2_1_LDADD = \
|
gimp_console_2_1_LDADD = \
|
||||||
|
|
|
@ -47,8 +47,10 @@
|
||||||
|
|
||||||
#include "tools/gimp-tools.h"
|
#include "tools/gimp-tools.h"
|
||||||
|
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
#include "gui/user-install-dialog.h"
|
#include "gui/user-install-dialog.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "app_procs.h"
|
#include "app_procs.h"
|
||||||
#include "batch.h"
|
#include "batch.h"
|
||||||
|
@ -71,16 +73,77 @@ static gboolean app_exit_after_callback (Gimp *gimp,
|
||||||
/* public functions */
|
/* public functions */
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
app_gui_libs_init (gint *argc,
|
app_libs_init (gboolean *no_interface,
|
||||||
gchar ***argv)
|
gint *argc,
|
||||||
|
gchar ***argv)
|
||||||
{
|
{
|
||||||
return gui_libs_init (argc, argv);
|
#ifdef GIMP_CONSOLE_COMPILATION
|
||||||
|
*no_interface = TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (*no_interface)
|
||||||
|
{
|
||||||
|
gchar *basename;
|
||||||
|
|
||||||
|
basename = g_path_get_basename ((*argv)[0]);
|
||||||
|
g_set_prgname (basename);
|
||||||
|
g_free (basename);
|
||||||
|
|
||||||
|
g_type_init ();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return gui_libs_init (argc, argv);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
app_gui_abort (const gchar *abort_message)
|
app_abort (gboolean no_interface,
|
||||||
|
const gchar *abort_message)
|
||||||
{
|
{
|
||||||
gui_abort (abort_message);
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
|
if (no_interface)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
g_print ("%s\n\n", abort_message);
|
||||||
|
}
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gui_abort (abort_message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
app_exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
app_exit (gint status)
|
||||||
|
{
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
/* Give them time to read the message if it was printed in a
|
||||||
|
* separate console window. I would really love to have
|
||||||
|
* some way of asking for confirmation to close the console
|
||||||
|
* window.
|
||||||
|
*/
|
||||||
|
HANDLE console;
|
||||||
|
DWORD mode;
|
||||||
|
|
||||||
|
console = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||||
|
if (GetConsoleMode (console, &mode) != 0)
|
||||||
|
{
|
||||||
|
g_print (_("(This console window will close in ten seconds)\n"));
|
||||||
|
Sleep(10000);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -182,7 +245,9 @@ app_run (const gchar *full_prog_name,
|
||||||
{
|
{
|
||||||
/* not properly installed */
|
/* not properly installed */
|
||||||
|
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
if (no_interface)
|
if (no_interface)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
const gchar *msg;
|
const gchar *msg;
|
||||||
|
|
||||||
|
@ -190,14 +255,16 @@ app_run (const gchar *full_prog_name,
|
||||||
"User installation was skipped because the '--no-interface' flag was used.\n"
|
"User installation was skipped because the '--no-interface' flag was used.\n"
|
||||||
"To perform user installation, run the GIMP without the '--no-interface' flag.");
|
"To perform user installation, run the GIMP without the '--no-interface' flag.");
|
||||||
|
|
||||||
g_print ("%s\n\n", msg);
|
g_printerr ("%s\n\n", msg);
|
||||||
}
|
}
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user_install_dialog_run (alternate_system_gimprc,
|
user_install_dialog_run (alternate_system_gimprc,
|
||||||
alternate_gimprc,
|
alternate_gimprc,
|
||||||
be_verbose);
|
be_verbose);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_load_config (gimp, alternate_system_gimprc, alternate_gimprc);
|
gimp_load_config (gimp, alternate_system_gimprc, alternate_gimprc);
|
||||||
|
@ -205,8 +272,10 @@ app_run (const gchar *full_prog_name,
|
||||||
/* initialize lowlevel stuff */
|
/* initialize lowlevel stuff */
|
||||||
swap_is_ok = base_init (GIMP_BASE_CONFIG (gimp->config), use_cpu_accel);
|
swap_is_ok = base_init (GIMP_BASE_CONFIG (gimp->config), use_cpu_accel);
|
||||||
|
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
if (! no_interface)
|
if (! no_interface)
|
||||||
update_status_func = gui_init (gimp, no_splash);
|
update_status_func = gui_init (gimp, no_splash);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (! update_status_func)
|
if (! update_status_func)
|
||||||
update_status_func = app_init_update_none;
|
update_status_func = app_init_update_none;
|
||||||
|
@ -293,8 +362,10 @@ app_run (const gchar *full_prog_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef GIMP_CONSOLE_COMPILATION
|
||||||
if (! no_interface)
|
if (! no_interface)
|
||||||
gui_post_init (gimp);
|
gui_post_init (gimp);
|
||||||
|
#endif
|
||||||
|
|
||||||
batch_run (gimp, batch_cmds);
|
batch_run (gimp, batch_cmds);
|
||||||
|
|
||||||
|
|
|
@ -25,27 +25,30 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
gboolean app_gui_libs_init (gint *gimp_argc,
|
gboolean app_libs_init (gboolean *no_interface,
|
||||||
gchar ***gimp_argv);
|
gint *gimp_argc,
|
||||||
void app_gui_abort (const gchar *abort_message);
|
gchar ***gimp_argv);
|
||||||
|
void app_abort (gboolean no_interface,
|
||||||
|
const gchar *abort_message) G_GNUC_NORETURN;
|
||||||
|
void app_exit (gint status) G_GNUC_NORETURN;
|
||||||
|
|
||||||
void app_run (const gchar *full_prog_name,
|
void app_run (const gchar *full_prog_name,
|
||||||
gint gimp_argc,
|
gint gimp_argc,
|
||||||
gchar **gimp_argv,
|
gchar **gimp_argv,
|
||||||
const gchar *alternate_system_gimprc,
|
const gchar *alternate_system_gimprc,
|
||||||
const gchar *alternate_gimprc,
|
const gchar *alternate_gimprc,
|
||||||
const gchar *session_name,
|
const gchar *session_name,
|
||||||
const gchar **batch_cmds,
|
const gchar **batch_cmds,
|
||||||
gboolean no_interface,
|
gboolean no_interface,
|
||||||
gboolean no_data,
|
gboolean no_data,
|
||||||
gboolean no_fonts,
|
gboolean no_fonts,
|
||||||
gboolean no_splash,
|
gboolean no_splash,
|
||||||
gboolean be_verbose,
|
gboolean be_verbose,
|
||||||
gboolean use_shm,
|
gboolean use_shm,
|
||||||
gboolean use_cpu_accel,
|
gboolean use_cpu_accel,
|
||||||
gboolean console_messages,
|
gboolean console_messages,
|
||||||
GimpStackTraceMode stack_trace_mode,
|
GimpStackTraceMode stack_trace_mode,
|
||||||
GimpPDBCompatMode pdb_compat_mode);
|
GimpPDBCompatMode pdb_compat_mode);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __APP_PROCS_H__ */
|
#endif /* __APP_PROCS_H__ */
|
||||||
|
|
|
@ -133,10 +133,7 @@ gui_libs_init (gint *argc,
|
||||||
|
|
||||||
abort_message = gui_sanity_check ();
|
abort_message = gui_sanity_check ();
|
||||||
if (abort_message)
|
if (abort_message)
|
||||||
{
|
gui_abort (abort_message);
|
||||||
gui_abort (abort_message);
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gimp_widgets_init (gui_help_func,
|
gimp_widgets_init (gui_help_func,
|
||||||
gui_get_foreground_func,
|
gui_get_foreground_func,
|
||||||
|
@ -156,6 +153,7 @@ gui_abort (const gchar *abort_message)
|
||||||
gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, abort_message,
|
gimp_message_box (GIMP_STOCK_WILBER_EEK, NULL, abort_message,
|
||||||
(GtkCallback) gtk_main_quit, NULL);
|
(GtkCallback) gtk_main_quit, NULL);
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpInitStatusFunc
|
GimpInitStatusFunc
|
||||||
|
|
66
app/main.c
66
app/main.c
|
@ -62,14 +62,12 @@
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
|
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
|
||||||
static void gimp_sigchld_handler (gint sig_num);
|
static void gimp_sigchld_handler (gint sig_num);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void gimp_show_version (void);
|
||||||
static void gimp_show_version (void);
|
static void gimp_show_help (const gchar *progname);
|
||||||
static void gimp_show_help (const gchar *progname);
|
|
||||||
static void gimp_text_console_exit (gint status) G_GNUC_NORETURN;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -166,13 +164,13 @@ main (int argc,
|
||||||
(strcmp (arg, "-v") == 0))
|
(strcmp (arg, "-v") == 0))
|
||||||
{
|
{
|
||||||
gimp_show_version ();
|
gimp_show_version ();
|
||||||
gimp_text_console_exit (EXIT_SUCCESS);
|
app_exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else if ((strcmp (arg, "--help") == 0) ||
|
else if ((strcmp (arg, "--help") == 0) ||
|
||||||
(strcmp (arg, "-h") == 0))
|
(strcmp (arg, "-h") == 0))
|
||||||
{
|
{
|
||||||
gimp_show_help (full_prog_name);
|
gimp_show_help (full_prog_name);
|
||||||
gimp_text_console_exit (EXIT_SUCCESS);
|
app_exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else if (strncmp (arg, "--dump-gimprc", 13) == 0)
|
else if (strncmp (arg, "--dump-gimprc", 13) == 0)
|
||||||
{
|
{
|
||||||
|
@ -200,22 +198,12 @@ main (int argc,
|
||||||
|
|
||||||
g_object_unref (gimp);
|
g_object_unref (gimp);
|
||||||
|
|
||||||
gimp_text_console_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
|
app_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_interface)
|
if (! app_libs_init (&no_interface, &argc, &argv))
|
||||||
{
|
|
||||||
gchar *basename;
|
|
||||||
|
|
||||||
basename = g_path_get_basename (argv[0]);
|
|
||||||
g_set_prgname (basename);
|
|
||||||
g_free (basename);
|
|
||||||
|
|
||||||
g_type_init ();
|
|
||||||
}
|
|
||||||
else if (! app_gui_libs_init (&argc, &argv))
|
|
||||||
{
|
{
|
||||||
const gchar *msg;
|
const gchar *msg;
|
||||||
|
|
||||||
|
@ -223,20 +211,12 @@ main (int argc,
|
||||||
"Make sure a proper setup for your display environment exists.");
|
"Make sure a proper setup for your display environment exists.");
|
||||||
g_print ("%s\n\n", msg);
|
g_print ("%s\n\n", msg);
|
||||||
|
|
||||||
gimp_text_console_exit (EXIT_FAILURE);
|
app_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
abort_message = sanity_check ();
|
abort_message = sanity_check ();
|
||||||
|
|
||||||
if (abort_message)
|
if (abort_message)
|
||||||
{
|
app_abort (no_interface, abort_message);
|
||||||
if (no_interface)
|
|
||||||
g_print ("%s\n\n", abort_message);
|
|
||||||
else
|
|
||||||
app_gui_abort (abort_message);
|
|
||||||
|
|
||||||
exit (EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_set_application_name (_("The GIMP"));
|
g_set_application_name (_("The GIMP"));
|
||||||
|
|
||||||
|
@ -442,7 +422,7 @@ main (int argc,
|
||||||
if (show_help)
|
if (show_help)
|
||||||
{
|
{
|
||||||
gimp_show_help (full_prog_name);
|
gimp_show_help (full_prog_name);
|
||||||
gimp_text_console_exit (EXIT_FAILURE);
|
app_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
|
@ -548,30 +528,6 @@ gimp_show_help (const gchar *progname)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_text_console_exit (gint status)
|
|
||||||
{
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
/* Give them time to read the message if it was printed in a
|
|
||||||
* separate console window. I would really love to have
|
|
||||||
* some way of asking for confirmation to close the console
|
|
||||||
* window.
|
|
||||||
*/
|
|
||||||
HANDLE console;
|
|
||||||
DWORD mode;
|
|
||||||
|
|
||||||
console = GetStdHandle (STD_OUTPUT_HANDLE);
|
|
||||||
if (GetConsoleMode (console, &mode) != 0)
|
|
||||||
{
|
|
||||||
g_print (_("(This console window will close in ten seconds)\n"));
|
|
||||||
Sleep(10000);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit (status);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
/* In case we build this as a windowed application */
|
/* In case we build this as a windowed application */
|
||||||
|
|
|
@ -1427,14 +1427,6 @@ AC_ARG_ENABLE(gimp-console, [ --enable-gimp-console build a console-only bina
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_GIMP_CONSOLE, test x$enable_gimp_console = xyes)
|
AM_CONDITIONAL(ENABLE_GIMP_CONSOLE, test x$enable_gimp_console = xyes)
|
||||||
|
|
||||||
if test x$enable_gimp_console = xyes ; then
|
|
||||||
AC_MSG_WARN([--enable-gimp-console... are you nuts?
|
|
||||||
***
|
|
||||||
*** --enable-gimp-console is for crazy hackers only!
|
|
||||||
*** The build will fail badly in the app/ directory.
|
|
||||||
*** You have been warned ;)
|
|
||||||
***])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Possibly change default gimpdir from .gimp-major.minor
|
dnl Possibly change default gimpdir from .gimp-major.minor
|
||||||
gimpdir=.gimp-gimp_user_version
|
gimpdir=.gimp-gimp_user_version
|
||||||
|
|
Loading…
Reference in New Issue