[PATCH setup 01/11] Remove 'Bin?' column

Jon Turney jon.turney@dronecode.org.uk
Thu Aug 1 16:05:00 GMT 2019


The only use this column appears to have now is that unticking it is the
same as selecting 'uninstall'.

Future work: Make 'Src?' column more independent, rather than
interacting with the 'New' (action) column in non-obvious ways. We
should be able to choose to install source irrespective of the state of
the binary package. (That should also take into account the
'--include-source' option)
---
 PickPackageLine.cc | 32 ++------------------------------
 PickView.cc        |  3 +--
 PickView.h         | 10 +++++-----
 choose.cc          |  1 -
 4 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/PickPackageLine.cc b/PickPackageLine.cc
index 685d632..f64c101 100644
--- a/PickPackageLine.cc
+++ b/PickPackageLine.cc
@@ -32,20 +32,6 @@ PickPackageLine::get_text(int col_num) const
     {
       return pkg.action_caption ();
     }
-  else if (col_num == bintick_col)
-    {
-      const char *bintick = "?";
-      if (/* uninstall or skip */ !pkg.desired ||
-          /* current version */ pkg.desired == pkg.installed ||
-          /* no source */ !pkg.desired.accessible())
-        bintick = "n/a";
-      else if (pkg.picked())
-        bintick = "yes";
-      else
-        bintick = "no";
-
-      return bintick;
-    }
   else if (col_num == srctick_col)
     {
       const char *srctick = "?";
@@ -118,25 +104,11 @@ PickPackageLine::do_action(int col_num, int action_id)
       pkg.select_action(action_id, theView.deftrust);
       return 1;
     }
-  if (col_num == bintick_col)
-    {
-      if (pkg.desired.accessible ())
-        pkg.pick (!pkg.picked ());
-    }
-  else if (col_num == srctick_col)
+
+  if (col_num == srctick_col)
     {
       if (pkg.desired.sourcePackage ().accessible ())
         pkg.srcpick (!pkg.srcpicked ());
-    }
-
-  /* Unchecking binary while source is unchecked or vice versa is equivalent to
-     uninstalling.  It's essential to set desired correctly, otherwise the
-     package gets uninstalled without visual feedback to the user.  The package
-     will not even show up in the "Pending" view! */
-  if ((col_num == bintick_col) || (col_num == srctick_col))
-    {
-      if (!pkg.picked () && !pkg.srcpicked ())
-        pkg.desired = packageversion ();
 
       return 1;
     }
diff --git a/PickView.cc b/PickView.cc
index 8412282..6d7d83d 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -236,9 +236,8 @@ PickView::init_headers (void)
 {
   listview->noteColumnWidthStart();
 
-  // widths of the 'bin' and 'src' checkbox columns just need to accommodate the
+  // width of the 'src' checkbox column just needs to accommodate the
   // column name
-  listview->noteColumnWidth (bintick_col, "");
   listview->noteColumnWidth (srctick_col, "");
 
   // (In category view) accommodate the width of each category name
diff --git a/PickView.h b/PickView.h
index 3715d93..9443a78 100644
--- a/PickView.h
+++ b/PickView.h
@@ -71,16 +71,16 @@ private:
   void insert_category (CategoryTree *);
 };
 
+// column numbers, must match index into pkg_headers[]
 enum
 {
  pkgname_col = 0, // package/category name
  current_col = 1,
  new_col = 2,     // action
- bintick_col = 3,
- srctick_col = 4,
- cat_col = 5,
- size_col = 6,
- pkg_col = 7,     // desc
+ srctick_col = 3,
+ cat_col = 4,
+ size_col = 5,
+ pkg_col = 6     // desc
 };
 
 bool isObsolete (std::set <std::string, casecompare_lt_op> &categories);
diff --git a/choose.cc b/choose.cc
index 2b5e465..c4b8773 100644
--- a/choose.cc
+++ b/choose.cc
@@ -133,7 +133,6 @@ static ListView::Header pkg_headers[] = {
   {"Package",     LVCFMT_LEFT,  ListView::ControlType::text},
   {"Current",     LVCFMT_LEFT,  ListView::ControlType::text},
   {"New",         LVCFMT_LEFT,  ListView::ControlType::popup},
-  {"Bin?",        LVCFMT_LEFT,  ListView::ControlType::checkbox},
   {"Src?",        LVCFMT_LEFT,  ListView::ControlType::checkbox},
   {"Categories",  LVCFMT_LEFT,  ListView::ControlType::text},
   {"Size",        LVCFMT_RIGHT, ListView::ControlType::text},
-- 
2.21.0



More information about the Cygwin-apps mailing list