This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: RFC: [ITP] Installation Profiles packages
Op Thu, 10 Nov 2005 01:51:45 +0100 (MET) schreef Bas van Gompel
in <n2m-g.dku81h.3vvae1b.<at>@buzzy-box.bavag>:
: Op Wed, 9 Nov 2005 17:21:28 +0100 schreef Corinna Vinschen
: in <20051109162128.GA29765<at>calimero.vinschen.de>:
: [...]
:: Which reminds me... isn't there a way that setup could store the latest
:: view of the chooser window the user has selected? For instance, in
:: almost all cases I'd like to see the "Partial" view, not the "Category"
:: view. Can storing the last view be added easily?
:
: It doesn't look hard... I've partly done it. If no-one starts jumping
: up and down saying ``Let me!'', I'll finish it.
Its done.
ChangeLog-entry: (Please fix the <at>.)
2005-11-13 Bas van Gompel <patch-cygsup.buzz<at>bavag.tmfweb.nl>
* choose.h (class ViewSetting): Declare.
* choose.cc (ViewSetting::load, ViewSetting::save): Implement.
(ChooserPage::createListview): Use ViewSetting.
(ChooserPage::OnNext): Store ViewSetting.
--- setup/choose.h 21 May 2005 23:04:02 -0000 2.36
+++ setup/choose.h 12 Nov 2005 19:36:21 -0000
@@ -55,4 +55,13 @@ public:
PickView *chooser;
};
+#include "UserSetting.h"
+class ViewSetting : public UserSetting
+{
+ public:
+ PickView::views value;
+ virtual void load();
+ virtual void save();
+};
+
#endif /* SETUP_CHOOSE_H */
--- setup/choose.cc 9 Sep 2005 19:52:51 -0000 2.142
+++ setup/choose.cc 12 Nov 2005 19:36:21 -0000
@@ -58,6 +58,8 @@ static const char *cvsid =
#include "ControlAdjuster.h"
#include "prereq.h"
+#include "UserSettings.h"
+
using namespace std;
extern ThreeBarProgressPage Progress;
@@ -78,6 +80,39 @@ static ControlAdjuster::ControlInfo Choo
{0, CP_LEFT, CP_TOP}
};
+static ViewSetting ChosenView;
+
+void
+ViewSetting::load()
+{
+ value = PickView::views::Category;
+ io_stream *f = UserSettings::Instance().settingFileForLoad("last-view");
+ if (f)
+ {
+ char view[1000];
+ if (f->gets (view, 1000))
+ {
+ while (String (value.caption()) != String (view) &&
+ ++value != PickView::views::Category) ; // Do nothing
+ }
+ delete f;
+ }
+ log (LOG_PLAIN) << "Loaded last view setting: " << value.caption() << endLog;
+}
+
+void
+ViewSetting::save()
+{
+ io_stream *f = UserSettings::Instance().settingFileForSave("last-view");
+ if (f)
+ {
+ f->write ((String(value.caption()) + "\n").c_str(),
+ strlen (value.caption()) + 1);
+ delete f;
+ log (LOG_PLAIN) << "Saved last view setting: " << value.caption() << endLog;
+ }
+}
+
ChooserPage::ChooserPage ()
{
sizeProcessor.AddControlInfo (ChooserControlsInfo);
@@ -92,11 +127,11 @@ ChooserPage::createListview ()
if (!chooser->Create(this, WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,&r))
// TODO throw exception
exit (11);
- chooser->init(PickView::views::Category);
+ chooser->init(ChosenView.value);
chooser->Show(SW_SHOW);
chooser->defaultTrust (TRUST_CURR);
- chooser->setViewMode (PickView::views::Category);
+ chooser->setViewMode (ChosenView.value);
if (!SetDlgItemText (GetHWND (), IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ()))
log (LOG_BABBLE) << "Failed to set View button caption %ld" <<
GetLastError () << endLog;
@@ -193,6 +228,10 @@ ChooserPage::OnNext ()
logResults();
#endif
+ ChosenView.value = PickView::views::Category;
+ while (String (ChosenView.value.caption()) != String (chooser->mode_caption()) &&
+ ++ChosenView.value != PickView::views::Category) ; // Do nothing
+
PrereqChecker p;
if (p.isMet ())
{
L8r,
Buzz.
--
) | | ---/ ---/ Yes, this | This message consists of true | I do not
-- | | / / really is | and false bits entirely. | mail for
) | | / / a 72 by 4 +-------------------------------+ any1 but
-- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re