"Configure options" dialog window: remove "Save" button

...because it duplcates the "Save setup" menu item.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-04-19 14:36:41 +04:00
parent 4e232774b2
commit 28231f66d9
1 changed files with 56 additions and 57 deletions

View File

@ -64,7 +64,7 @@ configure_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
{
case DLG_ACTION:
/* message from "Single press" checkbutton */
if (sender != NULL && sender->id == 18)
if (sender != NULL && sender->id == 17)
{
const gboolean not_single = !(((WCheck *) sender)->state & C_BOOL);
Widget *w;
@ -106,12 +106,11 @@ configure_box (void)
N_("Alwa&ys")
};
int pause_options_num = sizeof (pause_options) / sizeof (pause_options[0]);
int pause_options_num = G_N_ELEMENTS (pause_options);
QuickWidget quick_widgets[] = {
/* buttons */
QUICK_BUTTON (38, dlg_width, dlg_height - 3, dlg_height, N_("&Cancel"), B_CANCEL, NULL),
QUICK_BUTTON (26, dlg_width, dlg_height - 3, dlg_height, N_("&Save"), B_EXIT, NULL),
QUICK_BUTTON (14, dlg_width, dlg_height - 3, dlg_height, N_("&OK"), B_ENTER, NULL),
/* other options */
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 12, dlg_height, N_("A&uto save setup"),
@ -159,7 +158,7 @@ configure_box (void)
QUICK_END
};
const size_t qw_num = sizeof (quick_widgets) / sizeof (quick_widgets[0]) - 1;
const size_t qw_num = G_N_ELEMENTS (quick_widgets) - 1;
QuickDialog Quick_input = {
dlg_width, dlg_height, -1, -1,
@ -167,37 +166,48 @@ configure_box (void)
quick_widgets, configure_callback, TRUE
};
int qd_result;
int b0_len, b1_len, b2_len;
int b0_len, b1_len;
int b_len, c_len, g_len, l_len;
size_t i;
#ifdef ENABLE_NLS
{
for (i = 0; i < qw_num; i++)
if (i < 3)
switch (i)
{
case 0:
case 1:
/* buttons */
quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
else if ((i == 13) || (i == 15) || (i == 19) || (i == 24))
break;
case 12:
case 14:
case 18:
case 23:
/* groupboxes */
quick_widgets[i].u.groupbox.title = _(quick_widgets[i].u.groupbox.title);
else if (i == 14)
break;
case 13:
{
/* radio button */
size_t j;
for (j = 0; j < (size_t) pause_options_num; j++)
pause_options[j] = _(pause_options[j]);
}
else if (i == 17)
break;
case 15:
/* input line */
break;
case 16:
/* label */
quick_widgets[i].u.label.text = _(quick_widgets[i].u.label.text);
else if (i != 16)
break;
default:
/* checkboxes */
quick_widgets[i].u.checkbox.text = _(quick_widgets[i].u.checkbox.text);
break;
}
Quick_input.title = _(Quick_input.title);
}
#endif /* ENABLE_NLS */
/* calculate widget and dialog widths */
@ -205,26 +215,25 @@ configure_box (void)
dlg_width = max (dlg_width, str_term_width1 (Quick_input.title) + 4);
/* buttons */
b0_len = str_term_width1 (quick_widgets[0].u.button.text) + 3;
b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 3;
b2_len = str_term_width1 (quick_widgets[2].u.button.text) + 5;
b_len = b0_len + b1_len + b2_len + 2;
b1_len = str_term_width1 (quick_widgets[1].u.button.text) + 5;
b_len = b0_len + b1_len + 1;
/* checkboxes within groupboxes */
c_len = 0;
for (i = 3; i < 24; i++)
if ((i < 13) || (i == 18) || (i > 19))
for (i = 2; i < 23; i++)
if ((i < 12) || (i == 17) || (i > 18))
c_len = max (c_len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 3);
/* radiobuttons */
for (i = 0; i < (size_t) pause_options_num; i++)
c_len = max (c_len, str_term_width1 (pause_options[i]) + 3);
/* label + input */
l_len = str_term_width1 (quick_widgets[17].u.label.text);
l_len = str_term_width1 (quick_widgets[16].u.label.text);
c_len = max (c_len, l_len + 1 + 8);
/* groupboxes */
g_len = max (c_len + 2, str_term_width1 (quick_widgets[24].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[19].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[15].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[13].u.groupbox.title) + 4);
g_len = max (c_len + 2, str_term_width1 (quick_widgets[23].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[18].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[14].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[12].u.groupbox.title) + 4);
/* dialog width */
Quick_input.xlen = max (dlg_width, g_len * 2 + 9);
Quick_input.xlen = max (Quick_input.xlen, b_len + 2);
@ -236,43 +245,33 @@ configure_box (void)
quick_widgets[i].x_divisions = Quick_input.xlen;
/* groupboxes */
quick_widgets[15].u.groupbox.width =
quick_widgets[19].u.groupbox.width =
quick_widgets[24].u.groupbox.width = Quick_input.xlen / 2 - 4;
quick_widgets[13].u.groupbox.width = Quick_input.xlen / 2 - 3;
quick_widgets[14].u.groupbox.width =
quick_widgets[18].u.groupbox.width =
quick_widgets[23].u.groupbox.width = Quick_input.xlen / 2 - 4;
quick_widgets[12].u.groupbox.width = Quick_input.xlen / 2 - 3;
/* input */
quick_widgets[16].relative_x = quick_widgets[17].relative_x + l_len + 1;
quick_widgets[16].u.input.len = quick_widgets[19].u.groupbox.width - l_len - 4;
quick_widgets[15].relative_x = quick_widgets[16].relative_x + l_len + 1;
quick_widgets[15].u.input.len = quick_widgets[18].u.groupbox.width - l_len - 4;
/* right column */
quick_widgets[13].relative_x = Quick_input.xlen / 2;
for (i = 3; i < 13; i++)
quick_widgets[i].relative_x = quick_widgets[13].relative_x + 2;
quick_widgets[12].relative_x = Quick_input.xlen / 2;
for (i = 2; i < 12; i++)
quick_widgets[i].relative_x = quick_widgets[12].relative_x + 2;
/* buttons */
quick_widgets[2].relative_x = (Quick_input.xlen - b_len) / 2;
quick_widgets[1].relative_x = quick_widgets[2].relative_x + b2_len + 1;
quick_widgets[0].relative_x = quick_widgets[1].relative_x + b1_len + 1;
quick_widgets[1].relative_x = (Quick_input.xlen - b_len) / 3;
quick_widgets[0].relative_x = 2 * quick_widgets[1].relative_x + b1_len + 1;
g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);
if (!old_esc_mode)
quick_widgets[16].options = quick_widgets[17].options = W_DISABLED;
quick_widgets[15].options = quick_widgets[16].options = W_DISABLED;
qd_result = quick_dialog (&Quick_input);
if ((qd_result == B_ENTER) || (qd_result == B_EXIT))
if (quick_dialog (&Quick_input) == B_ENTER)
old_esc_mode_timeout = atoi (time_out_new);
g_free (time_out_new);
/* Save button */
if (qd_result == B_EXIT)
{
save_config ();
mc_config_save_file (mc_main_config, NULL);
}
}
/* --------------------------------------------------------------------------------------------- */