From: Wang YanQing <udknight@gmail.com>
To: mmarek@suse.cz
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
lacombar@gmail.com, dave@gnu.org
Subject: [PATCH]scripts:kconfig:meconf: Add Save button to save config at anytime
Date: Mon, 24 Sep 2012 10:36:40 +0800 [thread overview]
Message-ID: <20120924023640.GA16679@udknight> (raw)
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>
---
| 7 +++++--
scripts/kconfig/mconf.c | 32 +++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 3 deletions(-)
--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
reply other threads:[~2012-09-24 2:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120924023640.GA16679@udknight \
--to=udknight@gmail.com \
--cc=dave@gnu.org \
--cc=lacombar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.