• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.OSDN Installation Manager Tool


Commit MetaInfo

Revision9b2dfcffa65acbb35725b3d21fdd1233424461e1 (tree)
Zeit2013-01-09 00:34:36
AutorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

Implement "Mark All Upgrades" GUI capability.

Ändern Zusammenfassung

Diff

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
11 2013-01-08 Keith Marshall <keithmarshall@users.sourceforge.net>
22
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+
320 Avoid unnecessary reloading of package list.
421
522 * src/guiexec.cpp (AppWindowMaker::OnCommand) [IDM_REPO_APPLY]:
--- a/src/guidata.rc
+++ b/src/guidata.rc
@@ -4,7 +4,7 @@
44 * $Id$
55 *
66 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
7- * Copyright (C) 2012, MinGW.org Project
7+ * Copyright (C) 2012, 2013, MinGW.org Project
88 *
99 *
1010 * Resource definitions for the mingw-get GUI implementation.
@@ -74,6 +74,7 @@ BEGIN
7474 POPUP "&Installation"
7575 BEGIN
7676 MENUITEM "&Update Catalogue", IDM_REPO_UPDATE
77+ MENUITEM "&Mark All Upgrades", IDM_REPO_MARK_UPGRADES
7778 MENUITEM "&Apply Changes", IDM_REPO_APPLY, GRAYED
7879 MENUITEM SEPARATOR
7980 MENUITEM "&Quit\tAlt+F4", IDM_REPO_QUIT
--- a/src/guiexec.cpp
+++ b/src/guiexec.cpp
@@ -440,6 +440,41 @@ inline unsigned long AppWindowMaker::EnumerateActions( int classified )
440440 return pkgData->Schedule()->EnumeratePendingActions( classified );
441441 }
442442
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+
443478 static int pkgActionCount( HWND dlg, int id, const char *fmt, int classified )
444479 {
445480 /* Helper function to itemise the currently scheduled actions
@@ -620,6 +655,27 @@ long AppWindowMaker::OnCommand( WPARAM cmd )
620655 DispatchDialogueThread( IDD_REPO_UPDATE, pkgInvokeUpdate );
621656 break;
622657
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+
623679 case IDM_REPO_APPLY:
624680 /* Initiated when the user selects the "Apply Changes" option,
625681 * we first reset the error trapping and download request state
--- a/src/guimain.h
+++ b/src/guimain.h
@@ -5,7 +5,7 @@
55 * $Id$
66 *
77 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
8- * Copyright (C) 2012, MinGW.org Project
8+ * Copyright (C) 2012, 2013, MinGW.org Project
99 *
1010 *
1111 * Resource definitions and window management class declarations for
@@ -49,7 +49,8 @@
4949
5050 #define IDM_MAIN_MENU 300
5151 #define IDM_REPO_UPDATE 301
52-#define IDM_REPO_APPLY 302
52+#define IDM_REPO_MARK_UPGRADES 302
53+#define IDM_REPO_APPLY 303
5354 #define IDM_REPO_QUIT 312
5455
5556 #define IDM_PACKAGE_UNMARK 400
--- a/src/pkgbase.h
+++ b/src/pkgbase.h
@@ -5,7 +5,7 @@
55 * $Id$
66 *
77 * 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
99 *
1010 *
1111 * Public interface for the package directory management routines;
@@ -299,6 +299,7 @@ class pkgActionItem
299299 pkgActionItem* GetReference( pkgXmlNode* );
300300 pkgActionItem* GetReference( pkgActionItem& );
301301 pkgActionItem* Schedule( unsigned long, pkgActionItem& );
302+ inline pkgActionItem* SuppressRedundantUpgrades( void );
302303 inline unsigned long CancelScheduledAction( void );
303304 inline void SetPrimary( pkgActionItem* );
304305