+2012-12-12 Keith Marshall <keithmarshall@users.sourceforge.net>
+
+ Improve conditionally enabled state manipulation for menu items.
+
+ * src/guidata.rc (IDM_REPO_APPLY): Set its initial state as GRAYED.
+
+ * src/pkgdata.cpp (AppWindowMaker::UpdatePackageMenuBindings):
+ [IDM_PACKAGE_REINSTALL]: Always leave it GRAYED; this is a temporary
+ provision, until the GUI is updated to support "reinstall" capability.
+ [IDM_REPO_APPLY && !(EnumeratePendingActions > 0)]: Make it GRAYED.
+ [IDM_REPO_APPLY && (EnumeratePendingActions > 0)]: Enable it.
+
2012-12-11 Keith Marshall <keithmarshall@users.sourceforge.net>
Implement GUI bindings for processing a schedule of actions.
*/
int state_flag = state;
switch( item )
- {
- /* ...testing against item specific flag groups, to
+ { /* ...testing against item specific flag groups, to
* determine which menu items should be enabled for
* the currently selected list view item...
*/
case IDM_PACKAGE_INSTALL:
- /*
- * "Mark for Installation" is available for packages
+ /* "Mark for Installation" is available for packages
* which exist in the repository, (long-term or new),
* but which are not yet identified as "installed".
*/
break;
case IDM_PACKAGE_REMOVE:
- case IDM_PACKAGE_REINSTALL:
- /*
- * "Mark for Removal" and "Mark for Reinstallation"
+ //case IDM_PACKAGE_REINSTALL: // FIXME: for now, we don't consider this!
+ /* "Mark for Removal" and "Mark for Reinstallation"
* are viable selections only for packages identified
* as "installed", (current or upgradeable).
*/
break;
case IDM_PACKAGE_UPGRADE:
- /*
- * "Mark for Upgrade" is viable only for packages
+ /* "Mark for Upgrade" is viable only for packages
* identified as "installed", and then only when an
* upgrade has been published.
*/
break;
case IDM_PACKAGE_UNMARK:
- /*
- * The "Unmark" facility is available only for packages
+ /* The "Unmark" facility is available only for packages
* which have been marked, (perhaps inadvertently), for
* any of the preceding actions.
*/
EnableMenuItem( menu, item, (state_flag == 0) ? MF_GRAYED : MF_ENABLED );
}
}
+ /* Although it is listed under the "Installation" drop-down menu,
+ * this is also a convenient point to consider activation of the
+ * "Apply Changes" capability.
+ */
+ EnableMenuItem( menu, IDM_REPO_APPLY,
+ (pkgData->Schedule()->EnumeratePendingActions() > 0) ? MF_ENABLED
+ : MF_GRAYED
+ );
}
inline void AppWindowMaker::MarkSchedule( pkgActionItem *pending_actions )