This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository xdg-desktop-portal-efl.
View the commit online.
commit 065c802222e53330fc1acaeeedf55753d158837f
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Fri Nov 27 14:37:24 2026 +0000
dialog process - tidy up code
---
src/bin/service_access.c | 18 +++++++++++---
src/bin/shared_dialog_process.c | 52 +++++++++++++++++++++++++++++------------
src/lib/access/dialog_access.c | 7 ++++--
3 files changed, 57 insertions(+), 20 deletions(-)
diff --git a/src/bin/service_access.c b/src/bin/service_access.c
index 555141a..81f060d 100644
--- a/src/bin/service_access.c
+++ b/src/bin/service_access.c
@@ -28,7 +28,12 @@ _access(const Eldbus_Service_Interface *iface EINA_UNUSED,
return portal_error(msg, "Invalid, duplicate, or excessive request handle");
}
d = calloc(1, sizeof(*d));
- if (!d) { choices_free(choices); request_finish(r, 2, NULL); return NULL; }
+ if (!d)
+ {
+ choices_free(choices);
+ request_finish(r, 2, NULL);
+ return NULL;
+ }
d->kind = DIALOG_ACCESS;
d->choices = choices;
d->title = strdup(title); d->app_id = strdup(app_id); d->parent = strdup(parent);
@@ -36,8 +41,14 @@ _access(const Eldbus_Service_Interface *iface EINA_UNUSED,
d->accept_label = strdup(option_string(opts, "grant_label", "Allow"));
d->cancel_label = strdup(option_string(opts, "deny_label", "Deny"));
d->modal = option_bool(opts, "modal", EINA_TRUE);
- if (!d->title || !d->app_id || !d->parent || !d->subtitle || !d->body ||
- !d->accept_label || !d->cancel_label || !dialog_process_start(r, d))
+ if ((!d->title) ||
+ (!d->app_id) ||
+ (!d->parent) ||
+ (!d->subtitle) ||
+ (!d->body) ||
+ (!d->accept_label) ||
+ (!d->cancel_label) ||
+ (!dialog_process_start(r, d)))
request_finish(r, 2, NULL);
dialog_free(d);
return NULL;
@@ -56,3 +67,4 @@ const Eldbus_Service_Interface_Desc access_desc =
.interface = IMPL "Access",
.methods = methods
};
+
diff --git a/src/bin/shared_dialog_process.c b/src/bin/shared_dialog_process.c
index d6d3e28..cd79c5d 100644
--- a/src/bin/shared_dialog_process.c
+++ b/src/bin/shared_dialog_process.c
@@ -34,8 +34,9 @@ _app_name_get(Request *r, Dialog *d)
reply = eldbus_proxy_send_and_block(proxy, msg, 1000);
if (reply)
{
- if (!eldbus_message_error_get(reply, NULL, NULL) &&
- eldbus_message_arguments_get(reply, "u", &pid) && pid)
+ if ((!eldbus_message_error_get(reply, NULL, NULL)) &&
+ (eldbus_message_arguments_get(reply, "u", &pid)) &&
+ (pid))
{
char path[64], exe[PATH_MAX + 1];
ssize_t len;
@@ -76,8 +77,9 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
r = ecore_exe_data_get(ev->exe);
if (!r) return ECORE_CALLBACK_PASS_ON;
size = eina_binbuf_length_get(r->output);
- if (ev->size <= 0 || size + ev->size > DIALOG_WIRE_MAX + DIALOG_WIRE_HEADER ||
- !eina_binbuf_append_length(r->output, ev->data, ev->size))
+ if ((ev->size <= 0) ||
+ ((size + ev->size) > (DIALOG_WIRE_MAX + DIALOG_WIRE_HEADER)) ||
+ (!eina_binbuf_append_length(r->output, ev->data, ev->size)))
{
request_finish(r, 2, NULL);
return ECORE_CALLBACK_PASS_ON;
@@ -87,7 +89,9 @@ _data(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
int expected = dialog_wire_size(eina_binbuf_string_get(r->output));
- if (expected < 0 || size > (size_t)expected) request_finish(r, 2, NULL);
+ if ((expected < 0) ||
+ (size > (size_t)expected))
+ request_finish(r, 2, NULL);
}
return ECORE_CALLBACK_PASS_ON;
}
@@ -111,9 +115,15 @@ _exited(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
d = dialog_wire_decode(eina_binbuf_string_get(r->output),
eina_binbuf_length_get(r->output));
/* Success from a file dialog must include at least one URI. */
- if (d && (d->kind != r->dialog_kind ||
- (d->kind == DIALOG_FILE && !d->response && !d->uris)))
- { dialog_free(d); d = NULL; }
+ if ((d) &&
+ ((d->kind != r->dialog_kind) ||
+ (d->kind == DIALOG_FILE &&
+ (!d->response) &&
+ (!d->uris))))
+ {
+ dialog_free(d);
+ d = NULL;
+ }
reply = d ? dialog_reply(r, d) : NULL;
request_finish(r, d ? d->response : 2, reply);
dialog_free(d);
@@ -150,16 +160,27 @@ dialog_process_start(Request *r, Dialog *d)
frame = dialog_wire_encode(d, &size);
if (!frame) return EINA_FALSE;
r->output = eina_binbuf_new();
- if (!r->output) { free(frame); return EINA_FALSE; }
+ if (!r->output)
+ {
+ free(frame);
+ return EINA_FALSE;
+ }
libdir = portal_app_lib_dir_get();
worker = d->kind == DIALOG_FILE ? "filechooser" :
d->kind == DIALOG_ACCESS ? "access" : NULL;
- if (!worker || !libdir || !libdir[0]) { free(frame); return EINA_FALSE; }
+ if ((!worker) ||
+ (!libdir) ||
+ (!libdir[0]))
+ {
+ free(frame);
+ return EINA_FALSE;
+ }
path = eina_strbuf_new();
command = eina_strbuf_new();
- if (!path || !command)
+ if ((!path) || (!command))
{
- eina_strbuf_free(path); eina_strbuf_free(command);
+ eina_strbuf_free(path);
+ eina_strbuf_free(command);
free(frame);
return EINA_FALSE;
}
@@ -174,8 +195,9 @@ dialog_process_start(Request *r, Dialog *d)
}
eina_strbuf_append(command, portal_headless ? "' --headless" : "'");
r->child = ecore_exe_pipe_run(eina_strbuf_string_get(command),
- ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE | ECORE_EXE_TERM_WITH_PARENT |
- ECORE_EXE_USE_SH, r);
+ ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_WRITE |
+ ECORE_EXE_TERM_WITH_PARENT | ECORE_EXE_USE_SH,
+ r);
eina_strbuf_free(path);
eina_strbuf_free(command);
if (r->child) children = eina_list_append(children, r->child);
@@ -211,7 +233,7 @@ dialog_process_shutdown(void)
pid_t pid = ecore_exe_pid_get(child);
ecore_exe_kill(child);
- while (waitpid(pid, NULL, 0) < 0 && errno == EINTR) {}
+ while ((waitpid(pid, NULL, 0) < 0) && (errno == EINTR));
ecore_exe_free(child);
}
if (data_handler) ecore_event_handler_del(data_handler);
diff --git a/src/lib/access/dialog_access.c b/src/lib/access/dialog_access.c
index 81cfe17..d77e181 100644
--- a/src/lib/access/dialog_access.c
+++ b/src/lib/access/dialog_access.c
@@ -12,9 +12,12 @@ dialog_access_show(Dialog *r)
{
Evas_Object *o, *win, *buttons;
- if (!win_add(r)) { dialog_finish(r, 2); return; }
+ if (!win_add(r))
+ {
+ dialog_finish(r, 2);
+ return;
+ }
win = r->win;
- dialog_label(win, r->box, r->title);
dialog_label(win, r->box, r->subtitle);
dialog_label(win, r->box, r->body);
choices_show(r->choices, win, r->box);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.