summaryrefslogtreecommitdiff
path: root/src/desktop_vec.h
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-07-24 12:31:09 +0100
committerPhil Jones <philj56@gmail.com>2022-07-24 12:40:26 +0100
commit9e8af9d25106b615dabf956305f4ef80496ed412 (patch)
tree180ad86a9c1675777c83a9243db5129a01be9146 /src/desktop_vec.h
parentee0ed3c506f8f45fce42cbabc1d9521382740924 (diff)
Add drun mode.
This is a pretty simple implementation, but it should work for most use cases. Notably, generic application names aren't used (though that could be added without too much hassle), and neither are keywords (that would be more difficult).
Diffstat (limited to 'src/desktop_vec.h')
-rw-r--r--src/desktop_vec.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/desktop_vec.h b/src/desktop_vec.h
new file mode 100644
index 0000000..9c15ad9
--- /dev/null
+++ b/src/desktop_vec.h
@@ -0,0 +1,36 @@
+#ifndef DESKTOP_VEC_H
+#define DESKTOP_VEC_H
+
+#include <stddef.h>
+#include <stdio.h>
+
+struct desktop_entry {
+ char *id;
+ char *name;
+ char *path;
+};
+
+struct desktop_vec {
+ size_t count;
+ size_t size;
+ struct desktop_entry *buf;
+};
+
+[[nodiscard("memory leaked")]]
+struct desktop_vec desktop_vec_create(void);
+void desktop_vec_destroy(struct desktop_vec *restrict vec);
+void desktop_vec_add(
+ struct desktop_vec *restrict vec,
+ const char *restrict id,
+ const char *restrict name,
+ const char *restrict path);
+void desktop_vec_add_file(struct desktop_vec *desktop, const char *id, const char *path);
+
+void desktop_vec_sort(struct desktop_vec *restrict vec);
+struct desktop_entry *desktop_vec_find(struct desktop_vec *restrict vec, const char *name);
+
+struct desktop_vec desktop_vec_load(FILE *file);
+void desktop_vec_save(struct desktop_vec *restrict vec, FILE *restrict file);
+
+
+#endif /* DESKTOP_VEC_H */