diff --git a/app/app.c b/app/app.c index 4a376e2f5d..3ac2828faf 100644 --- a/app/app.c +++ b/app/app.c @@ -169,6 +169,7 @@ app_run (const gchar *full_prog_name, const gchar *session_name, const gchar *batch_interpreter, const gchar **batch_commands, + gboolean quit, gboolean as_new, gboolean no_interface, gboolean no_data, @@ -425,6 +426,15 @@ app_run (const gchar *full_prog_name, if (run_loop) gimp_batch_run (gimp, batch_interpreter, batch_commands); + if (quit) + { + /* Return value, needed for the signal call; let's just ignore the + * result. */ + gboolean cb_retval; + + g_signal_emit_by_name (gimp, "exit", TRUE, &cb_retval); + } + if (run_loop) g_main_loop_run (loop); diff --git a/app/app.h b/app/app.h index 1ec9447210..ca9fb07150 100644 --- a/app/app.h +++ b/app/app.h @@ -37,6 +37,7 @@ void app_run (const gchar *full_prog_name, const gchar *session_name, const gchar *batch_interpreter, const gchar **batch_commands, + gboolean quit, gboolean as_new, gboolean no_interface, gboolean no_data, diff --git a/app/main.c b/app/main.c index 1fe8636ec1..af44052e30 100644 --- a/app/main.c +++ b/app/main.c @@ -129,6 +129,7 @@ static const gchar *session_name = NULL; static const gchar *batch_interpreter = NULL; static const gchar **batch_commands = NULL; static const gchar **filenames = NULL; +static gboolean quit = FALSE; static gboolean as_new = FALSE; static gboolean no_interface = FALSE; static gboolean no_data = FALSE; @@ -239,6 +240,11 @@ static const GOptionEntry main_entries[] = G_OPTION_ARG_STRING, &batch_interpreter, N_("The procedure to process batch commands with"), "" }, + { + "quit", 0, 0, + G_OPTION_ARG_NONE, &quit, + N_("Quit immediately after performing requested actions"), NULL + }, { "console-messages", 'c', 0, G_OPTION_ARG_NONE, &console_messages, @@ -788,6 +794,7 @@ main (int argc, session_name, batch_interpreter, batch_commands, + quit, as_new, no_interface, no_data,