OSDN Git Service

Work around a GUI action scheduling instability.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 24 Dec 2012 20:45:33 +0000 (20:45 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 24 Dec 2012 20:45:33 +0000 (20:45 +0000)
ChangeLog
src/guiexec.cpp
src/guimain.h
src/pkgdata.cpp

index d573c07..a7e9f86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-12-24  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Work around a GUI action scheduling instability.
+
+       * src/guimain.h (AppWindowMaker::UpdateDataSheet): Declare new method.
+       * src/pkgdata.cpp (AppWindowMaker::UpdateDataSheet): Implement it.
+       (AppWindowMaker::OnNotify): Use it.
+
+       * src/guiexec.cpp (AppWindowMaker::OnCommand) [IDD_REPO_APPLY]:
+       Don't refresh package list view in-place; clear and reload it instead.
+
 2012-12-21  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Update distribution build rules.
index 32fece3..d447c71 100644 (file)
@@ -697,6 +697,9 @@ long AppWindowMaker::OnCommand( WPARAM cmd )
           * actions schedule, remove all marker icons, and refresh
           * the package list to reflect current status.
           */
+#if 0     /* FIXME: we'd like to just do this in place, but doing
+          * so seems to cause mingw-get to become unstable...
+          */
          pkgListViewMaker pkglist( PackageListView );
          pkglist.UpdateListView();
          
@@ -708,7 +711,17 @@ long AppWindowMaker::OnCommand( WPARAM cmd )
          pkglist.MarkScheduledActions(
              pkgData->ClearScheduledActions( ACTION_PRESERVE_FAILED )
            );
-
+#else
+         /* ...so, for the time being, we must force a complete
+          * reload of the package list; (note that this has the
+          * side effect of clearing any residual action schedule,
+          * so we lose any potential record of failed actions).
+          */
+         ClearPackageList();
+         LoadPackageData( false );
+         UpdatePackageList();
+         UpdateDataSheet();
+#endif
          /* Clearing the schedule of actions may also affect the
           * validity of menu options; update accordingly.
           */
index 35caf19..4da1835 100644 (file)
@@ -184,11 +184,11 @@ class AppWindowMaker: public WTK::MainWindowMaker
     inline void ExecuteScheduledActions( void );
 
   private:
-    virtual long OnCreate();
+    virtual long OnCreate( void );
     virtual long OnCommand( WPARAM );
     virtual long OnNotify( WPARAM, LPARAM );
     virtual long OnSize( WPARAM, int, int );
-    virtual long OnClose();
+    virtual long OnClose( void );
 
     int LayoutEngine( HWND, LPARAM );
     static int CALLBACK LayoutController( HWND, LPARAM );
@@ -212,7 +212,8 @@ class AppWindowMaker: public WTK::MainWindowMaker
     DataSheetMaker *DataSheet;
     WTK::ChildWindowMaker *TabDataPane;
     HWND PackageTabControl, PackageTabPane;
-    void InitPackageTabControl();
+    void InitPackageTabControl( void );
+    void UpdateDataSheet( void );
 };
 
 inline long AppWindowMaker::DialogueResponse( int id, DLGPROC handler )
index 1be0ed7..c8c58a8 100644 (file)
@@ -1176,6 +1176,14 @@ void AppWindowMaker::SelectPackageAction( unsigned mode )
   }
 }
 
+void AppWindowMaker::UpdateDataSheet( void )
+{
+  /* Helper method, called when we wish to update the data sheet
+   * panel, to match the current list view and tab selection.
+   */
+  DataSheet->DisplayData( PackageTabControl, PackageListView );
+}
+
 long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
 {
   /* Handler for notifiable events to be processed in the context
@@ -1198,7 +1206,7 @@ long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
         * pane to display its associated data sheet, and offers a
         * pop-up menu of actions which may be performed on it.
         */
-       DataSheet->DisplayData( PackageTabControl, PackageListView );
+       UpdateDataSheet();
        SelectPackageAction( LVHT_ONITEMICON | LVHT_ONITEMLABEL );
        break;
       }
@@ -1212,7 +1220,7 @@ long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
        /* ...each of which may require the data sheet content
         * to be updated, (to reflect a changed selection).
         */
-       DataSheet->DisplayData( PackageTabControl, PackageListView );
+       UpdateDataSheet();
 
        /* Additionally, for a left click on the package status
         * icon within the list view, we present a pop-up menu