2012-12-11 Keith Marshall <keithmarshall@users.sourceforge.net>
+ Implement GUI bindings for processing a schedule of actions.
+
+ * src/guimain.h (IDD_DMH_CONSOLE): New resource ID; define it.
+ (IDD_APPLY_EXECUTE): New dialogue template resource ID; define it.
+ (AppWindowMaker::ExecuteScheduledActions): New method; declare it.
+
+ * src/guidata.rc (IDD_APPLY_EXECUTE): Implement dialogue template.
+
+ * src/guixmld.cpp (pkgApplyChanges): New thread function; implement it.
+ (AppWindowMaker::OnCommand) [IDD_REPO_APPLY]: Use it; it is invoked...
+ (IDD_APPLY_EXECUTE): ...via this dialogue box, subsequently calling...
+ (AppWindowMaker::ExecuteScheduledActions): ...this; implement it.
+
+ * src/pkgexec.cpp (pkgActionItem::Execute): Add argument; use it.
+ (pkgActionItem::~pkgActionItem): Unlink chained references.
+
+ * src/pkgbase.h (pkgActionItem::Execute): Adjust prototype.
+
+2012-12-11 Keith Marshall <keithmarshall@users.sourceforge.net>
+
Do not preserve unnecessary download requests.
* src/pkginet.cpp (pkgActionItem::DownloadArchiveFiles):
EDITTEXT IDD_APPLY_INSTALLS_PACKAGES, 7, 148, 292, 36, WS_VSCROLL | ES_VT100
END
-/* Template for GUI styled package download monitoring dialogue box.
+/* Template for a GUI styled package download monitoring dialogue box.
*/
IDD_APPLY_DOWNLOAD DIALOG DISCARDABLE 10, 20, 280, 52
CAPTION "Download Package"
| PBS_SMOOTH, 6, 35, 268, 10
END
+IDD_APPLY_EXECUTE DIALOG DISCARDABLE 10, 10, 306, 193
+CAPTION "Applying Scheduled Changes"
+STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_CAPTION | WS_DLGFRAME
+FONT 10, "Verdana"
+BEGIN
+ LTEXT "", IDD_PROGRESS_MSG, 7, 6, 294, 10
+ AUTOCHECKBOX "Close dialogue automatically, when activity is complete.", \
+ IDD_AUTO_CLOSE_OPTION, 8, 19, 240, 11
+ DEFPUSHBUTTON "Close", IDOK, 258, 18, 40, 12, WS_GROUP | WS_DISABLED
+ GROUPBOX "Details", IDD_PROGRESS_TXT, 6, 35, 294, 152
+ EDITTEXT IDD_DMH_CONSOLE, 7, 45, 292, 141, WS_BORDER | WS_VSCROLL | ES_VT100
+END
+
/* $RCSfile$: end of file */
#define IDD_APPLY_APPROVE 630
#define IDD_APPLY_DOWNLOAD 631
+#define IDD_APPLY_EXECUTE 632
#define IDD_APPLY_REMOVES_PACKAGES 633
#define IDD_APPLY_REMOVES_SUMMARY 634
#define IDD_APPLY_INSTALLS_PACKAGES 637
#define IDD_APPLY_INSTALLS_SUMMARY 638
+#define IDD_DMH_CONSOLE 650
+
#define ID_PKGLIST_TABLE_HEADINGS 1024
#define ID_PKGNAME_COLUMN_HEADING 1025
#define ID_PKGTYPE_COLUMN_HEADING 1026
inline unsigned long EnumerateActions( int = 0 );
inline void DownloadArchiveFiles( void );
+ inline void ExecuteScheduledActions( void );
private:
virtual long OnCreate();
}
}
+inline void AppWindowMaker::ExecuteScheduledActions( void )
+{
+ /* Helper method to delegate execution of a schedule of actions from
+ * the application window to its associated action item controller.
+ */
+ pkgData->Schedule()->Execute( false );
+ pkgData->UpdateSystemMap();
+}
+
+static void pkgApplyChanges( void *window )
+{
+ /* Worker thread processing function, run while displaying the
+ * IDD_APPLY_EXECUTE dialogue box, to apply scheduled changes.
+ */
+ dmh_setpty( GetDlgItem( (HWND)(window), IDD_DMH_CONSOLE ) );
+ GetAppWindow( GetParent( (HWND)(window) ))->ExecuteScheduledActions();
+ dmh_setpty( NULL );
+
+ /* During processing, the user may have selected the option for
+ * automatic dismissal of the dialogue box on completion...
+ *
+ * FIXME: We need to adapt this, so that auto-close is ignored
+ * when any scheduled action fails to complete successfully.
+ */
+ if( IsDlgButtonChecked( (HWND)(window), IDD_AUTO_CLOSE_OPTION ) )
+ /*
+ * ...in which case, we dismiss it without further ado...
+ */
+ SendMessage( (HWND)(window), WM_COMMAND, (WPARAM)(IDOK), 0 );
+
+ else
+ { /* ...otherwise, we activate the manual dismissal button...
+ */
+ HWND dlg;
+ if( (dlg = GetDlgItem( (HWND)(window), IDOK )) != NULL )
+ EnableWindow( dlg, TRUE );
+
+ /* ...and notify the user that it must be clicked to continue.
+ */
+ if( (dlg = GetDlgItem( (HWND)(window), IDD_PROGRESS_MSG )) != NULL )
+ SendMessage( dlg, WM_SETTEXT, 0,
+ (LPARAM)("All changes have been successfully applied; you may close this dialogue.")
+ );
+ }
+}
+
static int CALLBACK pkgDialogue
( HWND window, unsigned int msg, WPARAM wParam, LPARAM lParam )
{
return pkgData->Schedule()->EnumeratePendingActions( classified );
}
-pkgActionItem *pkgActionItem::Clear( pkgActionItem *schedule, unsigned long mask )
-# define ACTION_PRESERVE_FAILED (ACTION_DOWNLOAD_FAILED | ACTION_APPLY_FAILED)
+pkgActionItem
+*pkgActionItem::Clear( pkgActionItem *schedule, unsigned long mask )
+#define ACTION_PRESERVE_FAILED (ACTION_DOWNLOAD_FAILED | ACTION_APPLY_FAILED)
{
/* Method to remove those action items which have no attribute flags in common
* with the specified mask, from the schedule; return the residual schedule of
/* When "Apply" confirmation is forthcoming, we proceed to
* download any required packages, and invoke the scheduled
* remove, upgrade, or install actions.
- *
- * FIXME: the pkgInvokeDownload() thread handler has yet to
- * be implemented.
*/
DispatchDialogueThread( IDD_APPLY_DOWNLOAD, pkgInvokeDownload );
-// DispatchDialogueThread( IDD_APPLY_MONITORED, pkgApplyChanges );
+ DispatchDialogueThread( IDD_APPLY_EXECUTE, pkgApplyChanges );
/* After applying changes, we fall through...
*/
/* Methods for processing all scheduled actions.
*/
- void Execute();
+ void Execute( bool = true );
inline void DownloadArchiveFiles( void );
/* Method to manipulate error trapping, control, and state
);
}
-void pkgActionItem::Execute()
+void pkgActionItem::Execute( bool with_download )
{
if( this != NULL )
{
* be necessary to fetch all required archives into
* the local package cache.
*/
- DownloadArchiveFiles( current );
+ if( with_download )
+ DownloadArchiveFiles( current );
} while( SetAuthorities( current ) > 0 );
else while( current != NULL )
* the same memory referenced by "max_wanted".
*/
free( (void *)(min_wanted) );
+
+ /* Also ensure that we preserve the integrity of any linked list of
+ * action items in which this item participates, by detaching this
+ * item from the pointer chain.
+ */
+ if( prev != NULL ) prev->next = next;
+ if( next != NULL ) next->prev = prev;
}
/*