public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH setup 5/5] Simplify PickView::insert_pkg
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
                   ` (2 preceding siblings ...)
  2016-11-18 16:47 ` [PATCH setup 3/5] Ignore malformed lines in a site-list Jon Turney
@ 2016-11-18 16:47 ` Jon Turney
  2016-11-18 16:47 ` [PATCH setup 1/5] Give search edit box autohscroll style Jon Turney
  2016-11-19 16:10 ` [PATCH setup 0/5] Various setup patches Corinna Vinschen
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

This is only called from PickView::setViewMode(), and only when view_style
is not viewStyles::Category, so checking that is redundant.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 PickView.cc | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/PickView.cc b/PickView.cc
index fc6f8c2..3de49f7 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -278,29 +278,9 @@ PickView::insert_pkg (packagemeta & pkg)
 {
   if (!showObsolete && isObsolete (pkg.categories))
     return;
-  
-  if (view_mode != views::Category)
-    {
-      PickLine & line = *new PickPackageLine (*this, pkg);
-      contents.insert (line);
-    }
-  else
-    {
-      for (set <std::string, casecompare_lt_op>::const_iterator x
-	   = pkg.categories.begin (); x != pkg.categories.end (); ++x)
-        {
-	  // Special case - yuck
-	  if (casecompare(*x, "All") == 0)
-	    continue;
-
-	  packagedb db;
-	  PickCategoryLine & catline = 
-	    *new PickCategoryLine (*this, *db.categories.find (*x), 1);
-	  PickLine & line = *new PickPackageLine(*this, pkg);
-	  catline.insert (line);
-	  contents.insert (catline);
-        }
-    }
+
+  PickLine & line = *new PickPackageLine (*this, pkg);
+  contents.insert (line);
 }
 
 void
-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
@ 2016-11-18 16:47 ` Jon Turney
  2016-11-18 16:47 ` [PATCH setup 2/5] Fix validation in RootPage Jon Turney
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 choose.cc | 3 ++-
 ini.h     | 1 +
 main.cc   | 1 +
 root.cc   | 5 ++++-
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/choose.cc b/choose.cc
index 6563cb3..aa1d8e9 100644
--- a/choose.cc
+++ b/choose.cc
@@ -40,6 +40,7 @@ static const char *cvsid =
 #include <process.h>
 #include <algorithm>
 
+#include "ini.h"
 #include "dialog.h"
 #include "resource.h"
 #include "state.h"
@@ -151,7 +152,7 @@ ChooserPage::createListview ()
     exit (11);
   chooser->init(PickView::views::Category);
   chooser->Show(SW_SHOW);
-  chooser->setViewMode (UpgradeAlsoOption || hasManualSelections ?
+  chooser->setViewMode (!is_new_install || UpgradeAlsoOption || hasManualSelections ?
 			PickView::views::PackagePending : PickView::views::Category);
   SendMessage (GetDlgItem (IDC_CHOOSE_VIEW), CB_SETCURSEL, (WPARAM)chooser->getViewMode(), 0);
 
diff --git a/ini.h b/ini.h
index 7f6db22..3072637 100644
--- a/ini.h
+++ b/ini.h
@@ -24,6 +24,7 @@ typedef std::vector <std::string> IniList;
 extern IniList found_ini_list, setup_ext_list;
 const std::string setup_exts[] = { "xz", "bz2", "ini" };
 extern bool is_64bit;
+extern bool is_new_install;
 extern std::string SetupArch;
 extern std::string SetupIniDir;
 extern std::string SetupBaseName;
diff --git a/main.cc b/main.cc
index fbf12fb..6332920 100644
--- a/main.cc
+++ b/main.cc
@@ -84,6 +84,7 @@ extern char **_argv;
 #endif
 
 bool is_64bit;
+bool is_new_install = false;
 std::string SetupArch;
 std::string SetupIniDir;
 
diff --git a/root.cc b/root.cc
index 695590a..1fa562f 100644
--- a/root.cc
+++ b/root.cc
@@ -203,7 +203,10 @@ directory_contains_wrong_version (HWND h)
 
       /* Probably new installation */
       if (!GetBinaryType (cygcheck_exe.c_str (), &type))
-	return 0;
+        {
+          is_new_install = true;
+          return 0;
+        }
       /* 64 bit setup and 64 bit inst? */
       if (type == SCS_32BIT_BINARY && !is_64bit)
 	return 0;
-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH setup 3/5] Ignore malformed lines in a site-list
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
  2016-11-18 16:47 ` [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation Jon Turney
  2016-11-18 16:47 ` [PATCH setup 2/5] Fix validation in RootPage Jon Turney
@ 2016-11-18 16:47 ` Jon Turney
  2016-11-18 16:47 ` [PATCH setup 5/5] Simplify PickView::insert_pkg Jon Turney
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

Ignore malformed lines in a site-list, rather than crashing

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 site.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/site.cc b/site.cc
index 677672e..1485096 100644
--- a/site.cc
+++ b/site.cc
@@ -281,6 +281,11 @@ load_site_list (SiteList& theSites, char *theString)
 		    }
 		}
 	    }
+
+	  /* Ignore malformed lines */
+	  if (!semi || !semi2 || !semi3)
+	    continue;
+
 	  site_list_type newsite (bol, semi, semi2, semi3);
 	  SiteList::iterator i = find (theSites.begin(),
 				       theSites.end(), newsite);
-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH setup 0/5] Various setup patches
@ 2016-11-18 16:47 Jon Turney
  2016-11-18 16:47 ` [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation Jon Turney
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

Jon Turney (5):
  Give search edit box autohscroll style
  Fix validation in RootPage
  Ignore malformed lines in a site-list
  Start chooser in "Pending" view if this is not a first time
    installation
  Simplify PickView::insert_pkg

 PickView.cc | 26 +++-----------------------
 choose.cc   |  3 ++-
 ini.h       |  1 +
 main.cc     |  1 +
 res.rc      |  2 +-
 root.cc     | 24 ++++++++++++++++++------
 root.h      |  4 ++++
 site.cc     |  5 +++++
 8 files changed, 35 insertions(+), 31 deletions(-)

-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH setup 2/5] Fix validation in RootPage
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
  2016-11-18 16:47 ` [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation Jon Turney
@ 2016-11-18 16:47 ` Jon Turney
  2016-11-18 16:47 ` [PATCH setup 3/5] Ignore malformed lines in a site-list Jon Turney
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

RootPage is supposed to disable the next button if the rootdir edit box is
empty, but this currently doesn't work.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 root.cc | 19 ++++++++++++++-----
 root.h  |  4 ++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/root.cc b/root.cc
index ec2588a..695590a 100644
--- a/root.cc
+++ b/root.cc
@@ -39,6 +39,7 @@ static const char *cvsid =
 #include "msg.h"
 #include "package_db.h"
 #include "mount.h"
+#include "propsheet.h"
 
 #include "getopt++/StringOption.h"
 
@@ -64,11 +65,14 @@ static int su[] = { IDC_ROOT_SYSTEM, IDC_ROOT_USER, 0 };
 
 static string orig_root_dir;
 
-static void
-check_if_enable_next (HWND h)
+void
+RootPage::check_if_enable_next (HWND h)
 {
-  EnableWindow (GetDlgItem (h, IDOK),
-		egetString (h, IDC_ROOT_DIR).size() && root_scope);
+  DWORD ButtonFlags = PSWIZB_BACK;
+  // if there's something in the root dir box, and we have a scope, enable next
+  if (egetString (h, IDC_ROOT_DIR).size() && root_scope)
+    ButtonFlags |= PSWIZB_NEXT;
+  GetOwner ()->SetButtons (ButtonFlags);
 }
 
 static void
@@ -76,7 +80,6 @@ load_dialog (HWND h)
 {
   rbset (h, su, root_scope);
   eset (h, IDC_ROOT_DIR, get_root_dir ());
-  check_if_enable_next (h);
 }
 
 static void
@@ -269,6 +272,12 @@ RootPage::OnInit ()
   load_dialog (GetHWND ());
 }
 
+void
+RootPage::OnActivate ()
+{
+  check_if_enable_next (GetHWND ());
+}
+
 bool
 RootPage::wantsActivation() const
 {
diff --git a/root.h b/root.h
index 6e89fb9..326a930 100644
--- a/root.h
+++ b/root.h
@@ -16,9 +16,13 @@ public:
   virtual bool OnMessageCmd (int id, HWND hwndctl, UINT code);
   virtual void OnInit ();
   virtual bool wantsActivation() const;
+  virtual void OnActivate ();
   virtual long OnNext ();
   virtual long OnBack ();
   virtual long OnUnattended ();
+
+ private:
+  void check_if_enable_next (HWND h);
 };
 
 #endif /* SETUP_ROOT_H */
-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH setup 1/5] Give search edit box autohscroll style
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
                   ` (3 preceding siblings ...)
  2016-11-18 16:47 ` [PATCH setup 5/5] Simplify PickView::insert_pkg Jon Turney
@ 2016-11-18 16:47 ` Jon Turney
  2016-11-19 16:10 ` [PATCH setup 0/5] Various setup patches Corinna Vinschen
  5 siblings, 0 replies; 7+ messages in thread
From: Jon Turney @ 2016-11-18 16:47 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

This enables searching for package names longer than will fit in the edit
box, by allowing the text in the edit box to horizontally scroll...

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 res.rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/res.rc b/res.rc
index c20c210..1227418 100644
--- a/res.rc
+++ b/res.rc
@@ -341,7 +341,7 @@ BEGIN
     RTEXT           "&Search", IDC_STATIC, SETUP_SEARCH_X, 33, SETUP_SEARCH_W,
                     10, SS_CENTERIMAGE, WS_EX_RIGHT
     EDITTEXT        IDC_CHOOSE_SEARCH_EDIT, SETUP_SEARCHTEXT_X, 30,
-                    SETUP_SEARCHTEXT_W, 14
+                    SETUP_SEARCHTEXT_W, 14, ES_AUTOHSCROLL
     PUSHBUTTON      "&Clear", IDC_CHOOSE_CLEAR_SEARCH, SETUP_CLEAR_X, 30,
                     SETUP_CLEAR_W, 14
     CONTROL         "&Keep", IDC_CHOOSE_KEEP, "Button", BS_AUTORADIOBUTTON
-- 
2.8.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH setup 0/5] Various setup patches
  2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
                   ` (4 preceding siblings ...)
  2016-11-18 16:47 ` [PATCH setup 1/5] Give search edit box autohscroll style Jon Turney
@ 2016-11-19 16:10 ` Corinna Vinschen
  5 siblings, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2016-11-19 16:10 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

On Nov 18 16:46, Jon Turney wrote:
> Jon Turney (5):
>   Give search edit box autohscroll style
>   Fix validation in RootPage
>   Ignore malformed lines in a site-list
>   Start chooser in "Pending" view if this is not a first time
>     installation
>   Simplify PickView::insert_pkg

Looks good to me, please apply.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-19 16:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 16:47 [PATCH setup 0/5] Various setup patches Jon Turney
2016-11-18 16:47 ` [PATCH setup 4/5] Start chooser in "Pending" view if this is not a first time installation Jon Turney
2016-11-18 16:47 ` [PATCH setup 2/5] Fix validation in RootPage Jon Turney
2016-11-18 16:47 ` [PATCH setup 3/5] Ignore malformed lines in a site-list Jon Turney
2016-11-18 16:47 ` [PATCH setup 5/5] Simplify PickView::insert_pkg Jon Turney
2016-11-18 16:47 ` [PATCH setup 1/5] Give search edit box autohscroll style Jon Turney
2016-11-19 16:10 ` [PATCH setup 0/5] Various setup patches Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).