All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]scripts:kconfig:meconf: Add Save button to save config at anytime
@ 2012-09-24  2:36 Wang YanQing
  0 siblings, 0 replies; only message in thread
From: Wang YanQing @ 2012-09-24  2:36 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kernel, linux-kbuild, lacombar, dave

mconf make me annoying I have to make menuconfig && exit to save
the config when I am tuning .config time by time, it is even
worse I have to search down to my desire submenu time by time.
So I add "Save" button to save our time. With "Save" button,
I can use CRTL-Z after save config, and then use "%" or fg to
resume menuconfig and go on tuning.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 scripts/kconfig/lxdialog/menubox.c |  7 +++++--
 scripts/kconfig/mconf.c            | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 1d60473..a469f09 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -26,7 +26,7 @@
  *
  *    *)  A bugfix for the Page-Down problem
  *
- *    *)  Formerly when I used Page Down and Page Up, the cursor would be set 
+ *    *)  Formerly when I used Page Down and Page Up, the cursor would be set
  *        to the first position in the menu box.  Now lxdialog is a bit
  *        smarter and works more like other menu systems (just have a look at
  *        it).
@@ -160,6 +160,7 @@ static void print_buttons(WINDOW * win, int height, int width, int selected)
 	print_button(win, gettext("Select"), y, x, selected == 0);
 	print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
 	print_button(win, gettext(" Help "), y, x + 24, selected == 2);
+	print_button(win, gettext(" Save "), y, x + 36, selected == 3);
 
 	wmove(win, y, x + 1 + 12 * selected);
 	wrefresh(win);
@@ -372,9 +373,11 @@ do_resize:
 		case TAB:
 		case KEY_RIGHT:
 			button = ((key == KEY_LEFT ? --button : ++button) < 0)
-			    ? 2 : (button > 2 ? 0 : button);
+			    ? 3 : (button > 3 ? 0 : button);
 
 			print_buttons(dialog, height, width, button);
+			if (button == 3)
+				button = 9;
 			wrefresh(menu);
 			break;
 		case ' ':
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index f584a28..beb5ebf9 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -521,6 +521,7 @@ static void conf(struct menu *menu)
 	struct symbol *sym;
 	struct menu *active_menu = NULL;
 	int res;
+	int yesno;
 	int s_scroll = 0;
 
 	while (1) {
@@ -615,6 +616,36 @@ static void conf(struct menu *menu)
 		case 8:
 			show_all_options = !show_all_options;
 			break;
+		case 9:
+			if (!conf_get_changed()) {
+				show_helptext(_("Notice"),
+					_("\n\n"
+						"Your configuration have not been changed."
+						"\n\n"));
+				break;
+			}
+
+			yesno = dialog_yesno(NULL,
+					_("Do you wish to save your "
+						"new configuration?\n"
+						"<ESC><ESC> to continue."),
+					6, 60);
+			if (yesno == 0) {
+				if (conf_write(filename)) {
+					show_helptext(_("Notice"),
+						_("\n\n"
+							"Error while writing of the configuration.\n"
+							"Your configuration changes were NOT saved."
+							"\n\n"));
+				} else {
+					show_helptext(_("Notice"),
+						_("\n\n"
+							"Your configuration changes were saved."
+							"\n\n"));
+
+				}
+			}
+			break;
 		}
 	}
 }
@@ -879,4 +910,3 @@ int main(int ac, char **av)
 
 	return res;
 }
-
-- 
1.7.11.1.116.g8228a23


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-24  2:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-24  2:36 [PATCH]scripts:kconfig:meconf: Add Save button to save config at anytime Wang YanQing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.