The MinGW.OSDN Installation Manager Tool
Revision | 9b2dfcffa65acbb35725b3d21fdd1233424461e1 (tree) |
---|---|
Zeit | 2013-01-09 00:34:36 |
Autor | Keith Marshall <keithmarshall@user...> |
Commiter | Keith Marshall |
Implement "Mark All Upgrades" GUI capability.
@@ -1,5 +1,22 @@ | ||
1 | 1 | 2013-01-08 Keith Marshall <keithmarshall@users.sourceforge.net> |
2 | 2 | |
3 | + Implement "Mark All Upgrades" GUI capability. | |
4 | + | |
5 | + * src/guimain.h (IDM_REPO_APPLY): Renumbered; make room for... | |
6 | + (IDM_REPO_MARK_UPGRADES): ...this new constant; define it. | |
7 | + | |
8 | + * src/guidata.rc (IDM_REPO_MARK_UPGRADES): New option; add it... | |
9 | + (ID_MAIN_WINDOW_WINDOW) [Installation]: ...to this drop-down menu. | |
10 | + | |
11 | + * src/pkgbase.h (pkgActionItem::SuppressRedundantUpgrades): New | |
12 | + public inline method; declare it. | |
13 | + | |
14 | + * src/guiexec.cpp (AppWindowMaker::OnCommand): | |
15 | + [IDM_REPO_MARK_UPGRADES]: Add case handler for this menu selection. | |
16 | + (pkgActionItem::SuppressRedundantUpgrades): New method; implement it. | |
17 | + | |
18 | +2013-01-08 Keith Marshall <keithmarshall@users.sourceforge.net> | |
19 | + | |
3 | 20 | Avoid unnecessary reloading of package list. |
4 | 21 | |
5 | 22 | * src/guiexec.cpp (AppWindowMaker::OnCommand) [IDM_REPO_APPLY]: |
@@ -4,7 +4,7 @@ | ||
4 | 4 | * $Id$ |
5 | 5 | * |
6 | 6 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
7 | - * Copyright (C) 2012, MinGW.org Project | |
7 | + * Copyright (C) 2012, 2013, MinGW.org Project | |
8 | 8 | * |
9 | 9 | * |
10 | 10 | * Resource definitions for the mingw-get GUI implementation. |
@@ -74,6 +74,7 @@ BEGIN | ||
74 | 74 | POPUP "&Installation" |
75 | 75 | BEGIN |
76 | 76 | MENUITEM "&Update Catalogue", IDM_REPO_UPDATE |
77 | + MENUITEM "&Mark All Upgrades", IDM_REPO_MARK_UPGRADES | |
77 | 78 | MENUITEM "&Apply Changes", IDM_REPO_APPLY, GRAYED |
78 | 79 | MENUITEM SEPARATOR |
79 | 80 | MENUITEM "&Quit\tAlt+F4", IDM_REPO_QUIT |
@@ -440,6 +440,41 @@ inline unsigned long AppWindowMaker::EnumerateActions( int classified ) | ||
440 | 440 | return pkgData->Schedule()->EnumeratePendingActions( classified ); |
441 | 441 | } |
442 | 442 | |
443 | +inline pkgActionItem *pkgActionItem::SuppressRedundantUpgrades( void ) | |
444 | +{ | |
445 | + /* Helper method to adjust the schedule of upgrades, after marking | |
446 | + * all installed packages, to exclude all those which are already at | |
447 | + * the most recently available release. | |
448 | + */ | |
449 | + pkgActionItem *head; | |
450 | + if( (head = this) != NULL ) | |
451 | + { | |
452 | + /* First, provided the schedule is not empty, we walk the list | |
453 | + * of scheduled actions, until we find the true first entry... | |
454 | + */ | |
455 | + while( head->prev != NULL ) head = head->prev; | |
456 | + for( pkgActionItem *ref = head; ref != NULL; ref = ref->next ) | |
457 | + { | |
458 | + /* ...and then, we process the list from first entry to last, | |
459 | + * selecting those entries which schedule an upgrade action... | |
460 | + */ | |
461 | + if( ((ref->flags & ACTION_MASK) == ACTION_UPGRADE) | |
462 | + /* | |
463 | + * ...and for which the currently installed release is the | |
464 | + * same as that which an upgrade would install... | |
465 | + */ | |
466 | + && (ref->selection[ to_install ] == ref->selection[ to_remove ]) ) | |
467 | + /* | |
468 | + * ...in which case, we mark this entry for "no action". | |
469 | + */ | |
470 | + ref->flags &= ~ACTION_MASK; | |
471 | + } | |
472 | + } | |
473 | + /* Finally, we return a pointer to the first entry in the schedule. | |
474 | + */ | |
475 | + return head; | |
476 | +} | |
477 | + | |
443 | 478 | static int pkgActionCount( HWND dlg, int id, const char *fmt, int classified ) |
444 | 479 | { |
445 | 480 | /* Helper function to itemise the currently scheduled actions |
@@ -620,6 +655,27 @@ long AppWindowMaker::OnCommand( WPARAM cmd ) | ||
620 | 655 | DispatchDialogueThread( IDD_REPO_UPDATE, pkgInvokeUpdate ); |
621 | 656 | break; |
622 | 657 | |
658 | + case IDM_REPO_MARK_UPGRADES: | |
659 | + /* Initiated when the user selects the "Mark All Upgrades" | |
660 | + * option; in this case, we identify all packages which are | |
661 | + * already installed, and for which upgrades are available, | |
662 | + * and schedule an upgrade action in respect of each. | |
663 | + */ | |
664 | + pkgData->RescheduleInstalledPackages( ACTION_UPGRADE ); | |
665 | + { | |
666 | + /* After scheduling all available upgrades, we must | |
667 | + * update the package list view marker icons... | |
668 | + */ | |
669 | + pkgListViewMaker pkglist( PackageListView ); | |
670 | + pkglist.MarkScheduledActions( | |
671 | + pkgData->Schedule()->SuppressRedundantUpgrades() | |
672 | + ); | |
673 | + } | |
674 | + /* ...and also adjust the menu bindings accordingly. | |
675 | + */ | |
676 | + UpdatePackageMenuBindings(); | |
677 | + break; | |
678 | + | |
623 | 679 | case IDM_REPO_APPLY: |
624 | 680 | /* Initiated when the user selects the "Apply Changes" option, |
625 | 681 | * we first reset the error trapping and download request state |
@@ -5,7 +5,7 @@ | ||
5 | 5 | * $Id$ |
6 | 6 | * |
7 | 7 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
8 | - * Copyright (C) 2012, MinGW.org Project | |
8 | + * Copyright (C) 2012, 2013, MinGW.org Project | |
9 | 9 | * |
10 | 10 | * |
11 | 11 | * Resource definitions and window management class declarations for |
@@ -49,7 +49,8 @@ | ||
49 | 49 | |
50 | 50 | #define IDM_MAIN_MENU 300 |
51 | 51 | #define IDM_REPO_UPDATE 301 |
52 | -#define IDM_REPO_APPLY 302 | |
52 | +#define IDM_REPO_MARK_UPGRADES 302 | |
53 | +#define IDM_REPO_APPLY 303 | |
53 | 54 | #define IDM_REPO_QUIT 312 |
54 | 55 | |
55 | 56 | #define IDM_PACKAGE_UNMARK 400 |
@@ -5,7 +5,7 @@ | ||
5 | 5 | * $Id$ |
6 | 6 | * |
7 | 7 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
8 | - * Copyright (C) 2009, 2010, 2011, 2012, MinGW.org Project | |
8 | + * Copyright (C) 2009, 2010, 2011, 2012, 2013, MinGW.org Project | |
9 | 9 | * |
10 | 10 | * |
11 | 11 | * Public interface for the package directory management routines; |
@@ -299,6 +299,7 @@ class pkgActionItem | ||
299 | 299 | pkgActionItem* GetReference( pkgXmlNode* ); |
300 | 300 | pkgActionItem* GetReference( pkgActionItem& ); |
301 | 301 | pkgActionItem* Schedule( unsigned long, pkgActionItem& ); |
302 | + inline pkgActionItem* SuppressRedundantUpgrades( void ); | |
302 | 303 | inline unsigned long CancelScheduledAction( void ); |
303 | 304 | inline void SetPrimary( pkgActionItem* ); |
304 | 305 |