app: move app/batch.[ch] to app/core/gimp-batch.[ch]
There is no reason batch processing should be considered "glue code".
This commit is contained in:
@ -47,8 +47,6 @@ libapp_sources = \
|
|||||||
about.h \
|
about.h \
|
||||||
app.c \
|
app.c \
|
||||||
app.h \
|
app.h \
|
||||||
batch.c \
|
|
||||||
batch.h \
|
|
||||||
errors.c \
|
errors.c \
|
||||||
errors.h \
|
errors.h \
|
||||||
language.c \
|
language.c \
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "gegl/gimp-gegl.h"
|
#include "gegl/gimp-gegl.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
|
#include "core/gimp-batch.h"
|
||||||
#include "core/gimp-user-install.h"
|
#include "core/gimp-user-install.h"
|
||||||
|
|
||||||
#include "file/file-open.h"
|
#include "file/file-open.h"
|
||||||
@ -59,7 +60,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "batch.h"
|
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
@ -301,7 +301,7 @@ app_run (const gchar *full_prog_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (run_loop)
|
if (run_loop)
|
||||||
batch_run (gimp, batch_interpreter, batch_commands);
|
gimp_batch_run (gimp, batch_interpreter, batch_commands);
|
||||||
|
|
||||||
if (run_loop)
|
if (run_loop)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,8 @@ libappcore_a_sources = \
|
|||||||
core-types.h \
|
core-types.h \
|
||||||
gimp.c \
|
gimp.c \
|
||||||
gimp.h \
|
gimp.h \
|
||||||
|
gimp-batch.c \
|
||||||
|
gimp-batch.h \
|
||||||
gimp-cairo.c \
|
gimp-cairo.c \
|
||||||
gimp-cairo.h \
|
gimp-cairo.h \
|
||||||
gimp-contexts.c \
|
gimp-contexts.c \
|
||||||
|
@ -25,12 +25,11 @@
|
|||||||
|
|
||||||
#include "libgimpbase/gimpbase.h"
|
#include "libgimpbase/gimpbase.h"
|
||||||
|
|
||||||
#include "core/core-types.h"
|
#include "core-types.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "gimp.h"
|
||||||
#include "core/gimpparamspecs.h"
|
#include "gimp-batch.h"
|
||||||
|
#include "gimpparamspecs.h"
|
||||||
#include "batch.h"
|
|
||||||
|
|
||||||
#include "pdb/gimppdb.h"
|
#include "pdb/gimppdb.h"
|
||||||
#include "pdb/gimpprocedure.h"
|
#include "pdb/gimpprocedure.h"
|
||||||
@ -41,19 +40,19 @@
|
|||||||
#define BATCH_DEFAULT_EVAL_PROC "plug-in-script-fu-eval"
|
#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,
|
static void gimp_batch_run_cmd (Gimp *gimp,
|
||||||
const gchar *proc_name,
|
const gchar *proc_name,
|
||||||
GimpProcedure *procedure,
|
GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
const gchar *cmd);
|
const gchar *cmd);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
batch_run (Gimp *gimp,
|
gimp_batch_run (Gimp *gimp,
|
||||||
const gchar *batch_interpreter,
|
const gchar *batch_interpreter,
|
||||||
const gchar **batch_commands)
|
const gchar **batch_commands)
|
||||||
{
|
{
|
||||||
gulong exit_id;
|
gulong exit_id;
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ batch_run (Gimp *gimp,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
exit_id = g_signal_connect_after (gimp, "exit",
|
exit_id = g_signal_connect_after (gimp, "exit",
|
||||||
G_CALLBACK (batch_exit_after_callback),
|
G_CALLBACK (gimp_batch_exit_after_callback),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (! batch_interpreter)
|
if (! batch_interpreter)
|
||||||
@ -88,8 +87,8 @@ batch_run (Gimp *gimp,
|
|||||||
proc_name);
|
proc_name);
|
||||||
|
|
||||||
if (procedure)
|
if (procedure)
|
||||||
batch_run_cmd (gimp, proc_name, procedure,
|
gimp_batch_run_cmd (gimp, proc_name, procedure,
|
||||||
GIMP_RUN_NONINTERACTIVE, NULL);
|
GIMP_RUN_NONINTERACTIVE, NULL);
|
||||||
else
|
else
|
||||||
g_message (_("The batch interpreter '%s' is not available. "
|
g_message (_("The batch interpreter '%s' is not available. "
|
||||||
"Batch mode disabled."), proc_name);
|
"Batch mode disabled."), proc_name);
|
||||||
@ -104,8 +103,8 @@ batch_run (Gimp *gimp,
|
|||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; batch_commands[i]; i++)
|
for (i = 0; batch_commands[i]; i++)
|
||||||
batch_run_cmd (gimp, batch_interpreter, eval_proc,
|
gimp_batch_run_cmd (gimp, batch_interpreter, eval_proc,
|
||||||
GIMP_RUN_NONINTERACTIVE, batch_commands[i]);
|
GIMP_RUN_NONINTERACTIVE, batch_commands[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -125,7 +124,7 @@ batch_run (Gimp *gimp,
|
|||||||
* and gimp would hang forever.
|
* and gimp would hang forever.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
batch_exit_after_callback (Gimp *gimp)
|
gimp_batch_exit_after_callback (Gimp *gimp)
|
||||||
{
|
{
|
||||||
if (gimp->be_verbose)
|
if (gimp->be_verbose)
|
||||||
g_print ("EXIT: %s\n", G_STRFUNC);
|
g_print ("EXIT: %s\n", G_STRFUNC);
|
||||||
@ -136,11 +135,11 @@ batch_exit_after_callback (Gimp *gimp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
batch_run_cmd (Gimp *gimp,
|
gimp_batch_run_cmd (Gimp *gimp,
|
||||||
const gchar *proc_name,
|
const gchar *proc_name,
|
||||||
GimpProcedure *procedure,
|
GimpProcedure *procedure,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
const gchar *cmd)
|
const gchar *cmd)
|
||||||
{
|
{
|
||||||
GimpValueArray *args;
|
GimpValueArray *args;
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
@ -15,17 +15,13 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BATCH_H__
|
#ifndef __GIMP_BATCH_H__
|
||||||
#define __BATCH_H__
|
#define __GIMP_BATCH_H__
|
||||||
|
|
||||||
#ifndef GIMP_APP_GLUE_COMPILATION
|
|
||||||
#error You must not #include "batch.h" from an app/ subdir
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void batch_run (Gimp *gimp,
|
void gimp_batch_run (Gimp *gimp,
|
||||||
const gchar *batch_interpreter,
|
const gchar *batch_interpreter,
|
||||||
const gchar **batch_commands);
|
const gchar **batch_commands);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __BATCH_H__ */
|
#endif /* __GIMP_BATCH_H__ */
|
@ -27,6 +27,7 @@
|
|||||||
#include "gui-types.h"
|
#include "gui-types.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
|
#include "core/gimp-batch.h"
|
||||||
#include "core/gimpcontainer.h"
|
#include "core/gimpcontainer.h"
|
||||||
|
|
||||||
#include "file/file-open.h"
|
#include "file/file-open.h"
|
||||||
@ -34,12 +35,6 @@
|
|||||||
#include "display/gimpdisplay.h"
|
#include "display/gimpdisplay.h"
|
||||||
#include "display/gimpdisplayshell.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"
|
#include "gimpdbusservice.h"
|
||||||
|
|
||||||
|
|
||||||
@ -349,8 +344,8 @@ gimp_dbus_service_process_idle (GimpDBusService *service)
|
|||||||
{
|
{
|
||||||
const gchar *commands[2] = {data->command, 0};
|
const gchar *commands[2] = {data->command, 0};
|
||||||
|
|
||||||
batch_run (service->gimp, data->interpreter,
|
gimp_batch_run (service->gimp, data->interpreter,
|
||||||
commands);
|
commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_dbus_service_idle_data_free (data);
|
gimp_dbus_service_idle_data_free (data);
|
||||||
|
@ -8,7 +8,6 @@ desktop/gimp.desktop.in.in
|
|||||||
|
|
||||||
app/about.h
|
app/about.h
|
||||||
app/app.c
|
app/app.c
|
||||||
app/batch.c
|
|
||||||
app/language.c
|
app/language.c
|
||||||
app/main.c
|
app/main.c
|
||||||
app/sanity.c
|
app/sanity.c
|
||||||
@ -95,6 +94,7 @@ app/config/gimprc-deserialize.c
|
|||||||
|
|
||||||
app/core/core-enums.c
|
app/core/core-enums.c
|
||||||
app/core/gimp.c
|
app/core/gimp.c
|
||||||
|
app/core/gimp-batch.c
|
||||||
app/core/gimp-contexts.c
|
app/core/gimp-contexts.c
|
||||||
app/core/gimp-edit.c
|
app/core/gimp-edit.c
|
||||||
app/core/gimp-gradients.c
|
app/core/gimp-gradients.c
|
||||||
|
Reference in New Issue
Block a user