From cb8e16aae8302021b4254dbbb4e8d4a1058ddadd Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 30 Sep 2015 01:57:33 +0200 Subject: [PATCH] app: move app/batch.[ch] to app/core/gimp-batch.[ch] There is no reason batch processing should be considered "glue code". --- app/Makefile.am | 2 -- app/app.c | 4 +-- app/core/Makefile.am | 2 ++ app/{batch.c => core/gimp-batch.c} | 49 +++++++++++++++--------------- app/{batch.h => core/gimp-batch.h} | 16 ++++------ app/gui/gimpdbusservice.c | 11 ++----- po/POTFILES.in | 2 +- 7 files changed, 38 insertions(+), 48 deletions(-) rename app/{batch.c => core/gimp-batch.c} (79%) rename app/{batch.h => core/gimp-batch.h} (71%) diff --git a/app/Makefile.am b/app/Makefile.am index 3e98c3169d..38f220be9e 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -47,8 +47,6 @@ libapp_sources = \ about.h \ app.c \ app.h \ - batch.c \ - batch.h \ errors.c \ errors.h \ language.c \ diff --git a/app/app.c b/app/app.c index 22f0a6f168..8438c9710d 100644 --- a/app/app.c +++ b/app/app.c @@ -48,6 +48,7 @@ #include "gegl/gimp-gegl.h" #include "core/gimp.h" +#include "core/gimp-batch.h" #include "core/gimp-user-install.h" #include "file/file-open.h" @@ -59,7 +60,6 @@ #endif #include "app.h" -#include "batch.h" #include "errors.h" #include "units.h" #include "language.h" @@ -301,7 +301,7 @@ app_run (const gchar *full_prog_name, } if (run_loop) - batch_run (gimp, batch_interpreter, batch_commands); + gimp_batch_run (gimp, batch_interpreter, batch_commands); if (run_loop) { diff --git a/app/core/Makefile.am b/app/core/Makefile.am index 69fd8e7858..3c6a2337aa 100644 --- a/app/core/Makefile.am +++ b/app/core/Makefile.am @@ -28,6 +28,8 @@ libappcore_a_sources = \ core-types.h \ gimp.c \ gimp.h \ + gimp-batch.c \ + gimp-batch.h \ gimp-cairo.c \ gimp-cairo.h \ gimp-contexts.c \ diff --git a/app/batch.c b/app/core/gimp-batch.c similarity index 79% rename from app/batch.c rename to app/core/gimp-batch.c index 22a5cfba6c..eaabf1a828 100644 --- a/app/batch.c +++ b/app/core/gimp-batch.c @@ -25,12 +25,11 @@ #include "libgimpbase/gimpbase.h" -#include "core/core-types.h" +#include "core-types.h" -#include "core/gimp.h" -#include "core/gimpparamspecs.h" - -#include "batch.h" +#include "gimp.h" +#include "gimp-batch.h" +#include "gimpparamspecs.h" #include "pdb/gimppdb.h" #include "pdb/gimpprocedure.h" @@ -41,19 +40,19 @@ #define BATCH_DEFAULT_EVAL_PROC "plug-in-script-fu-eval" -static void batch_exit_after_callback (Gimp *gimp) G_GNUC_NORETURN; +static void gimp_batch_exit_after_callback (Gimp *gimp) G_GNUC_NORETURN; -static void batch_run_cmd (Gimp *gimp, - const gchar *proc_name, - GimpProcedure *procedure, - GimpRunMode run_mode, - const gchar *cmd); +static void gimp_batch_run_cmd (Gimp *gimp, + const gchar *proc_name, + GimpProcedure *procedure, + GimpRunMode run_mode, + const gchar *cmd); void -batch_run (Gimp *gimp, - const gchar *batch_interpreter, - const gchar **batch_commands) +gimp_batch_run (Gimp *gimp, + const gchar *batch_interpreter, + const gchar **batch_commands) { gulong exit_id; @@ -61,7 +60,7 @@ batch_run (Gimp *gimp, return; exit_id = g_signal_connect_after (gimp, "exit", - G_CALLBACK (batch_exit_after_callback), + G_CALLBACK (gimp_batch_exit_after_callback), NULL); if (! batch_interpreter) @@ -88,8 +87,8 @@ batch_run (Gimp *gimp, proc_name); if (procedure) - batch_run_cmd (gimp, proc_name, procedure, - GIMP_RUN_NONINTERACTIVE, NULL); + gimp_batch_run_cmd (gimp, proc_name, procedure, + GIMP_RUN_NONINTERACTIVE, NULL); else g_message (_("The batch interpreter '%s' is not available. " "Batch mode disabled."), proc_name); @@ -104,8 +103,8 @@ batch_run (Gimp *gimp, gint i; for (i = 0; batch_commands[i]; i++) - batch_run_cmd (gimp, batch_interpreter, eval_proc, - GIMP_RUN_NONINTERACTIVE, batch_commands[i]); + gimp_batch_run_cmd (gimp, batch_interpreter, eval_proc, + GIMP_RUN_NONINTERACTIVE, batch_commands[i]); } else { @@ -125,7 +124,7 @@ batch_run (Gimp *gimp, * and gimp would hang forever. */ static void -batch_exit_after_callback (Gimp *gimp) +gimp_batch_exit_after_callback (Gimp *gimp) { if (gimp->be_verbose) g_print ("EXIT: %s\n", G_STRFUNC); @@ -136,11 +135,11 @@ batch_exit_after_callback (Gimp *gimp) } static void -batch_run_cmd (Gimp *gimp, - const gchar *proc_name, - GimpProcedure *procedure, - GimpRunMode run_mode, - const gchar *cmd) +gimp_batch_run_cmd (Gimp *gimp, + const gchar *proc_name, + GimpProcedure *procedure, + GimpRunMode run_mode, + const gchar *cmd) { GimpValueArray *args; GimpValueArray *return_vals; diff --git a/app/batch.h b/app/core/gimp-batch.h similarity index 71% rename from app/batch.h rename to app/core/gimp-batch.h index 9f576a1565..2abaad09c7 100644 --- a/app/batch.h +++ b/app/core/gimp-batch.h @@ -15,17 +15,13 @@ * along with this program. If not, see . */ -#ifndef __BATCH_H__ -#define __BATCH_H__ - -#ifndef GIMP_APP_GLUE_COMPILATION -#error You must not #include "batch.h" from an app/ subdir -#endif +#ifndef __GIMP_BATCH_H__ +#define __GIMP_BATCH_H__ -void batch_run (Gimp *gimp, - const gchar *batch_interpreter, - const gchar **batch_commands); +void gimp_batch_run (Gimp *gimp, + const gchar *batch_interpreter, + const gchar **batch_commands); -#endif /* __BATCH_H__ */ +#endif /* __GIMP_BATCH_H__ */ diff --git a/app/gui/gimpdbusservice.c b/app/gui/gimpdbusservice.c index 4bcdd5c045..d89c589fd0 100644 --- a/app/gui/gimpdbusservice.c +++ b/app/gui/gimpdbusservice.c @@ -27,6 +27,7 @@ #include "gui-types.h" #include "core/gimp.h" +#include "core/gimp-batch.h" #include "core/gimpcontainer.h" #include "file/file-open.h" @@ -34,12 +35,6 @@ #include "display/gimpdisplay.h" #include "display/gimpdisplayshell.h" -/* Dirty hack since we are not supposed to include batch.h - * from an app/ subdir. DBus is a special case. */ -#define GIMP_APP_GLUE_COMPILATION -#include "batch.h" -#undef GIMP_APP_GLUE_COMPILATION - #include "gimpdbusservice.h" @@ -349,8 +344,8 @@ gimp_dbus_service_process_idle (GimpDBusService *service) { const gchar *commands[2] = {data->command, 0}; - batch_run (service->gimp, data->interpreter, - commands); + gimp_batch_run (service->gimp, data->interpreter, + commands); } gimp_dbus_service_idle_data_free (data); diff --git a/po/POTFILES.in b/po/POTFILES.in index 9d12d156f2..8db881edab 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -8,7 +8,6 @@ desktop/gimp.desktop.in.in app/about.h app/app.c -app/batch.c app/language.c app/main.c app/sanity.c @@ -95,6 +94,7 @@ app/config/gimprc-deserialize.c app/core/core-enums.c app/core/gimp.c +app/core/gimp-batch.c app/core/gimp-contexts.c app/core/gimp-edit.c app/core/gimp-gradients.c