aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-09 05:23:49 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-07-09 05:54:56 +0200
commit4236c7fc3a7c7ef9f79b045cfd99c6575b16f7b1 (patch)
tree8844897369391eedcd44645ab64b9c4b91ff511c
parent55f0efb8ab0ee62b3a6e729fca0e86465b75964b (diff)
downloadslcl-4236c7fc3a7c7ef9f79b045cfd99c6575b16f7b1.tar.gz
page.c: Allow add_element to hide checkboxes
Since removing files or directories is currently not an option in searches, it is better to leave checkboxes out to avoid confusion.
-rw-r--r--page.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/page.c b/page.c
index a172031..eb7ae99 100644
--- a/page.c
+++ b/page.c
@@ -333,7 +333,7 @@ end:
}
static int add_element(struct html_node *const n, const char *const dir,
- const char *const res, const char *const name)
+ const char *const res, const char *const name, const bool chbx)
{
int ret = -1;
enum {RM_CHECKBOX, NAME, SIZE, DATE, SHARE, PREVIEW, COLUMNS};
@@ -370,7 +370,7 @@ static int add_element(struct html_node *const n, const char *const dir,
__func__, path.str, strerror(errno));
goto end;
}
- else if (strcmp(name, "..")
+ else if (chbx && strcmp(name, "..")
&& prepare_rm_checkbox(td[RM_CHECKBOX], &sb, name))
{
fprintf(stderr, "%s: prepare_rm_checkbox failed\n", __func__);
@@ -1138,7 +1138,7 @@ static int add_elements(const char *const root, const char *const res,
if (!strcmp(name, ".")
|| (!strcmp(name, "..") && !strcmp(root, res)))
continue;
- else if (add_element(table, dir, res, name))
+ else if (add_element(table, dir, res, name, true))
{
fprintf(stderr, "%s: add_element failed\n", __func__);
goto end;
@@ -1784,7 +1784,7 @@ static int add_search_results(struct html_node *const n,
{
const struct page_search_result *const r = &s->results[i];
- if (add_element(table, "/user/", s->root, r->name))
+ if (add_element(table, "/user/", s->root, r->name, false))
{
fprintf(stderr, "%s: add_element failed\n", __func__);
return -1;