diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-04-26 23:22:07 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-04-26 23:32:47 +0200 |
commit | 7f24b278db67de25d16f38f00afc7c3d44e27a32 (patch) | |
tree | 90d4d68bcc2f535f83a8eb9936ba0c21d3409335 | |
parent | 12ba4cb6543ae0dce3c1e2cea26e407c898a5dd3 (diff) | |
download | NetworkManager-bg/nmtui-quit-fix.tar.gz |
tui: quit from top-level form when exitingbg/nmtui-quit-fix
The top-level form was left on screen after exit (this is visible only
on some types of terminal as vt100), breaking automated tests.
Fixes: b2fb80928e27dc29240e604bab4f391302fc71f3
-rw-r--r-- | clients/tui/nmtui.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clients/tui/nmtui.c b/clients/tui/nmtui.c index 4ed74d4087..70cad5d6ad 100644 --- a/clients/tui/nmtui.c +++ b/clients/tui/nmtui.c @@ -61,6 +61,18 @@ static const struct { nmtui_hostname } }; static const int num_subprograms = G_N_ELEMENTS (subprograms); +static NmtNewtForm *toplevel_form; + +static NmtNewtForm * +quit_func (int argc, char **argv) +{ + if (toplevel_form) + nmt_newt_form_quit (toplevel_form); + + nmtui_quit (); + + return NULL; +} static void main_list_activated (NmtNewtWidget *widget, NmtNewtListbox *listbox) @@ -115,7 +127,7 @@ nmtui_main (gboolean is_top, int argc, char **argv) subprograms[i].func); } nmt_newt_listbox_append (listbox, "", NULL); - nmt_newt_listbox_append (listbox, _("Quit"), nmtui_quit); + nmt_newt_listbox_append (listbox, _("Quit"), quit_func); widget = nmt_newt_button_box_new (NMT_NEWT_BUTTON_BOX_HORIZONTAL); nmt_newt_grid_add (grid, widget, 0, 2); @@ -125,6 +137,8 @@ nmtui_main (gboolean is_top, int argc, char **argv) g_signal_connect (ok, "activated", G_CALLBACK (main_list_activated), listbox); + toplevel_form = form; + return form; } |