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