R: changes name convention on objective elements
This commit is contained in:
+25
-25
@@ -11,18 +11,18 @@
|
||||
#include "../server.h"
|
||||
|
||||
typedef struct {
|
||||
button_t *element;
|
||||
w_button_t *element;
|
||||
enum w_type type;
|
||||
} group_bt_t;
|
||||
|
||||
void init_register_modal_cb(callback_args_t *args) {
|
||||
callback_args_t d_args;
|
||||
app_t *app = args->app;
|
||||
dialogue_t *d = (dialogue_t *)app->active_widget;
|
||||
memcpy(&d_args, args, sizeof(callback_args_t));
|
||||
void init_register_modal_cb(w_cb_args_t *args) {
|
||||
w_cb_args_t d_args;
|
||||
w_app_t *app = args->app;
|
||||
w_dialogue_t *d = (w_dialogue_t *)app->active_widget;
|
||||
memcpy(&d_args, args, sizeof(w_cb_args_t));
|
||||
d_args.app = NULL;
|
||||
d_args.element = app->active_widget;
|
||||
dialogue_default_callback(&d_args);
|
||||
w_dialogue_callback_default(&d_args);
|
||||
if (d_args.resp_data.code == cbrp_val &&
|
||||
d_args.resp_data.val.type == val_num) {
|
||||
|
||||
@@ -32,25 +32,25 @@ void init_register_modal_cb(callback_args_t *args) {
|
||||
return;
|
||||
}
|
||||
|
||||
input_t *in_name = d->g_content->elements[0].element;
|
||||
group_t *g_passwords = d->g_content->elements[1].element;
|
||||
input_t *in_email = d->g_content->elements[2].element;
|
||||
input_t *in_pass = g_passwords->elements[0].element;
|
||||
input_t *in_pass_r = g_passwords->elements[1].element;
|
||||
w_input_t *in_name = d->g_content->elements[0].element;
|
||||
w_group_t *g_passwords = d->g_content->elements[1].element;
|
||||
w_input_t *in_email = d->g_content->elements[2].element;
|
||||
w_input_t *in_pass = g_passwords->elements[0].element;
|
||||
w_input_t *in_pass_r = g_passwords->elements[1].element;
|
||||
if (in_name->value_len == 0) {
|
||||
alert("Name field is empty!");
|
||||
w_alert("Name field is empty!");
|
||||
return;
|
||||
}
|
||||
if (in_email->value_len == 0) {
|
||||
alert("Email field is empty!");
|
||||
w_alert("Email field is empty!");
|
||||
return;
|
||||
}
|
||||
if (!in_pass->value_len || !in_pass->value_len) {
|
||||
alert("One of password's field is empty!");
|
||||
w_alert("One of password's field is empty!");
|
||||
return;
|
||||
}
|
||||
if (strcmp(in_pass->value, in_pass_r->value)) {
|
||||
alert("Your passwords do not match!");
|
||||
w_alert("Your passwords do not match!");
|
||||
in_pass->value[0] = '\0';
|
||||
in_pass->value_len = 0;
|
||||
in_pass_r->value[0] = '\0';
|
||||
@@ -70,11 +70,11 @@ void init_register_modal_cb(callback_args_t *args) {
|
||||
}
|
||||
}
|
||||
|
||||
dialogue_t *init_register_modal(app_t *app) {
|
||||
w_dialogue_t *m_register_init(w_app_t *app) {
|
||||
if (app == NULL)
|
||||
return NULL;
|
||||
|
||||
group_el_init_t content_pass[] = {{.type = w_input,
|
||||
w_group_el_init_t content_pass[] = {{.type = w_input,
|
||||
.label = "Password",
|
||||
.length = 18,
|
||||
.is_hidden_value = true},
|
||||
@@ -84,28 +84,28 @@ dialogue_t *init_register_modal(app_t *app) {
|
||||
.is_hidden_value = true},
|
||||
{.type = w_end}};
|
||||
|
||||
group_el_init_t content[] = {
|
||||
w_group_el_init_t content[] = {
|
||||
{.type = w_input, .label = "Username", .length = 18},
|
||||
{.type = w_group, .direction = horizontal, .children = content_pass},
|
||||
{.type = w_input, .label = "Email", .length = 40},
|
||||
{.type = w_end}};
|
||||
|
||||
group_el_init_t actions[] = {
|
||||
w_group_el_init_t actions[] = {
|
||||
{.type = w_button, .label = "Register", .is_default = true, .val.num = 1},
|
||||
{.type = w_button, .label = "Cancel", .is_default = false, .val.num = 2},
|
||||
{.type = w_end}};
|
||||
|
||||
init_dialogue(&(app->modal), "Credentials", "There is information needed",
|
||||
w_dialogue_init(&(app->modal), "Credentials", "There is information needed",
|
||||
&(app->coordinates));
|
||||
dialogue_t *d = &(app->modal);
|
||||
w_dialogue_t *d = &(app->modal);
|
||||
|
||||
d->w.callback = init_register_modal_cb;
|
||||
d->g_content = init_group(&(d->win), &(d->w), content, &(d->id_map), vertical,
|
||||
d->g_content = w_group_init(&(d->win), &(d->w), content, &(d->id_map), vertical,
|
||||
g_content);
|
||||
d->g_action = init_group(&(d->win), &(d->w), actions, &(d->id_map),
|
||||
d->g_action = w_group_init(&(d->win), &(d->w), actions, &(d->id_map),
|
||||
horizontal, g_action);
|
||||
|
||||
dialogue_init_active_id(d);
|
||||
w_dialogue_init_active_id(d);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user