[gimp] app: add a new --quit CLI option to quit GIMP after a batch script.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add a new --quit CLI option to quit GIMP after a batch script.
- Date: Fri, 15 Apr 2022 23:41:23 +0000 (UTC)
commit 028210369acd154b59ca4720a03b7a5bd70601e7
Author: Jehan <jehan girinstud io>
Date: Sat Apr 16 00:46:32 2022 +0200
app: add a new --quit CLI option to quit GIMP after a batch script.
Instead of asking for the script to call gimp_quit() which is not too
proper (because this is actually meant to exit the script, not GIMP
itself. Scripts should not have the ability to basically kill the main
GIMP process), let's add a `--quit` option which does what it says: it
quits GIMP immediately (after having processed any task on command line,
such as running batch scripts).
See discussions in issue #7376.
app/app.c | 10 ++++++++++
app/app.h | 1 +
app/main.c | 7 +++++++
3 files changed, 18 insertions(+)
---
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"), "<proc>"
},
+ {
+ "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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]