menuconfig: Add Save button
PATCH v4 1/1 menuconfig: Add Save button
If menuconfig have a Save button like alternative .config editors, xconfig, nconfig, etc.We will have a obvious benefit when use menuconfig just like when we use others, we can save our .config quickly and conveniently.
This patch add the Save button for menuconfig.
V1-V2: Rewrite the most code to make it more correct
V2-V3: Fix the behavior of conf_message_callback when exit. V3-V4:
1: Move Buttons a little left to make them look like symmetrical. 2: Exchange the position between Save button and Exit button. 3: Use conf_save instead of conf_write to make we can save an alternate configuration file with Save button.
--- scripts/kconfig/lxdialog/menubox.c | 21 +++++++++--------- scripts/kconfig/mconf.c | 45 ++++++++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 19 deletions(-)
scripts/kconfig/lxdialog/menubox.c +11 -10
@@ -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).
@@ -154,12 +154,13 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,*/ static void print_buttons (WINDOW * win,int height,int width,int selected) { -int x = width /2 -16 ; +int x = width /2 -20 ;int y = height -2 ;print_button (win,gettext ("Select" ), y, x, selected ==0 ); -print_button (win,gettext (" Exit " ), y, x +12 , selected ==1 ); +print_button (win,gettext (" Save " ), y, x +12 , selected ==1 );print_button (win,gettext (" Help " ), y, x +24 , selected ==2 ); +print_button (win,gettext (" Exit " ), y, x +36 , selected ==3 );wmove (win, y, x +1 +12 * selected);wrefresh (win);
@@ -372,7 +373,7 @@ 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);wrefresh (menu);
@@ -399,17 +400,17 @@ do_resize:return 2 ;case 's' :case 'y' : -return 3 ; -case 'n' :return 4 ; -case 'm' : +case 'n' :return 5 ; -case ' ' : +case 'm' :return 6 ; -case '/' : +case ' ' :return 7 ; -case 'z' : +case '/' :return 8 ; +case 'z' : +return 9 ;case '\n' :return button; }
scripts/kconfig/mconf.c +36 -9
115 lines not on this page · raw message
Signature · 1 line
1.7.11.1.116.g8228a23
Wang, All,
Quoted 7 lines · On Saturday 01 December 2012 Wang YanQing wrote:
If menuconfig have a Save button like alternative .config editors, xconfig, nconfig, etc.We will have a obvious benefit when use menuconfig just like when we use others, we can save our .config quickly and conveniently.
This patch add the Save button for menuconfig.
To make the behavior consistent, may I suggest that you push the concept even a bit further:
- add a "Load" *and* a "Save" buttons
- get rid of the top-level "Load an Alternate Configuration File" and "Save an Alternate Configuration File" entries
For the "Save" and "Load" buttons, please mimick how the nconf frontend
behaves: prompt for the file to save to/load from, and prefill it with the last filename that was entered (".config" per default).
Of course, two patches for that: one for the "Save/Load" buttons, one to get rid of the top-level entries afterward.
Note: I do not state that your use-case is valid or not. That's your call how you configure and test your kernel. However, I think that having a consistent behavior across the frontends is a very nice goal to pursue.
See other comments in-lined, below.
Quoted 19 lines
V1-V2: Rewrite the most code to make it more correct
V2-V3: Fix the behavior ofconf_message_callbackwhen exit. V3-V4:
1: Move Buttons a little left to make them look like symmetrical. 2: Exchange the position between Save button and Exit button. 3: Useconf_saveinstead ofconf_writeto make we can save an alternate configuration file with Save button.Signed-off-by Wang YanQing <[email protected]>--- scripts/kconfig/lxdialog/menubox.c | 21 +++++++++--------- scripts/kconfig/mconf.c | 45 ++++++++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 19 deletions(-)scripts/kconfig/lxdialog/menubox.c +0
-0
scripts/kconfig/lxdialog/menubox.c line 29
Quoted 5 lines
scripts/kconfig/lxdialog/menubox.c +1
-1@@ -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
Space-damage. Don't send trailing-space fixes, or at least add a quick note for it at the end of the commit log (eg.: "remove trailing space while at it").
Quoted 6 lines
scripts/kconfig/lxdialog/menubox.c +0
-0* 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). @@ -154,12 +154,13 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,*/ static void print_buttons (WINDOW * win,int height,int width,int selected)
scripts/kconfig/lxdialog/menubox.c static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, · line 163
Quoted 10 lines
scripts/kconfig/lxdialog/menubox.c +3
-2{ -int x = width /2 -16 ; +int x = width /2 -20 ;int y = height -2 ;print_button (win,gettext ("Select" ), y, x, selected ==0 ); -print_button (win,gettext (" Exit " ), y, x +12 , selected ==1 ); +print_button (win,gettext (" Save " ), y, x +12 , selected ==1 );print_button (win,gettext (" Help " ), y, x +24 , selected ==2 ); +print_button (win,gettext (" Exit " ), y, x +36 , selected ==3 );
The re-ordering should be in a separate patch.
It makes it difficult to separate the code for the new feature from the churn due to the re-ordering.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Hi Yann, All,
Quoted 6 lines · Yann E. MORIN
To make the behavior consistent, may I suggest that you push the concept even a bit further:
- add a "Load" *and* a "Save" buttons
- get rid of the top-level "Load an Alternate Configuration File" and "Save an Alternate Configuration File" entries
Quoted 6 lines
For the "Save" and "Load" buttons, please mimick how the nconf frontend
behaves: prompt for the file to save to/load from, and prefill it with the last filename that was entered (".config" per default).Of course, two patches for that: one for the "Save/Load" buttons, one to get rid of the top-level entries afterward.
Thanks, very good suggestion, I will jump in.
Quoted 4 lines
Note: I do not state that your use-case is valid or not. That's your call how you configure and test your kernel. However, I think that having a consistent behavior across the frontends is a very nice goal to pursue.
I understand, I make a mistake in the comment in previous Email.
Quoted 16 lines
See other comments in-lined, below.
Quoted 14 lines
V1-V2: Rewrite the most code to make it more correct
V2-V3: Fix the behavior ofconf_message_callbackwhen exit. V3-V4:
1: Move Buttons a little left to make them look like symmetrical. 2: Exchange the position between Save button and Exit button. 3: Useconf_saveinstead ofconf_writeto make we can save an alternate configuration file with Save button.Signed-off-by Wang YanQing <[email protected]>--- scripts/kconfig/lxdialog/menubox.c | 21 +++++++++--------- scripts/kconfig/mconf.c | 45 ++++++++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 19 deletions(-)
Quoted 14 lines
scripts/kconfig/lxdialog/menubox.c line 29
Quoted 10 lines
scripts/kconfig/lxdialog/menubox.c +1
-1@@ -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 Space-damage. Don't send trailing-space fixes, or at least add a quick note for it at the end of the commit log (eg.: "remove trailing space while at it").
Ok, it is right.
Thanks Yann E. MORIN, and All