aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorKarsten Wiese <annabellesgarden@yahoo.de>2006-12-13 03:34:08 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:48 -0500
commit3b354c557c7a6fcac099b3a20b308853fe596183 (patch)
tree4489c66167db27bed76aae32b5e815666f0050b5 /scripts
parentbfc10001b11e51b59ac901d17c5f05361bd2351d (diff)
[PATCH] kconfig: add "void conf_set_changed_callback(void (*fn)(void))", use it in qconf.cc
Added function sets "void (*conf_changed_callback)(void)". Call it, if .config's changed state changes. Use above in qconf.cc to set gui's save-widget's sensitvity. 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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/confdata.c12
-rw-r--r--scripts/kconfig/lkc_proto.h1
-rw-r--r--scripts/kconfig/qconf.cc13
-rw-r--r--scripts/kconfig/qconf.h3
4 files changed, 27 insertions, 2 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 4bbbb5b09c8d..664fe29dacef 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -767,18 +767,28 @@ int conf_write_autoconf(void)
767} 767}
768 768
769static int sym_change_count; 769static int sym_change_count;
770static void (*conf_changed_callback)(void);
770 771
771void sym_set_change_count(int count) 772void sym_set_change_count(int count)
772{ 773{
774 int _sym_change_count = sym_change_count;
773 sym_change_count = count; 775 sym_change_count = count;
776 if (conf_changed_callback &&
777 (bool)_sym_change_count != (bool)count)
778 conf_changed_callback();
774} 779}
775 780
776void sym_add_change_count(int count) 781void sym_add_change_count(int count)
777{ 782{
778 sym_change_count += count; 783 sym_set_change_count(count + sym_change_count);
779} 784}
780 785
781bool conf_get_changed(void) 786bool conf_get_changed(void)
782{ 787{
783 return sym_change_count; 788 return sym_change_count;
784} 789}
790
791void conf_set_changed_callback(void (*fn)(void))
792{
793 conf_changed_callback = fn;
794}
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 84bb139789a0..15030770d1ad 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -6,6 +6,7 @@ P(conf_read_simple,int,(const char *name, int));
6P(conf_write,int,(const char *name)); 6P(conf_write,int,(const char *name));
7P(conf_write_autoconf,int,(void)); 7P(conf_write_autoconf,int,(void));
8P(conf_get_changed,bool,(void)); 8P(conf_get_changed,bool,(void));
9P(conf_set_changed_callback, void,(void (*fn)(void)));
9 10
10/* menu.c */ 11/* menu.c */
11P(rootmenu,struct menu,); 12P(rootmenu,struct menu,);
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 8d60d99bd9f1..0b2fcc417f59 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -38,6 +38,8 @@
38static QApplication *configApp; 38static QApplication *configApp;
39static ConfigSettings *configSettings; 39static ConfigSettings *configSettings;
40 40
41QAction *ConfigMainWindow::saveAction;
42
41static inline QString qgettext(const char* str) 43static inline QString qgettext(const char* str)
42{ 44{
43 return QString::fromLocal8Bit(gettext(str)); 45 return QString::fromLocal8Bit(gettext(str));
@@ -1306,8 +1308,11 @@ ConfigMainWindow::ConfigMainWindow(void)
1306 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1308 connect(quitAction, SIGNAL(activated()), SLOT(close()));
1307 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); 1309 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this);
1308 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1310 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
1309 QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); 1311 saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
1310 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1312 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
1313 conf_set_changed_callback(conf_changed);
1314 // Set saveAction's initial state
1315 conf_changed();
1311 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 1316 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
1312 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1317 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1313 QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); 1318 QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this);
@@ -1658,6 +1663,12 @@ void ConfigMainWindow::saveSettings(void)
1658 configSettings->writeSizes("/split2", split2->sizes()); 1663 configSettings->writeSizes("/split2", split2->sizes());
1659} 1664}
1660 1665
1666void ConfigMainWindow::conf_changed(void)
1667{
1668 if (saveAction)
1669 saveAction->setEnabled(conf_get_changed());
1670}
1671
1661void fixup_rootmenu(struct menu *menu) 1672void fixup_rootmenu(struct menu *menu)
1662{ 1673{
1663 struct menu *child; 1674 struct menu *child;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 6a9e3b14c227..6fc1c5f14425 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -297,6 +297,9 @@ protected:
297 297
298class ConfigMainWindow : public QMainWindow { 298class ConfigMainWindow : public QMainWindow {
299 Q_OBJECT 299 Q_OBJECT
300
301 static QAction *saveAction;
302 static void conf_changed(void);
300public: 303public:
301 ConfigMainWindow(void); 304 ConfigMainWindow(void);
302public slots: 305public slots: