summaryrefslogtreecommitdiff
path: root/src/runner.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/runner.h')
-rw-r--r--src/runner.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/runner.h b/src/runner.h
new file mode 100644
index 0000000..94f5d83
--- /dev/null
+++ b/src/runner.h
@@ -0,0 +1,33 @@
+#ifndef GGAZE_RUNNER_H
+#define GGAZE_RUNNER_H
+
+#include <gio/gio.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct {
+ char *c_name;
+ char *c_command; /* may contain %f and %d */
+} RunnerScript;
+
+typedef struct Runner Runner;
+
+Runner *runner_new(void);
+void runner_delete(Runner *p_r);
+void runner_set_scripts(Runner *p_r, const GPtrArray *p_scripts);
+const GPtrArray *runner_get_scripts(Runner *p_r);
+
+/* Run the script via /bin/sh -c with %f and %d expanded (single-quoted).
+ * Async: calls p_cb (on the main thread) when the process exits. p_data
+ * is passed to p_cb as-is. */
+gboolean runner_run(Runner *p_r, GFile *p_file, GFile *p_dir,
+ const RunnerScript *p_script, GAsyncReadyCallback p_cb,
+ gpointer p_data, GError **p_err);
+
+/* Finish: returns the exit code, or -1 on error. */
+int runner_run_finish(Runner *p_r, GAsyncResult *p_res, GError **p_err);
+
+G_END_DECLS
+
+#endif \ No newline at end of file