Renamed all zenity mentions to dialogue

This commit is contained in:
fedir 2025-05-04 17:25:47 +02:00
parent 4f98a4834e
commit e32ce5add5
Signed by: fedir
GPG Key ID: C959EE85F0C9362C

View File

@ -26,9 +26,9 @@
#include <sys/un.h>
#include <unistd.h>
#define ZENITY_YES 0
#define ZENITY_NO 1
#define ZENITY_PERM 2
#define DIALOGUE_YES 0
#define DIALOGUE_NO 1
#define DIALOGUE_PERM 2
struct dialogue_response {
access_t decision;
@ -48,7 +48,7 @@ int init_ui_socket(const char *perm_permissions_db_filename) {
return 1;
}
// Test if Zenity is installed (get version)
// Test if dialogue is installed (get version)
fp = popen("icfs_dialogue --version", "r");
if (fp == NULL) {
perror("Pipe returned an error");
@ -98,7 +98,7 @@ struct dialogue_response ask_access(const char *filename,
return response;
}
// Zenity Question Message Popup
// dialogue Question Message Popup
fp = popen(command, "r");
free(command);
@ -111,38 +111,38 @@ struct dialogue_response ask_access(const char *filename,
return response;
}
str(char) zenity_output;
init(&zenity_output);
str(char) dialogue_output;
init(&dialogue_output);
char line[1024]; // Buffer to read individual lines
// Read the command output line by line
while (fgets(line, sizeof(line), fp)) {
push_fmt(&zenity_output, line);
push_fmt(&dialogue_output, line);
}
int zenity_exit_code = WEXITSTATUS(pclose(fp));
fprintf(stderr, "zenity wrote out %s\n", first(&zenity_output));
fprintf(stderr, "zenity returned %d\n", zenity_exit_code);
int dialogue_exit_code = WEXITSTATUS(pclose(fp));
fprintf(stderr, "dialogue wrote out %s\n", first(&dialogue_output));
fprintf(stderr, "dialogue returned %d\n", dialogue_exit_code);
// if (size(&zenity_output) == 0) {
// push(&zenity_output, '.');
// if (size(&dialogue_output) == 0) {
// push(&dialogue_output, '.');
// }
assert(strlen(first(&zenity_output)) == size(&zenity_output));
assert(strlen(first(&dialogue_output)) == size(&dialogue_output));
response.filename = malloc(size(&zenity_output) + 1);
strcpy(response.filename, first(&zenity_output));
// response.filename[size(&zenity_output)] = 0;
response.filename = malloc(size(&dialogue_output) + 1);
strcpy(response.filename, first(&dialogue_output));
// response.filename[size(&dialogue_output)] = 0;
// assert(0 == strcmp(response.filename, first(&zenity_output)));
cleanup(&zenity_output);
// assert(0 == strcmp(response.filename, first(&dialogue_output)));
cleanup(&dialogue_output);
if (zenity_exit_code == (ZENITY_YES | ZENITY_PERM)) {
if (dialogue_exit_code == (DIALOGUE_YES | DIALOGUE_PERM)) {
response.decision = ALLOW;
} else if (zenity_exit_code == ZENITY_YES) {
} else if (dialogue_exit_code == DIALOGUE_YES) {
response.decision = ALLOW_TEMP;
} else if (zenity_exit_code == (ZENITY_NO | ZENITY_PERM)) {
} else if (dialogue_exit_code == (DIALOGUE_NO | DIALOGUE_PERM)) {
response.decision = DENY;
} else {
response.decision = DENY_TEMP;