Commit 84c29b48 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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()).
parent 58a91da5
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>
* INSTALL: made the suggestion to use binary packages more
......
......@@ -4,3 +4,4 @@ makefile.mingw
.deps
.libs
gimp-2.1
app_procs_console.c
......@@ -35,8 +35,7 @@ else
bin_PROGRAMS = gimp-2.1
endif
gimp_2_1_SOURCES = \
app_procs.c \
COMMON_SOURCES = \
app_procs.h \
main.c \
batch.c \
......@@ -49,11 +48,18 @@ gimp_2_1_SOURCES = \
units.h \
gimp-intl.h
gimp_2_1_SOURCES = \
$(COMMON_SOURCES) \
app_procs.c
EXTRA_DIST = \
makefile.msc \
gimp.rc \
wilber.ico
CLEANFILES = \
app_procs_console.c
if HAVE_GLIBC_REGEX
REGEXREPL =
else
......@@ -133,7 +139,17 @@ gimp_2_1_LDADD = \
$(REGEXREPL)
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_LDADD = \
......
......@@ -47,8 +47,10 @@
#include "tools/gimp-tools.h"
#ifndef GIMP_CONSOLE_COMPILATION
#include "gui/gui.h"
#include "gui/user-install-dialog.h"
#endif
#include "app_procs.h"
#include "batch.h"
......@@ -71,16 +73,77 @@ static gboolean app_exit_after_callback (Gimp *gimp,
/* public functions */
gboolean
app_gui_libs_init (gint *argc,
gchar ***argv)
app_libs_init (gboolean *no_interface,
gint *argc,
gchar ***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
app_abort (gboolean no_interface,
const gchar *abort_message)
{
return gui_libs_init (argc, argv);
#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_gui_abort (const gchar *abort_message)
app_exit (gint status)
{
gui_abort (abort_message);
#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
......@@ -182,7 +245,9 @@ app_run (const gchar *full_prog_name,
{
/* not properly installed */
#ifndef GIMP_CONSOLE_COMPILATION
if (no_interface)
#endif
{
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"
"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
{
user_install_dialog_run (alternate_system_gimprc,
alternate_gimprc,
be_verbose);
}
#endif
}
gimp_load_config (gimp, alternate_system_gimprc, alternate_gimprc);
......@@ -205,8 +272,10 @@ app_run (const gchar *full_prog_name,
/* initialize lowlevel stuff */
swap_is_ok = base_init (GIMP_BASE_CONFIG (gimp->config), use_cpu_accel);
#ifndef GIMP_CONSOLE_COMPILATION
if (! no_interface)
update_status_func = gui_init (gimp, no_splash);
#endif
if (! update_status_func)
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)
gui_post_init (gimp);
#endif
batch_run (gimp, batch_cmds);
......
......@@ -25,27 +25,30 @@
#endif
gboolean app_gui_libs_init (gint *gimp_argc,
gchar ***gimp_argv);
void app_gui_abort (const gchar *abort_message);
void app_run (const gchar *full_prog_name,
gint gimp_argc,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
gboolean no_fonts,
gboolean no_splash,
gboolean be_verbose,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode);
gboolean app_libs_init (gboolean *no_interface,
gint *gimp_argc,
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,
gint gimp_argc,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
gboolean no_fonts,
gboolean no_splash,
gboolean be_verbose,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode,
GimpPDBCompatMode pdb_compat_mode);
#endif /* __APP_PROCS_H__ */
......@@ -133,10 +133,7 @@ gui_libs_init (gint *argc,
abort_message = gui_sanity_check ();
if (abort_message)
{
gui_abort (abort_message);
exit (EXIT_FAILURE);
}
gui_abort (abort_message);
gimp_widgets_init (gui_help_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,
(GtkCallback) gtk_main_quit, NULL);
gtk_main ();
exit (EXIT_FAILURE);
}
GimpInitStatusFunc
......
......@@ -62,14 +62,12 @@
#ifdef G_OS_WIN32
#include <windows.h>
#else
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
static void gimp_sigchld_handler (gint sig_num);
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
static void gimp_sigchld_handler (gint sig_num);
#endif
static void gimp_show_version (void);
static void gimp_show_help (const gchar *progname);
static void gimp_text_console_exit (gint status) G_GNUC_NORETURN;
static void gimp_show_version (void);
static void gimp_show_help (const gchar *progname);
/*
......@@ -166,13 +164,13 @@ main (int argc,
(strcmp (arg, "-v") == 0))
{
gimp_show_version ();
gimp_text_console_exit (EXIT_SUCCESS);
app_exit (EXIT_SUCCESS);
}
else if ((strcmp (arg, "--help") == 0) ||
(strcmp (arg, "-h") == 0))
{
gimp_show_help (full_prog_name);
gimp_text_console_exit (EXIT_SUCCESS);
app_exit (EXIT_SUCCESS);
}
else if (strncmp (arg, "--dump-gimprc", 13) == 0)
{
......@@ -200,22 +198,12 @@ main (int argc,
g_object_unref (gimp);
gimp_text_console_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
app_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
}
}
}
if (no_interface)
{
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))
if (! app_libs_init (&no_interface, &argc, &argv))
{
const gchar *msg;
......@@ -223,20 +211,12 @@ main (int argc,
"Make sure a proper setup for your display environment exists.");
g_print ("%s\n\n", msg);
gimp_text_console_exit (EXIT_FAILURE);
app_exit (EXIT_FAILURE);
}
abort_message = sanity_check ();
if (abort_message)
{
if (no_interface)
g_print ("%s\n\n", abort_message);
else
app_gui_abort (abort_message);
exit (EXIT_FAILURE);
}
app_abort (no_interface, abort_message);
g_set_application_name (_("The GIMP"));
......@@ -442,7 +422,7 @@ main (int argc,
if (show_help)
{
gimp_show_help (full_prog_name);
gimp_text_console_exit (EXIT_FAILURE);
app_exit (EXIT_FAILURE);
}
#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
/* 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)
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
gimpdir=.gimp-gimp_user_version
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment