]>
cygwin.com Git - cygwin-apps/setup.git/blob - choose.cc
2 * Copyright (c) 2000, Red Hat, Inc.
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.
9 * A copy of the GNU General Public License can be found at
12 * Written by DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to let the user choose which packages
17 to install, and which versions of the package when more than one
18 version is provided. The "trust" level serves as an indication as
19 to which version should be the default choice. At the moment, all
20 we do is compare with previously installed packages to skip any
21 that are already installed (by setting the action to ACTION_SAME).
22 While the "trust" stuff is supported, it's not really implemented
23 yet. We always prefer the "current" option. In the future, this
24 file might have a user dialog added to let the user choose to not
25 install packages, or to install packages that aren't installed by
28 static char *cvsid
= "\n%%% $Id$\n";
44 #include "filemanip.h"
52 #define NEW_COL_SIZE_SLOP (ICON_MARGIN + 11)
56 static int initialized
= 0;
58 static int full_list
= 0;
60 static int scroll_ulc_x
, scroll_ulc_y
;
62 static HWND lv
, nextbutton
, choose_inst_text
;
64 static int header_height
;
65 static HANDLE sysfont
;
66 static int row_height
;
67 static HANDLE bm_spin
, bm_rtarrow
, bm_checkyes
, bm_checkno
, bm_checkna
;
78 { "Current", 7, 0, 0 },
84 { "Package", 7, 0, 0 },
88 #define NUM_COLUMNS (sizeof (headers) / (sizeof (headers[0])) - 1)
90 int *package_indexes
, nindexes
;
93 isinstalled (Package
*pkg
, int trust
)
95 return pkg
->installed
&& pkg
->info
[trust
].version
&&
96 strcmp (pkg
->installed
->version
, pkg
->info
[trust
].version
) == 0;
99 /* Set the next action given a current action. */
101 set_action (Package
*pkg
, bool preinc
)
103 if (!pkg
->action
|| preinc
)
105 ((int) pkg
->action
)++;
109 /* Exercise the action state machine. */
110 for (;; ((int) pkg
->action
)++)
115 pkg
->action
= (actions
) (ACTION_CURR
- 1);
118 pkg
->action
= ACTION_PREV
;
119 /* fall through intentionally */
123 /* Try to find the next best action. We may not have all of
124 prev, curr, or test but we should have at least one of those. */
126 inf
= pkg
->info
+ pkg
->action
;
127 if (inf
->version
&& inf
->install_exists
)
129 if (isinstalled (pkg
, pkg
->action
))
130 (int) pkg
->action
+= ACTION_SAME
;
134 /* ACTION_SAME_* are used when the installed version is the same
135 as the given action. */
136 case ACTION_SAME_CURR
:
137 case ACTION_SAME_TEST
:
138 if (!preinc
) /* Previously set to this value */
140 (int) pkg
->action
-= ACTION_SAME
+ 1; /* revert to ACTION_CURR, etc. */
142 case ACTION_SAME_PREV
:
143 if (!preinc
) /* Previously set to this value */
145 pkg
->action
= ACTION_UNINSTALL
;
146 /* Fall through intentionally */
147 case ACTION_UNINSTALL
:
152 if (pkg
->installed
&& pkg
->info
[pkg
->installed_ix
].install_exists
)
154 pkg
->trust
= pkg
->installed_ix
;
158 case ACTION_SRC_ONLY
:
159 if (pkg
->info
[pkg
->trust
].source_exists
)
165 case ACTION_SAME_LAST
:
166 pkg
->action
= ACTION_SKIP
;
167 /* Fall through intentionally */
169 if (!pkg
->installed
|| !pkg
->info
[pkg
->installed_ix
].install_exists
)
173 log (0, "should never get here %d\n", pkg
->action
);
177 /* Return an appropriate caption given the current action. */
179 choose_caption (Package
*pkg
)
187 pkg
->trust
= (trusts
) pkg
->action
;
188 return pkg
->info
[pkg
->trust
].version
;
189 case ACTION_SAME_PREV
:
190 case ACTION_SAME_CURR
:
191 case ACTION_SAME_TEST
:
193 case ACTION_UNINSTALL
:
196 return source
== IDC_SOURCE_DOWNLOAD
? "Retrieve" : "Reinstall";
197 case ACTION_SRC_ONLY
:
198 if (pkg
->installed
&& pkg
->installed
->source_exists
)
199 return "Redo Source";
215 hdc
= BeginPaint (hwnd
, &ps
);
217 SelectObject (hdc
, sysfont
);
218 SetBkColor (hdc
, GetSysColor (COLOR_WINDOW
));
221 GetClientRect (hwnd
, &cr
);
225 x
= cr
.left
- scroll_ulc_x
;
226 y
= cr
.top
- scroll_ulc_y
+ header_height
;
229 for (i
= 0; headers
[i
].text
; i
++)
231 TextOut (hdc
, x
+ headers
[i
].x
, 3, headers
[i
].text
, headers
[i
].slen
);
232 MoveToEx (hdc
, x
+ headers
[i
].x
, header_height
-3, &p
);
233 LineTo (hdc
, x
+ headers
[i
].x
+ headers
[i
].width
, header_height
-3);
236 IntersectClipRect (hdc
, cr
.left
, cr
.top
+ header_height
, cr
.right
, cr
.bottom
);
238 for (ii
= 0; ii
< nindexes
; ii
++)
240 i
= package_indexes
[ii
];
241 Package
*pkg
= package
+ i
;
242 int r
= y
+ ii
* row_height
;
243 int by
= r
+ tm
.tmHeight
- 11;
246 TextOut (hdc
, x
+ headers
[CURRENT_COL
].x
, r
,
247 pkg
->installed
->version
, strlen (pkg
->installed
->version
));
248 SelectObject (bitmap_dc
, bm_rtarrow
);
249 BitBlt (hdc
, x
+ headers
[CURRENT_COL
].x
+ headers
[0].width
+ ICON_MARGIN
/2 + HMARGIN
/2, by
,
250 11, 11, bitmap_dc
, 0, 0, SRCCOPY
);
253 const char *s
= choose_caption (pkg
);
254 TextOut (hdc
, x
+ headers
[NEW_COL
].x
+ NEW_COL_SIZE_SLOP
, r
,
256 SelectObject (bitmap_dc
, bm_spin
);
257 BitBlt (hdc
, x
+ headers
[NEW_COL
].x
, by
, 11, 11,
258 bitmap_dc
, 0, 0, SRCCOPY
);
262 check_bm
= bm_checkyes
;
264 check_bm
= bm_checkno
;
266 SelectObject (bitmap_dc
, check_bm
);
267 BitBlt (hdc
, x
+ headers
[SRC_COL
].x
, by
, 11, 11,
268 bitmap_dc
, 0, 0, SRCCOPY
);
270 if (package
[i
].sdesc
)
271 s
= package
[i
].sdesc
;
274 TextOut (hdc
, x
+ headers
[PACKAGE_COL
].x
, r
, s
, strlen (s
));
279 static char *msg
= "Nothing to Install/Update";
280 if (source
== IDC_SOURCE_DOWNLOAD
)
281 msg
= "Nothing to Download";
282 TextOut (hdc
, HMARGIN
, header_height
, msg
, strlen (msg
));
285 EndPaint (hwnd
, &ps
);
289 scroll_common (HWND hwnd
, int which
, int *var
, int code
)
294 si
.cbSize
= sizeof (si
);
296 GetScrollInfo (hwnd
, which
, &si
);
301 si
.nPos
= si
.nTrackPos
;
303 case SB_THUMBPOSITION
:
312 si
.nPos
+= row_height
;
315 si
.nPos
-= row_height
;
318 si
.nPos
+= si
.nPage
* 9/10;
321 si
.nPos
-= si
.nPage
* 9/10;
325 if ((int)si
.nPos
< 0)
327 if (si
.nPos
+ si
.nPage
> si
.nMax
)
328 si
.nPos
= si
.nMax
- si
.nPage
;
331 SetScrollInfo (hwnd
, which
, &si
, TRUE
);
333 int ox
= scroll_ulc_x
;
334 int oy
= scroll_ulc_y
;
338 GetClientRect (hwnd
, &cr
);
340 sr
.top
+= header_height
;
341 ScrollWindow (hwnd
, ox
- scroll_ulc_x
, oy
- scroll_ulc_y
, &sr
, &sr
);
344 ScrollWindow (hwnd
, ox
- scroll_ulc_x
, 0, &sr
, &sr
);
347 static LRESULT CALLBACK
348 list_vscroll (HWND hwnd
, HWND hctl
, UINT code
, int pos
)
350 scroll_common (hwnd
, SB_VERT
, &scroll_ulc_y
, code
);
353 static LRESULT CALLBACK
354 list_hscroll (HWND hwnd
, HWND hctl
, UINT code
, int pos
)
356 scroll_common (hwnd
, SB_HORZ
, &scroll_ulc_x
, code
);
359 static LRESULT CALLBACK
360 list_click (HWND hwnd
, BOOL dblclk
, int x
, int y
, UINT hitCode
)
367 if (y
< header_height
)
370 y
+= scroll_ulc_y
- header_height
;
372 r
= (y
+ ROW_MARGIN
/2) / row_height
;
374 if (r
< 0 || r
>= nindexes
)
377 Package
*pkg
= package
+ package_indexes
[r
];
379 if (x
>= headers
[NEW_COL
].x
- (HMARGIN
/ 2) && x
<= headers
[NEW_COL
+ 1].x
- HMARGIN
/2)
382 if (pkg
->info
[pkg
->trust
].source_exists
&&
383 x
>= headers
[SRC_COL
].x
- HMARGIN
/2 && x
<= headers
[SRC_COL
+ 1].x
- HMARGIN
/2)
387 rect
.left
= headers
[NEW_COL
].x
- scroll_ulc_x
;
388 rect
.right
= headers
[SRC_COL
+ 1].x
- scroll_ulc_x
;
389 rect
.top
= header_height
+ r
* row_height
- scroll_ulc_y
;
390 rect
.bottom
= rect
.top
+ row_height
;
391 InvalidateRect (hwnd
, &rect
, TRUE
);
394 static LRESULT CALLBACK
395 listview_proc (HWND hwnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
400 return HANDLE_WM_HSCROLL (hwnd
, wParam
, lParam
, list_hscroll
);
402 return HANDLE_WM_VSCROLL (hwnd
, wParam
, lParam
, list_vscroll
);
404 return HANDLE_WM_LBUTTONDOWN (hwnd
, wParam
, lParam
, list_click
);
409 return DefWindowProc (hwnd
, message
, wParam
, lParam
);
414 register_windows (HINSTANCE hinst
)
423 memset (&wcex
, 0, sizeof (wcex
));
424 wcex
.cbSize
= sizeof (WNDCLASSEX
);
425 wcex
.style
= CS_HREDRAW
| CS_VREDRAW
;
426 wcex
.lpfnWndProc
= listview_proc
;
427 wcex
.hInstance
= hinst
;
428 wcex
.hIcon
= LoadIcon (0, IDI_APPLICATION
);
429 wcex
.hCursor
= LoadCursor (0, IDC_ARROW
);
430 wcex
.hbrBackground
= (HBRUSH
) (COLOR_WINDOW
+ 1);
431 wcex
.lpszClassName
= "listview";
433 RegisterClassEx (&wcex
);
437 note_width (HDC dc
, char *string
, int addend
, int column
)
442 GetTextExtentPoint32 (dc
, string
, strlen (string
), &s
);
443 if (headers
[column
].width
< s
.cx
+ addend
)
444 headers
[column
].width
= s
.cx
+ addend
;
448 check_existence (Info
*inf
, int check_src
)
450 if (source
== IDC_SOURCE_NETINST
)
452 if (source
== IDC_SOURCE_CWD
)
453 return 0; /* should have already been determined */
455 return (inf
->source
&& _access (inf
->source
, 0) == 0) ? -1 : 1;
457 return (inf
->install
&& _access (inf
->install
, 0) == 0) ? -1 : 1;
461 /* Iterate over the package list, setting the "existence" flags
462 for the source or binary. */
466 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
470 for (Info
*inf
= pkg
->infoscan
; inf
< pkg
->infoend
; inf
++)
472 if (inf
->install_exists
)
475 exists
|= inf
->install_exists
= check_existence (inf
, 0);
476 if (inf
->source_exists
)
479 exists
|= inf
->source_exists
= check_existence (inf
, 1);
482 pkg
->exclude
= EXCLUDE_NOT_FOUND
;
487 default_trust (HWND h
, trusts trust
)
491 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
493 pkg
->action
= (actions
) trust
;
497 GetClientRect (h
, &r
);
498 InvalidateRect (h
, &r
, TRUE
);
500 SetFocus (nextbutton
);
504 set_full_list (HWND h
, int isfull
)
509 if (package_indexes
== 0)
510 package_indexes
= (int *) malloc (npackages
* sizeof (int));
513 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
517 if (isfull
|| !is_full_action (pkg
))
518 package_indexes
[nindexes
++] = pkg
- package
;
522 GetClientRect (h
, &r
);
524 memset (&si
, 0, sizeof (si
));
525 si
.cbSize
= sizeof (si
);
528 si
.nMax
= headers
[2].x
+ headers
[2].width
+ HMARGIN
;
530 SetScrollInfo (h
, SB_HORZ
, &si
, TRUE
);
532 si
.nMax
= nindexes
* row_height
;
533 si
.nPage
= r
.bottom
- header_height
;
534 SetScrollInfo (h
, SB_VERT
, &si
, TRUE
);
536 scroll_ulc_x
= scroll_ulc_y
= 0;
538 InvalidateRect (h
, &r
, TRUE
);
541 SetFocus (nextbutton
);
545 create_listview (HWND dlg
, RECT
*r
)
548 lv
= CreateWindowEx (WS_EX_CLIENTEDGE
,
551 WS_CHILD
| WS_HSCROLL
| WS_VSCROLL
| WS_VISIBLE
,
553 r
->right
-r
->left
+ 1, r
->bottom
-r
->top
+ 1,
555 (HMENU
) MAKEINTRESOURCE(IDC_CHOOSE_LIST
),
558 ShowWindow (lv
, SW_SHOW
);
560 for (i
= 0; headers
[i
].text
; i
++)
561 headers
[i
].width
= 0;
564 sysfont
= GetStockObject (DEFAULT_GUI_FONT
);
565 SelectObject (dc
, sysfont
);
566 GetTextMetrics (dc
, &tm
);
567 header_height
= tm
.tmHeight
+ 5 + 3;
569 bitmap_dc
= CreateCompatibleDC (dc
);
571 row_height
= (tm
.tmHeight
+ tm
.tmExternalLeading
+ ROW_MARGIN
);
572 int irh
= tm
.tmExternalLeading
+ tm
.tmDescent
+ 11 + ROW_MARGIN
;
573 if (row_height
< irh
)
576 for (i
= 0; headers
[i
].text
; i
++)
577 note_width (dc
, headers
[i
].text
, 0, i
);
578 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
582 note_width (dc
, pkg
->installed
->version
, 0, CURRENT_COL
);
583 note_width (dc
, pkg
->installed
->version
, NEW_COL_SIZE_SLOP
, NEW_COL
);
585 for (Info
*inf
= pkg
->infoscan
; inf
< pkg
->infoend
; inf
++)
586 note_width (dc
, inf
->version
, NEW_COL_SIZE_SLOP
, NEW_COL
);
587 note_width (dc
, pkg
->name
, 0, PACKAGE_COL
);
588 note_width (dc
, pkg
->sdesc
, 0, PACKAGE_COL
);
590 note_width (dc
, "keep", NEW_COL_SIZE_SLOP
, NEW_COL
);
591 note_width (dc
, "uninstall", NEW_COL_SIZE_SLOP
, NEW_COL
);
593 headers
[CURRENT_COL
].x
= HMARGIN
/2;
594 headers
[NEW_COL
].x
= headers
[CURRENT_COL
].x
+ headers
[CURRENT_COL
].width
+ NEW_COL_SIZE_SLOP
+ HMARGIN
;
595 headers
[SRC_COL
].x
= headers
[NEW_COL
].x
+ headers
[NEW_COL
].width
+ HMARGIN
;
596 headers
[PACKAGE_COL
].x
= headers
[SRC_COL
].x
+ headers
[SRC_COL
].width
+ HMARGIN
;
598 default_trust (lv
, TRUST_CURR
);
599 set_full_list (lv
, full_list
);
600 static int ta
[] = { IDC_CHOOSE_CURR
, 0 };
601 rbset (dlg
, ta
, IDC_CHOOSE_CURR
);
607 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
611 case IDC_CHOOSE_PREV
:
612 default_trust (lv
, TRUST_PREV
);
613 set_full_list (lv
, full_list
);
615 case IDC_CHOOSE_CURR
:
616 default_trust (lv
, TRUST_CURR
);
617 set_full_list (lv
, full_list
);
620 default_trust (lv
, TRUST_TEST
);
621 set_full_list (lv
, full_list
);
623 case IDC_CHOOSE_FULLPART
:
624 set_full_list (lv
, !full_list
);
628 if (source
== IDC_SOURCE_CWD
)
629 NEXT (IDD_S_INSTALL
);
631 NEXT (IDD_S_DOWNLOAD
);
636 if (source
== IDC_SOURCE_CWD
)
649 GetParentRect (HWND parent
, HWND child
, RECT
*r
)
652 GetWindowRect (child
, r
);
655 ScreenToClient (parent
, &p
);
660 ScreenToClient (parent
, &p
);
666 dialog_proc (HWND h
, UINT message
, WPARAM wParam
, LPARAM lParam
)
674 nextbutton
= GetDlgItem (h
, IDOK
);
675 frame
= GetDlgItem (h
, IDC_LISTVIEW_POS
);
676 choose_inst_text
= GetDlgItem(h
,IDC_CHOOSE_INST_TEXT
);
677 if (source
== IDC_SOURCE_DOWNLOAD
)
678 SetWindowText (choose_inst_text
, "Select packages to download ");
680 SetWindowText (choose_inst_text
, "Select packages to install ");
681 GetParentRect (h
, frame
, &r
);
684 create_listview (h
, &r
);
690 return HANDLE_WM_COMMAND (h
, wParam
, lParam
, dialog_cmd
);
703 if ((*s
== '/' || *s
== ':' || *s
== '\\') && s
[1])
711 find_tar_ext (const char *path
)
713 char *p
= strchr (path
, '\0') - 7;
718 if (strcmp (p
, ".tar.gz") != 0)
721 else if (--p
<= path
|| strcmp (p
, ".tar.bz2") != 0)
727 /* Parse a filename into package, version, and extension components. */
729 parse_filename (const char *in_fn
, fileparse
& f
)
732 char fn
[strlen (in_fn
) + 1];
735 int n
= find_tar_ext (fn
);
740 strcpy (f
.tail
, fn
+ n
);
742 f
.pkg
[0] = f
.what
[0] = '\0';
744 for (ver
= p
; *ver
; ver
++)
745 if (*ver
== '-' || *ver
== '_')
746 if (isdigit (ver
[1]))
752 else if (strcasecmp (ver
, "-src") == 0 ||
753 strcasecmp (ver
, "-patch") == 0)
757 strcpy (f
.what
, strlwr (ver
));
758 strcpy (f
.pkgtar
, p
);
759 strcat (f
.pkgtar
, f
.tail
);
760 ver
= strchr (ver
, '\0');
769 p
= strchr (ver
, '\0');
770 strcpy (f
.pkgtar
, in_fn
);
771 if ((p
-= 4) >= ver
&& strcasecmp (p
, "-src") == 0)
773 strcpy (f
.what
, "src");
775 p
= f
.pkgtar
+ (p
- fn
) + 4;
776 memcpy (p
- 4, p
, strlen (p
));
778 else if ((p
-= 2) >= ver
&& strcasecmp (p
, "-patch") == 0)
780 strcpy (f
.what
, "patch");
782 p
= f
.pkgtar
+ (p
- fn
) + 6;
783 memcpy (p
- 6, p
, strlen (p
));
787 strcpy (f
.ver
, *ver
? ver
: "0.0");
791 /* Return a pointer to a package given the name. */
793 getpkgbyname (const char *pkgname
)
795 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
796 if (strcasecmp (pkg
->name
, pkgname
) == 0)
803 scan2 (char *path
, unsigned int size
)
808 if (!parse_filename (path
, f
))
811 if (f
.what
[0] != '\0' && f
.what
[0] != 's')
814 pkg
= getpkgbyname (f
.pkg
);
819 for (Info
*inf
= pkg
->infoscan
; inf
< pkg
->infoend
; inf
++)
822 else if (strcmp (f
.ver
, inf
->version
) == 0)
824 if (f
.what
[0] == 's')
825 inf
->source_exists
= -1;
827 inf
->install_exists
= -1;
831 /* FIXME: This is really not the right way to do this. We should check
832 the version number of the "found" tar file and put it in the test slot
833 if it is newer than curr, the curr slot if it is newer than prev, etc. */
836 hole
->version
= strdup (f
.ver
);
837 hole
->install
= strdup (f
.pkgtar
);
838 if (!hole
->source
&& f
.what
[0] == 's')
840 hole
->source
= strdup (path
);
841 hole
->source_exists
= -1;
842 hole
->source_size
= size
;
846 hole
->install
= strdup (path
);
847 hole
->install_exists
= -1;
848 hole
->install_size
= size
;
854 scan_downloaded_files ()
859 _Info::_Info (const char *_install
, const char *_version
, int _install_size
,
860 const char *_source
, int _source_size
)
862 memset (this, 0, sizeof (*this));
863 install
= strdup (_install
);
864 version
= strdup (_version
);
865 install_size
= _install_size
;
868 source
= strdup (_source
);
869 source_size
= _source_size
;
877 if (!get_root_dir ())
880 char line
[1000], pkgname
[1000], inst
[1000], src
[1000];
883 FILE *db
= fopen (cygpath ("/etc/setup/installed.db", 0), "rt");
887 while (fgets (line
, 1000, db
))
892 sscanf (line
, "%s %s %d %s %d", pkgname
, inst
, &instsz
, src
, &srcsz
);
894 Package
*pkg
= getpkgbyname (pkgname
);
896 parseable
= parse_filename (inst
, f
);
902 pkg
= new_package (pkgname
);
903 pkg
->info
[TRUST_CURR
].version
= strdup (f
.ver
);
904 pkg
->info
[TRUST_CURR
].install
= strdup (inst
);
905 pkg
->info
[TRUST_CURR
].install_size
= instsz
;
908 pkg
->info
[TRUST_CURR
].source
= strdup (src
);
909 pkg
->info
[TRUST_CURR
].source_size
= srcsz
;
911 pkg
->installed_ix
= TRUST_CURR
;
912 /* Exists on local system but not on download system */
913 pkg
->exclude
= EXCLUDE_NOT_FOUND
;
916 pkg
->installed
= new Info (inst
, f
.ver
, instsz
);
918 if (!pkg
->installed_ix
)
919 for (trusts t
= TRUST_PREV
; t
< NTRUST
; ((int) t
)++)
920 if (pkg
->info
[t
].install
&& strcmp (f
.ver
, pkg
->info
[t
].version
) == 0)
922 pkg
->installed_ix
= t
;
930 package_sort (const void *va
, const void *vb
)
932 Package
*a
= (Package
*)va
;
933 Package
*b
= (Package
*)vb
;
934 return strcmp (a
->name
, b
->name
);
938 do_choose (HINSTANCE h
)
943 bm_spin
= LoadImage (h
, MAKEINTRESOURCE (IDB_SPIN
), IMAGE_BITMAP
, 0, 0, 0);
944 bm_rtarrow
= LoadImage (h
, MAKEINTRESOURCE (IDB_RTARROW
), IMAGE_BITMAP
, 0, 0, 0);
946 bm_checkyes
= LoadImage (h
, MAKEINTRESOURCE (IDB_CHECK_YES
), IMAGE_BITMAP
, 0, 0, 0);
947 bm_checkno
= LoadImage (h
, MAKEINTRESOURCE (IDB_CHECK_NO
), IMAGE_BITMAP
, 0, 0, 0);
948 bm_checkna
= LoadImage (h
, MAKEINTRESOURCE (IDB_CHECK_NA
), IMAGE_BITMAP
, 0, 0, 0);
950 register_windows (h
);
952 if (source
== IDC_SOURCE_DOWNLOAD
|| source
== IDC_SOURCE_CWD
)
953 scan_downloaded_files ();
955 read_installed_db ();
958 qsort (package
, npackages
, sizeof (package
[0]), package_sort
);
960 rv
= DialogBox (h
, MAKEINTRESOURCE (IDD_CHOOSE
), 0, dialog_proc
);
962 fatal (IDS_DIALOG_FAILED
);
964 log (LOG_BABBLE
, "Chooser results...");
965 for (Package
*pkg
= package
; pkg
->name
; pkg
++)
967 static char *infos
[] = {"nada", "prev", "curr", "test"};
968 const char *trust
= ((pkg
->trust
== TRUST_PREV
) ? "prev"
969 : (pkg
->trust
== TRUST_CURR
) ? "curr"
970 : (pkg
->trust
== TRUST_TEST
) ? "test"
972 const char *action
= choose_caption (pkg
);
973 const char *installed
= ((pkg
->installed_ix
== -1) ? "none"
974 : (pkg
->installed_ix
== TRUST_PREV
) ? "prev"
975 : (pkg
->installed_ix
== TRUST_CURR
) ? "curr"
976 : (pkg
->installed_ix
== TRUST_TEST
) ? "test"
978 const char *excluded
= (pkg
->exclude
? "yes" : "no");
980 log (LOG_BABBLE
, "[%s] action=%s trust=%s installed=%s excluded=%s src?=%s",
981 pkg
->name
, action
, trust
, installed
,
982 excluded
, pkg
->srcpicked
? "yes" : "no");
983 for (int t
= 1; t
< NTRUST
; t
++)
985 if (pkg
->info
[t
].install
)
986 log (LOG_BABBLE
, " [%s] ver=%s\r\n"
987 " inst=%s %d exists=%s\r\n"
988 " src=%s %d exists=%s",
990 pkg
->info
[t
].version
?: "(none)",
991 pkg
->info
[t
].install
?: "(none)",
992 pkg
->info
[t
].install_size
,
993 (pkg
->info
[t
].install_exists
) ? "yes":"no",
994 pkg
->info
[t
].source
?: "(none)",
995 pkg
->info
[t
].source_size
,
996 (pkg
->info
[t
].source_exists
== 1) ? "yes" : "no");
This page took 0.080049 seconds and 5 git commands to generate.