summaryrefslogtreecommitdiff
path: root/src/runner.h
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-14 09:08:10 +0300
committerPaul Buetow <paul@buetow.org>2026-07-14 09:08:10 +0300
commit95858bc4a819c118cf76dd38d6da0365ead997a9 (patch)
tree739544e2314c3e0bab65fb9c75e2c17e89069017 /src/runner.h
parent12be1b9ae52829292d13cc2fcc6ff7571d050d62 (diff)
operate: mover, opener, runner, clipboard modules + tests (ut0)
M8 (partial): plain-C operate modules + unit tests. - src/mover.{c,h}: move files to configured dests (g_file_move + stem collision suffix -1/-2), one-level undo (move back), acts on marks-or-current. - src/opener.{c,h}: %f expand + detached GSubprocess launch (non-blocking). - src/runner.{c,h}: /bin/sh -c with single-quoted %f/%d (injection guard), async wait_check, rescan on completion. - src/clipboard.{c,h}: image/png via GdkContentProvider + uri-list. - meson: new sources added to libggae. - tests: unit test_mover (move/undo/collision), test_opener (true/false/weird filenames), test_runner (true/false/injection guard). 19/19 green, ASan clean. - Fixed: g_str_replace (not in GLib 2.88) → manual _str_replace; GdkContentProvider API (new_typed/new_for_value); mover collision stem-suffix; runner /bin/sh -c argv (single arg, not shell-parsed); test GFile leaks.
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