[PATCH] kconfig: new function "bool conf_get_changed(void)"
authorKarsten Wiese <annabellesgarden@yahoo.de>
Wed, 13 Dec 2006 08:34:06 +0000 (00:34 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 13 Dec 2006 17:05:48 +0000 (09:05 -0800)
Run "make xconfig" on a freshly untarred kernel-tree.  Look at the floppy disk
icon of the qt application, that has just started: Its in a normal, active
state.

Mouse click on it: .config is being saved.

This patch series changes things so taht
after the mouse click on the floppy disk icon, the icon is greyed out.
If you mouse click on it now, nothing happens.

If you change some CONFIG_*, the floppy disk icon returns to "active state",
that is, if you mouse click it now, .config is written.

This patch:

Returns sym_change_count to reflect the .config's change state.
All read only accesses of
sym_change_count
are replaced by calls to
conf_get_changed()
.
mconfig.c is manipulated to ask for saving only when
conf_get_changed() returned true.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/lkc_proto.h
scripts/kconfig/mconf.c
scripts/kconfig/qconf.cc

index 4dcb8867b5f4d3ac3940758eef48ef8f312271f8..124b341a18c02190e30bba8b7d28c8ce29aac57c 100644 (file)
@@ -600,7 +600,7 @@ int main(int ac, char **av)
                        input_mode = ask_silent;
                        valid_stdin = 1;
                }
-       } else if (sym_change_count) {
+       } else if (conf_get_changed()) {
                name = getenv("KCONFIG_NOSILENTUPDATE");
                if (name && *name) {
                        fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
index 66b15ef029313468b3918a3dcf89ae1dd65c9aa2..140742ebd73c9b959e779db0b14e75ba5837f6c1 100644 (file)
@@ -432,7 +432,7 @@ int conf_write(const char *name)
                     use_timestamp ? "# " : "",
                     use_timestamp ? ctime(&now) : "");
 
-       if (!sym_change_count)
+       if (!conf_get_changed())
                sym_clear_all_valid();
 
        menu = rootmenu.list;
@@ -765,3 +765,8 @@ int conf_write_autoconf(void)
 
        return 0;
 }
+
+bool conf_get_changed(void)
+{
+       return sym_change_count;
+}
index a263746cfa7de239ba0513b5011b0a090a267d11..9f1823c88b7329190e7d334d8f62c72f8d6d4af9 100644 (file)
@@ -5,6 +5,7 @@ P(conf_read,int,(const char *name));
 P(conf_read_simple,int,(const char *name, int));
 P(conf_write,int,(const char *name));
 P(conf_write_autoconf,int,(void));
+P(conf_get_changed,bool,(void));
 
 /* menu.c */
 P(rootmenu,struct menu,);
index 08a4c7af93ea0ffd9d19b9efcbf02572d7fb94ac..3f9a1321b3e60caa47418b72beba0d27f6e118f3 100644 (file)
@@ -890,14 +890,19 @@ int main(int ac, char **av)
        do {
                conf(&rootmenu);
                dialog_clear();
-               res = dialog_yesno(NULL,
-                                  _("Do you wish to save your "
-                                    "new kernel configuration?\n"
-                                    "<ESC><ESC> to continue."),
-                                  6, 60);
+               if (conf_get_changed())
+                       res = dialog_yesno(NULL,
+                                          _("Do you wish to save your "
+                                            "new kernel configuration?\n"
+                                            "<ESC><ESC> to continue."),
+                                          6, 60);
+               else
+                       res = -1;
        } while (res == KEY_ESC);
        end_dialog();
-       if (res == 0) {
+
+       switch (res) {
+       case 0:
                if (conf_write(NULL)) {
                        fprintf(stderr, _("\n\n"
                                "Error during writing of the kernel configuration.\n"
@@ -905,11 +910,13 @@ int main(int ac, char **av)
                                "\n\n"));
                        return 1;
                }
+       case -1:
                printf(_("\n\n"
                        "*** End of Linux kernel configuration.\n"
                        "*** Execute 'make' to build the kernel or try 'make help'."
                        "\n\n"));
-       } else {
+               break;
+       default:
                fprintf(stderr, _("\n\n"
                        "Your kernel configuration changes were NOT saved."
                        "\n\n"));
index f5628c57640b134fe2f8689fd3993d43f011ca3e..8d60d99bd9f19474e58147a24f4ff6488fa01dad 100644 (file)
@@ -1585,7 +1585,7 @@ void ConfigMainWindow::showFullView(void)
  */
 void ConfigMainWindow::closeEvent(QCloseEvent* e)
 {
-       if (!sym_change_count) {
+       if (!conf_get_changed()) {
                e->accept();
                return;
        }