VirtualBox

Changeset 34398 in vbox


Ignore:
Timestamp:
Nov 26, 2010 4:24:58 PM (14 years ago)
Author:
vboxsync
Message:

Guest Additions update: Don't wait when showing modal progress dialog in GUI.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r34338 r34398  
    14501450            ComPtr<IProgress> progress;
    14511451            CHECK_ERROR(guest, UpdateGuestAdditions(Bstr(Utf8Source).raw(),
    1452                                                     0 /* Flags, not used. */,
     1452                                                    AdditionsUpdateFlag_None,
    14531453                                                    progress.asOutParam()));
    14541454            if (FAILED(rc))
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r34254 r34398  
    364364    CGuest guest = session().GetConsole().GetGuest();
    365365#ifdef DEBUG_andy
    366     CProgress progressInstall = guest.UpdateGuestAdditions("c:\\Downloads\\VBoxGuestAdditions_3.2.8.iso", 0);
     366    CProgress progressInstall = guest.UpdateGuestAdditions("c:\\Downloads\\VBoxGuestAdditions_3.2.8.iso",
     367                                                           AdditionsUpdateFlag_WaitForUpdateStartOnly);
    367368#else
    368     CProgress progressInstall = guest.UpdateGuestAdditions(strSource, 0 /* Flags, not used. */);
     369    /* Since we are going to show a modal progress dialog we don't want to wait for the whole
     370     * update progress being complete - the user might need to interact with the VM to confirm (WHQL)
     371     * popups - instead we only wait until the actual update process was started. */
     372    CProgress progressInstall = guest.UpdateGuestAdditions(strSource,
     373                                                           AdditionsUpdateFlag_WaitForUpdateStartOnly);
    369374#endif
    370375    bool fResult = guest.isOk();
  • trunk/src/VBox/Main/GuestImpl.cpp

    r34368 r34398  
    7979    /* Task data. */
    8080    Utf8Str strSource;
     81    ULONG uFlags;
    8182};
    8283
     
    417418                if (SUCCEEDED(rc))
    418419                {
     420                    /* If the caller does not want to wait for out guest update process to end,
     421                     * complete the progress object now so that the caller can do other work. */
     422                    if (aTask->uFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly)
     423                        aTask->progress->notifyComplete(S_OK);
     424
    419425                    LogRel(("Guest Additions update is running ...\n"));
    420426                    while (SUCCEEDED(progressInstaller->COMGETTER(Completed(&fCompleted))))
     
    466472    /* Clean up */
    467473    aTask->rc = rc;
    468     aTask->progress->SetCurrentOperationProgress(99);
     474    if (SUCCEEDED(   aTask->progress->COMGETTER(Completed(&fCompleted)))
     475                  && !fCompleted)
     476        aTask->progress->SetCurrentOperationProgress(99);
    469477
    470478    if (   SUCCEEDED(aTask->progress->COMGETTER(Canceled(&fCanceled)))
     
    479487        }
    480488
    481         aTask->progress->notifyComplete(rc);
     489        if (SUCCEEDED(   aTask->progress->COMGETTER(Completed(&fCompleted)))
     490                      && !fCompleted)
     491            aTask->progress->notifyComplete(rc);
    482492    }
    483493    else /* The task was canceled, set error code to prevent assertions. */
    484494    {
    485495        LogRel(("Guest Additions update was canceled\n"));
    486         aTask->progress->notifyComplete(VBOX_E_IPRT_ERROR,
    487                                         COM_IIDOF(IGuest),
    488                                         Guest::getStaticComponentName(),
    489                                         "Automatic Guest Additions update was canceled");
     496        if (SUCCEEDED(   aTask->progress->COMGETTER(Completed(&fCompleted)))
     497                      && !fCompleted)
     498            aTask->progress->notifyComplete(VBOX_E_IPRT_ERROR,
     499                                            COM_IIDOF(IGuest),
     500                                            Guest::getStaticComponentName(),
     501                                            "Automatic Guest Additions update was canceled");
    490502    }
    491503
     
    23342346    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    23352347
    2336     /* Validate flags. */
    2337     if (aFlags != CopyFileFlag_None)
    2338     {
    2339         if (   !(aFlags & CopyFileFlag_Recursive)
    2340             && !(aFlags & CopyFileFlag_Update)
    2341             && !(aFlags & CopyFileFlag_FollowLinks))
    2342         {
    2343             return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
    2344         }
    2345     }
     2348    if (aFlags != 0) /* Flags are not supported at the moment. */
     2349        return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
    23462350
    23472351    HRESULT rc = S_OK;
     
    26272631    CheckComArgOutPointerValid(aProgress);
    26282632
    2629     if (aFlags != 0) /* Flags are not supported at the moment. */
    2630         return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
    2631 
    26322633    AutoCaller autoCaller(this);
    26332634    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     2635
     2636    /* Validate flags. */
     2637    if (aFlags)
     2638    {
     2639        if (!(aFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly))
     2640            return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
     2641    }
    26342642
    26352643    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    26562664         * to the Guest Additions .ISO we want to mount. */
    26572665        task->strSource = (Utf8Str(aSource));
     2666        task->uFlags = aFlags;
    26582667
    26592668        rc = task->startThread();
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r34397 r34398  
    77677767    </desc>
    77687768
    7769     <const name="None"     value="0">
     7769    <const name="None"                    value="0">
    77707770      <desc>Guest Additions are not loaded.</desc>
    77717771    </const>
    7772     <const name="System"   value="1">
     7772    <const name="System"                  value="1">
    77737773      <desc>Guest drivers are loaded.</desc>
    77747774    </const>
    7775     <const name="Userland" value="2">
     7775    <const name="Userland"                value="2">
    77767776      <desc>Common components (such as application services) are loaded.</desc>
    77777777    </const>
    7778     <const name="Desktop"  value="3">
     7778    <const name="Desktop"                 value="3">
    77797779      <desc>Per-user desktop components are loaded.</desc>
     7780    </const>
     7781  </enum>
     7782
     7783  <enum
     7784    name="AdditionsUpdateFlag"
     7785    uuid="726a818d-18d6-4389-94e8-3e9e6826171a"
     7786  >
     7787    <desc>
     7788      Guest Additions update flags.
     7789    </desc>
     7790
     7791    <const name="None"                    value="0">
     7792      <desc>No flag set.</desc>
     7793    </const>
     7794    <const name="WaitForUpdateStartOnly"  value="1">
     7795      <desc>Only wait for the update process being started and do not
     7796        wait while peforming the actual update.</desc>
    77807797    </const>
    77817798  </enum>
     
    81868203      <param name="flags" type="unsigned long" dir="in">
    81878204        <desc>
    8188           Copy flags.
     8205          Copy flags. Not used at the moment and must be set to 0.
    81898206        </desc>
    81908207      </param>
     
    82838300      <param name="flags" type="unsigned long" dir="in">
    82848301        <desc>
    8285           Additional flags for update process. Not used at the moment and
    8286           must be set to 0.
     8302          Flags for Guest Additions update.
    82878303        </desc>
    82888304      </param>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette