From patchwork Mon Sep 24 02:36:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wang yanqing X-Patchwork-Id: 1496051 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6C595DFFD0 for ; Mon, 24 Sep 2012 02:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754688Ab2IXCgX (ORCPT ); Sun, 23 Sep 2012 22:36:23 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35661 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754410Ab2IXCgX (ORCPT ); Sun, 23 Sep 2012 22:36:23 -0400 Received: by padhz1 with SMTP id hz1so627975pad.19 for ; Sun, 23 Sep 2012 19:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=65J4XxKy/i2pL2s9HUwYZq2B5+45tVxRhPXug8lUoc4=; b=aF9AkEg71poxpb7kV0+aF+iQxy/+mAn9HurTLJ4GxJTSFE9OReCcOd/lGSIDY/pA71 3db+HY7HIkC2S7V9pfHNZ9YgsyoteCVPBYKaSyWFlbRVYQZLFS0osp+wTW4uvmbR7tUa 5DWIuZY4YUV3aIwsxS0g/2dsLOKBerbzN0BnC1C83s9cygx2oE8/7KZBpCmNv2lkD4XQ yGG/svohTeK3wo/72+nxgrK8UGhN8ok6bYKwslXLbrp9wyXoyXIUewqDLUkxoLKHRcLo XgapjumdvpJXSEaH+l6lUmBpuE87e4IX/OcNn2ErFxO0NiFoDFj7oSTIDRWivlgMU0qM sa6A== Received: by 10.68.242.164 with SMTP id wr4mr33250131pbc.41.1348454182523; Sun, 23 Sep 2012 19:36:22 -0700 (PDT) Received: from udknight.localhost ([61.131.64.2]) by mx.google.com with ESMTPS id po4sm8868444pbb.13.2012.09.23.19.36.20 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 19:36:21 -0700 (PDT) Received: from udknight.localhost (udknight.localhost [127.0.0.1]) by udknight.localhost (8.14.4/8.14.4) with ESMTP id q8O2afx4016714; Mon, 24 Sep 2012 10:36:41 +0800 Received: (from root@localhost) by udknight.localhost (8.14.4/8.14.4/Submit) id q8O2aeZ3016711; Mon, 24 Sep 2012 10:36:40 +0800 Date: Mon, 24 Sep 2012 10:36:40 +0800 From: Wang YanQing 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 Message-ID: <20120924023640.GA16679@udknight> Mail-Followup-To: Wang YanQing , mmarek@suse.cz, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, lacombar@gmail.com, dave@gnu.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- 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" + " 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; } -