ui: notification; finishes registration process
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
## Features:
|
## Features:
|
||||||
- [x] Search files
|
- [x] Search files
|
||||||
- [x] Correct spacing in the search bar
|
- [x] Correct spacing in the search bar
|
||||||
- [ ] Finish registration
|
- [x] Finish registration
|
||||||
|
- [ ] Get rid of old notification mechanism
|
||||||
- [ ] Privilege settings for files
|
- [ ] Privilege settings for files
|
||||||
- [ ] Files removal
|
- [ ] Files removal
|
||||||
- [ ] Encryption
|
- [ ] Encryption
|
||||||
|
|||||||
+7
-3
@@ -8,12 +8,13 @@
|
|||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <widget.h>
|
||||||
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "main.h"
|
|
||||||
#include "file_list.h"
|
#include "file_list.h"
|
||||||
|
#include "main.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include <widget.h>
|
#include "modals/alert.h"
|
||||||
|
|
||||||
uint32_t m_id = 0;
|
uint32_t m_id = 0;
|
||||||
|
|
||||||
@@ -33,6 +34,9 @@ int main(int argc, char **argv) {
|
|||||||
app->params = ¶ms;
|
app->params = ¶ms;
|
||||||
analyze_args(argc, argv, ¶ms);
|
analyze_args(argc, argv, ¶ms);
|
||||||
|
|
||||||
|
/* init alert */
|
||||||
|
init_alert(app);
|
||||||
|
|
||||||
wrefresh(app->left_win);
|
wrefresh(app->left_win);
|
||||||
wrefresh(app->right_win);
|
wrefresh(app->right_win);
|
||||||
|
|
||||||
@@ -62,7 +66,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
int32_t process_user_input(app_t *app, callback_args_t *d_args) {
|
int32_t process_user_input(app_t *app, callback_args_t *d_args) {
|
||||||
int32_t c;
|
int32_t c;
|
||||||
ui_file_list_t *fui = (ui_file_list_t *) app->query_args->file_list_ui;
|
ui_file_list_t *fui = (ui_file_list_t *)app->query_args->file_list_ui;
|
||||||
c = wgetch(app->win);
|
c = wgetch(app->win);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case KEY_F(9):
|
case KEY_F(9):
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,7 @@
|
|||||||
#ifndef MAIN_H
|
#ifndef MAIN_H
|
||||||
#define MAIN_H
|
#define MAIN_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@@ -80,9 +81,8 @@ typedef struct query_args {
|
|||||||
int32_t buf_used;
|
int32_t buf_used;
|
||||||
p_file_t *file;
|
p_file_t *file;
|
||||||
enum state state;
|
enum state state;
|
||||||
enum state next_state;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
uint32_t from_server : 1;
|
bool from_server;
|
||||||
params_t *params;
|
params_t *params;
|
||||||
char *next_server_command;
|
char *next_server_command;
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
+21
-6
@@ -5,11 +5,22 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
void init_alert_cb(callback_args_t *args) {
|
/* Short notifications. Prefer using this method to simply notify the client */
|
||||||
|
|
||||||
|
static app_t *app;
|
||||||
|
void notification(const char *title, const char *message,
|
||||||
|
enum d_color_scheme color);
|
||||||
|
|
||||||
|
void alert_cb(callback_args_t *args) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void alert(app_t *app, const char *message) {
|
void init_alert(app_t *_app) { app = _app; }
|
||||||
|
|
||||||
|
void alert(const char *message) { notification("Alert", message, dc_alert); }
|
||||||
|
|
||||||
|
void notification(const char *title, const char *message,
|
||||||
|
enum d_color_scheme color) {
|
||||||
if (app == NULL)
|
if (app == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -18,25 +29,29 @@ void alert(app_t *app, const char *message) {
|
|||||||
|
|
||||||
dialogue_t *d = malloc(sizeof(dialogue_t));
|
dialogue_t *d = malloc(sizeof(dialogue_t));
|
||||||
|
|
||||||
init_dialogue(d, "Alert", message, &(app->coordinates));
|
init_dialogue(d, title, message, &(app->coordinates));
|
||||||
|
|
||||||
d->w.callback = init_alert_cb;
|
d->w.callback = alert_cb;
|
||||||
d->g_content = NULL;
|
d->g_content = NULL;
|
||||||
d->g_action = init_group(&(d->win), &(d->w), actions, horizontal);
|
d->g_action = init_group(&(d->win), &(d->w), actions, horizontal);
|
||||||
|
|
||||||
dialogue_init_active_id(d);
|
dialogue_init_active_id(d);
|
||||||
d->color_scheme = dc_alert;
|
d->color_scheme = color;
|
||||||
|
|
||||||
draw_dialogue(d);
|
draw_dialogue(d);
|
||||||
wrefresh(d->win);
|
wrefresh(d->win);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while ((c = wgetch(d->win))) {
|
while ((c = wgetch(d->win))) {
|
||||||
if (c == '\n') break;
|
if (c == '\n')
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_group(d->g_action);
|
destroy_group(d->g_action);
|
||||||
delwin(d->win);
|
delwin(d->win);
|
||||||
free(d);
|
free(d);
|
||||||
app_refresh(app);
|
app_refresh(app);
|
||||||
|
if (app->modal.win != NULL) {
|
||||||
|
app->modal.needs_update = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
-1
@@ -1,5 +1,8 @@
|
|||||||
#ifndef ALERT_H
|
#ifndef ALERT_H
|
||||||
#define ALERT_H
|
#define ALERT_H
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
void alert(app_t *app, const char *message);
|
void init_alert(app_t *app);
|
||||||
|
void alert(char *message);
|
||||||
|
void notification(const char *title, const char *message,
|
||||||
|
enum d_color_scheme color);
|
||||||
#endif
|
#endif
|
||||||
@@ -38,7 +38,8 @@ void init_login_credentials_modal_cb(callback_args_t *args) {
|
|||||||
print_bars(app);
|
print_bars(app);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
destroy_app(app, 0);
|
app->query_args->state = S_ASK_LOGIN_TYPE;
|
||||||
|
app->modal.needs_destroy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <widget.h>
|
#include <widget.h>
|
||||||
|
|
||||||
|
/* TODO: get rid of this mechanism */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
button_t *element;
|
button_t *element;
|
||||||
enum w_type type;
|
enum w_type type;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void init_register_modal_cb(callback_args_t *args) {
|
|||||||
switch (response) {
|
switch (response) {
|
||||||
case 0:
|
case 0:
|
||||||
if (strcmp(in_pass->value, in_pass_r->value)) {
|
if (strcmp(in_pass->value, in_pass_r->value)) {
|
||||||
alert(app, "Your passwords do not match");
|
alert("Your passwords do not match");
|
||||||
in_pass->value[0] = '\0';
|
in_pass->value[0] = '\0';
|
||||||
in_pass->value_len = 0;
|
in_pass->value_len = 0;
|
||||||
in_pass_r->value[0] = '\0';
|
in_pass_r->value[0] = '\0';
|
||||||
@@ -50,11 +50,10 @@ void init_register_modal_cb(callback_args_t *args) {
|
|||||||
&qlen);
|
&qlen);
|
||||||
write(app->params->sd, query, qlen);
|
write(app->params->sd, query, qlen);
|
||||||
app->query_args->state = S_WAIT_REGISTER_CONFIRMATION;
|
app->query_args->state = S_WAIT_REGISTER_CONFIRMATION;
|
||||||
/* d->needs_destroy = true;
|
|
||||||
print_bars(app); */
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
destroy_app(app, 0);
|
app->query_args->state = S_ASK_LOGIN_TYPE;
|
||||||
|
app->modal.needs_destroy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-32
@@ -16,19 +16,28 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "app.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
#include "draw_modal.h"
|
||||||
#include "file_processor.h"
|
#include "file_processor.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "modals/alert.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "app.h"
|
|
||||||
#include "draw_modal.h"
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "widget/app.h"
|
||||||
|
|
||||||
static void wait_side(query_args_t *q_args);
|
static void wait_side(app_t *app);
|
||||||
void user_request_description(query_args_t *q_args);
|
void user_request_description(query_args_t *q_args);
|
||||||
int process_query(query_args_t *query_args, file_args_t *file_args);
|
int process_query(app_t *app);
|
||||||
int32_t process_user_input(app_t *app, callback_args_t *d_args);
|
int32_t process_user_input(app_t *app, callback_args_t *d_args);
|
||||||
|
|
||||||
|
#define EXIT_APP(message, app, exit_code) \
|
||||||
|
{ \
|
||||||
|
alert(message); \
|
||||||
|
close_session(app->params->sd); \
|
||||||
|
destroy_app(app, exit_code); \
|
||||||
|
}
|
||||||
|
|
||||||
void query_loop(app_t *app) {
|
void query_loop(app_t *app) {
|
||||||
query_args_t *query_args = app->query_args;
|
query_args_t *query_args = app->query_args;
|
||||||
fd_set readfds;
|
fd_set readfds;
|
||||||
@@ -67,16 +76,15 @@ void query_loop(app_t *app) {
|
|||||||
free(query_args->next_server_command);
|
free(query_args->next_server_command);
|
||||||
query_args->next_server_command = NULL;
|
query_args->next_server_command = NULL;
|
||||||
query_args->from_server = TRUE;
|
query_args->from_server = TRUE;
|
||||||
if (ERR == process_query(query_args, &file_args)) {
|
if (ERR == process_query(app)) {
|
||||||
close_session(sd);
|
EXIT_APP("*** error while processing query ***", app, 1)
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
sr = select(maxfd + 1, &readfds, NULL, NULL, NULL);
|
sr = select(maxfd + 1, &readfds, NULL, NULL, NULL);
|
||||||
if (sr == -1) {
|
if (sr == -1) {
|
||||||
perror("select");
|
/* perror("select"); */
|
||||||
exit(3);
|
EXIT_APP("*** error while processing 'select' call ***", app, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,15 +92,12 @@ void query_loop(app_t *app) {
|
|||||||
/* process request from the server */
|
/* process request from the server */
|
||||||
qlen = read(sd, query_args->buf, INBUFSIZE);
|
qlen = read(sd, query_args->buf, INBUFSIZE);
|
||||||
if (qlen == 0) {
|
if (qlen == 0) {
|
||||||
close_session(sd);
|
EXIT_APP("*** server closed the connection ***", app, 1)
|
||||||
printf("\n*** server closed the connection. ***\n");
|
|
||||||
exit(1);
|
|
||||||
} else {
|
} else {
|
||||||
query_args->buf_used = qlen;
|
query_args->buf_used = qlen;
|
||||||
query_args->from_server = TRUE;
|
query_args->from_server = TRUE;
|
||||||
if (ERR == process_query(query_args, &file_args)) {
|
if (ERR == process_query(app)) {
|
||||||
close_session(sd);
|
EXIT_APP("*** error while processing query ***", app, 1)
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,22 +107,12 @@ void query_loop(app_t *app) {
|
|||||||
/* process upload/download */
|
/* process upload/download */
|
||||||
query_args->buf_used =
|
query_args->buf_used =
|
||||||
read(query_args->file->fd, query_args->buf, INBUFSIZE);
|
read(query_args->file->fd, query_args->buf, INBUFSIZE);
|
||||||
process_query(query_args, &file_args);
|
process_query(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FD_ISSET(STDIN_FILENO, &readfds)) {
|
if (FD_ISSET(STDIN_FILENO, &readfds)) {
|
||||||
/* process request from the client */
|
|
||||||
/* qlen = read(STDIN_FILENO, buf, INBUFSIZE); */
|
|
||||||
/* if (qlen == 0) {
|
|
||||||
close_session(sd);
|
|
||||||
exit(0);
|
|
||||||
} else { */
|
|
||||||
/* query_args->buf_used = qlen;
|
|
||||||
query_args->from_server = 0; */
|
|
||||||
// if (-1 == process_query(&query_args, &file_args)) {
|
|
||||||
if (ERR == process_user_input(app, &d_args)) {
|
if (ERR == process_user_input(app, &d_args)) {
|
||||||
close_session(sd);
|
EXIT_APP("*** error while processing user input ***", app, 4)
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +128,9 @@ void wait_register(query_args_t *q_args) {
|
|||||||
write(q_args->sd, r_buf, strlen(r_buf) - 1);
|
write(q_args->sd, r_buf, strlen(r_buf) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int process_query(query_args_t *query_args, file_args_t *file_args) {
|
int process_query(app_t *app) {
|
||||||
|
query_args_t *query_args = app->query_args;
|
||||||
|
file_args_t *file_args = app->file_args;
|
||||||
query_args->buf[query_args->buf_used] = 0;
|
query_args->buf[query_args->buf_used] = 0;
|
||||||
int32_t res = 0;
|
int32_t res = 0;
|
||||||
switch (query_args->state) {
|
switch (query_args->state) {
|
||||||
@@ -144,7 +141,7 @@ int process_query(query_args_t *query_args, file_args_t *file_args) {
|
|||||||
case S_WAIT_SERVER:
|
case S_WAIT_SERVER:
|
||||||
case WAIT_REGISTER_CONFIRMATION:
|
case WAIT_REGISTER_CONFIRMATION:
|
||||||
case S_WAIT_REGISTER_CONFIRMATION:
|
case S_WAIT_REGISTER_CONFIRMATION:
|
||||||
wait_side(query_args);
|
wait_side(app);
|
||||||
break;
|
break;
|
||||||
case S_ERR:
|
case S_ERR:
|
||||||
break;
|
break;
|
||||||
@@ -153,7 +150,7 @@ int process_query(query_args_t *query_args, file_args_t *file_args) {
|
|||||||
break;
|
break;
|
||||||
case S_FILE_SELECT:
|
case S_FILE_SELECT:
|
||||||
if (query_args->from_server) {
|
if (query_args->from_server) {
|
||||||
wait_side(query_args);
|
wait_side(app);
|
||||||
} else {
|
} else {
|
||||||
file_select(file_args, query_args);
|
file_select(file_args, query_args);
|
||||||
}
|
}
|
||||||
@@ -233,13 +230,14 @@ int query_extract_from_buf(char *buf, int *buf_used, char **output_line) {
|
|||||||
return pos + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_side(query_args_t *q_args) {
|
static void wait_side(app_t *app) {
|
||||||
|
query_args_t *q_args = app->query_args;
|
||||||
int qlen;
|
int qlen;
|
||||||
int buf_used = q_args->buf_used;
|
int buf_used = q_args->buf_used;
|
||||||
char *query = NULL;
|
char *query = NULL;
|
||||||
|
|
||||||
while ((qlen = query_extract_from_buf(q_args->buf, &buf_used, &query))) {
|
while ((qlen = query_extract_from_buf(q_args->buf, &buf_used, &query))) {
|
||||||
process_server_command(query, qlen, q_args);
|
process_server_command(query, qlen, app);
|
||||||
free(query);
|
free(query);
|
||||||
query = NULL;
|
query = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -2,11 +2,11 @@
|
|||||||
#define QUERY_H
|
#define QUERY_H
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "app.h"
|
#include <widget.h>
|
||||||
|
|
||||||
void query_loop(app_t *);
|
void query_loop(app_t *);
|
||||||
void wait_register(query_args_t *q_args);
|
void wait_register(query_args_t *q_args);
|
||||||
int process_query(query_args_t *query_args, file_args_t *file_args);
|
int process_query(app_t *app);
|
||||||
int query_extract_from_buf(char *buf, int *buf_used, char **output_line);
|
int query_extract_from_buf(char *buf, int *buf_used, char **output_line);
|
||||||
void init_query_args(query_args_t *q_args, params_t *params);
|
void init_query_args(query_args_t *q_args, params_t *params);
|
||||||
|
|
||||||
|
|||||||
+16
-4
@@ -1,6 +1,8 @@
|
|||||||
|
#include "app.h"
|
||||||
|
#include "dialogue.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "widget/file_list.h"
|
|
||||||
#include "modals/alert.h"
|
#include "modals/alert.h"
|
||||||
|
#include "widget/file_list.h"
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -16,6 +18,7 @@
|
|||||||
void ask_uname_and_password(params_t *params);
|
void ask_uname_and_password(params_t *params);
|
||||||
void ask_register(params_t *params, char *email);
|
void ask_register(params_t *params, char *email);
|
||||||
|
|
||||||
|
/* TODO: questionable solution. Do better */
|
||||||
#define PRINT_SRV_MESSAGE(q_args, l_len, line) \
|
#define PRINT_SRV_MESSAGE(q_args, l_len, line) \
|
||||||
if (q_args->server_message.size > 0) { \
|
if (q_args->server_message.size > 0) { \
|
||||||
q_args->state = S_PRINT_SERVER_MESSAGE; \
|
q_args->state = S_PRINT_SERVER_MESSAGE; \
|
||||||
@@ -24,8 +27,9 @@ void ask_register(params_t *params, char *email);
|
|||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
int process_server_command(char *line, int l_len, query_args_t *q_args) {
|
int process_server_command(char *line, int l_len, app_t *app) {
|
||||||
int ws_pos = l_len;
|
int ws_pos = l_len;
|
||||||
|
query_args_t *q_args = app->query_args;
|
||||||
params_t *params = q_args->params;
|
params_t *params = q_args->params;
|
||||||
uint64_t new_capacity;
|
uint64_t new_capacity;
|
||||||
ui_file_list_t *fui = (ui_file_list_t *)q_args->file_list_ui;
|
ui_file_list_t *fui = (ui_file_list_t *)q_args->file_list_ui;
|
||||||
@@ -71,14 +75,22 @@ int process_server_command(char *line, int l_len, query_args_t *q_args) {
|
|||||||
|
|
||||||
/* REGISTER CONFIRMATION */
|
/* REGISTER CONFIRMATION */
|
||||||
if (q_args->state == S_WAIT_REGISTER_CONFIRMATION) {
|
if (q_args->state == S_WAIT_REGISTER_CONFIRMATION) {
|
||||||
if (!strcmp(line, "ok")) {
|
if (!strcmp(line, "ok\n")) {
|
||||||
sprintf(query, "file list %u %u\n%n", fui->max_lines, fui->current_page,
|
sprintf(query, "file list %u %u\n%n", fui->max_lines, fui->current_page,
|
||||||
&q_len);
|
&q_len);
|
||||||
write(q_args->sd, query, q_len);
|
write(q_args->sd, query, q_len);
|
||||||
q_args->state = S_FILE_LIST;
|
q_args->state = S_FILE_LIST;
|
||||||
|
destroy_dialogue(&(app->modal), app);
|
||||||
|
sprintf(query,
|
||||||
|
"You've been successfully registered.\n"
|
||||||
|
"Welcome, %s!",
|
||||||
|
app->params->uname);
|
||||||
|
notification("Registration", query, dc_normal);
|
||||||
|
print_bars(app);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
PRINT_SRV_MESSAGE(q_args, l_len, line)
|
q_args->state = S_ASK_REGISTER;
|
||||||
|
alert(line);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -1,8 +1,9 @@
|
|||||||
#ifndef SERVER_H
|
#ifndef SERVER_H
|
||||||
#define SERVER_H
|
#define SERVER_H
|
||||||
|
|
||||||
|
#include "app.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
int process_server_command(char *line, int l_len, query_args_t *q_args);
|
int process_server_command(char *line, int l_len, app_t *app);
|
||||||
void ask_register(params_t *params, char *email);
|
void ask_register(params_t *params, char *email);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -164,6 +164,7 @@ void dialogue_default_callback(callback_args_t *args) {
|
|||||||
|
|
||||||
void init_dialogue(dialogue_t *dialogue, const char title[], const char text[],
|
void init_dialogue(dialogue_t *dialogue, const char title[], const char text[],
|
||||||
coordinates_t *p_coordinates) {
|
coordinates_t *p_coordinates) {
|
||||||
|
uint32_t t_size = 0;
|
||||||
dialogue->win = 0;
|
dialogue->win = 0;
|
||||||
dialogue->g_content = NULL;
|
dialogue->g_content = NULL;
|
||||||
dialogue->w.x = 0;
|
dialogue->w.x = 0;
|
||||||
@@ -175,7 +176,10 @@ void init_dialogue(dialogue_t *dialogue, const char title[], const char text[],
|
|||||||
dialogue->needs_destroy = false;
|
dialogue->needs_destroy = false;
|
||||||
dialogue->color_scheme = dc_normal;
|
dialogue->color_scheme = dc_normal;
|
||||||
strcpy(dialogue->w.title, title);
|
strcpy(dialogue->w.title, title);
|
||||||
|
t_size = strlen(text);
|
||||||
strcpy(dialogue->text, text);
|
strcpy(dialogue->text, text);
|
||||||
|
/* trim the last new line symbol */
|
||||||
|
if (t_size && dialogue->text[t_size-1] == '\n') dialogue->text[t_size-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
void dialogue_init_active_id(dialogue_t *dialogue) {
|
void dialogue_init_active_id(dialogue_t *dialogue) {
|
||||||
@@ -290,7 +294,7 @@ int32_t draw_dialogue(dialogue_t *d) {
|
|||||||
wattrset(d->win, COLOR_PAIR(0) | A_BOLD | A_REVERSE);
|
wattrset(d->win, COLOR_PAIR(0) | A_BOLD | A_REVERSE);
|
||||||
break;
|
break;
|
||||||
case dc_alert:
|
case dc_alert:
|
||||||
wattrset(d->win, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
|
wattrset(d->win, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user