]> cygwin.com Git - cygwin-apps/setup.git/blob - SourceSetting.cc
Show overall progress for checking packages in package cache
[cygwin-apps/setup.git] / SourceSetting.cc
1 /*
2 * Copyright (c) 2003, Robert Collins <rbtcollins@hotmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins.
13 *
14 */
15
16 #include "SourceSetting.h"
17 #include "UserSettings.h"
18 #include "io_stream.h"
19 #include "state.h"
20 #include "resource.h"
21 #include "String++.h"
22
23 SourceSetting::SourceSetting ()
24 {
25 const char *fg_ret;
26 if ((fg_ret = UserSettings::instance().get ("last-action")))
27 source = sourceFromString(fg_ret);
28 }
29
30 SourceSetting::~SourceSetting ()
31 {
32 switch (source)
33 {
34 case IDC_SOURCE_DOWNLOAD:
35 UserSettings::instance().set ("last-action", "Download");
36 break;
37 case IDC_SOURCE_NETINST:
38 UserSettings::instance().set ("last-action", "Download,Install");
39 break;
40 case IDC_SOURCE_LOCALDIR:
41 UserSettings::instance().set ("last-action", "Install");
42 break;
43 default:
44 break;
45 }
46 }
47
48 int
49 SourceSetting::sourceFromString(const std::string& aSource)
50 {
51 if (!casecompare(aSource, "Download"))
52 return IDC_SOURCE_DOWNLOAD;
53 if (!casecompare(aSource, "Download,Install"))
54 return IDC_SOURCE_NETINST;
55 if (!casecompare(aSource, "Install"))
56 return IDC_SOURCE_LOCALDIR;
57
58 /* A sanish default */
59 return IDC_SOURCE_NETINST;
60 }
This page took 0.037818 seconds and 5 git commands to generate.