Changeset 1410


Ignore:
Timestamp:
Mar 29, 2009, 5:43:09 PM (17 years ago)
Author:
Gregg Young
Message:

Add code to delete old style ini keys when a state is deleted.

Location:
trunk/dll
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1409 r1410  
    8484  08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code
    8585  19 Mar 09 GKY Moved DeletePresParams to presparam.c
     86  28 Mar 09 GKY Add RemoveOldCnrSwitches to remove pre 3.16 style ini keys;
     87                add State.version key for check
    8688
    8789***********************************************************************/
     
    29452947    sprintf(szKey, "%sTargetDir", szPrefix);
    29462948    PrfWriteProfileString(fmprof, FM3Str, szKey, targetdir);
     2949    sprintf(szKey, "%sVersion", szPrefix);
     2950    PrfWriteProfileString(fmprof, FM3Str, szKey, "3.16");
    29472951  }
    29482952
     
    30113015
    30123016  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    3013   if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp))
     3017  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp)) {
     3018    ULONG size = 0;
     3019
     3020    sprintf(szKey, "%sVersion", szPrefix);
     3021    PrfQueryProfileSize(fmprof, FM3Str, szKey, &size);
     3022    if (!size && fSaveState) {
     3023      for (ulTemp = 0; ulTemp < previous_numsaves; ulTemp++)
     3024        RemoveOldCnrSwitches(szPrefix, ulTemp);
     3025       sprintf(szKey, "%sVersion", szPrefix);
     3026       PrfWriteProfileString(fmprof, FM3Str, szKey, "3.16");
     3027      }
    30143028    for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
    30153029      sprintf(szKeyBase, "%sDirCnr.%lu", szPrefix, ulTemp);
    30163030      RemoveCnrSwitches(szKeyBase, NULL);
    30173031    }
     3032  }
    30183033  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    30193034  if (numsaves) {
     
    31993214              driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
    32003215            RemoveCnrSwitches(szKeyBase, NULL);
     3216            RemoveOldCnrSwitches(szPrefix, x);
    32013217            continue;
    32023218          }
     
    46254641                sprintf(szKeyBase, "%s.DirCnr.%lu", szStateName, x);
    46264642                RemoveCnrSwitches(szKeyBase, szStateName);
     4643                size = 0;
     4644                sprintf(szKey, "%sVersion", szStateName);
     4645                if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
     4646                  RemoveOldCnrSwitches(szStateName, x);
    46274647              }
    46284648            }
  • trunk/dll/misc.c

    r1409 r1410  
    5858  08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code
    5959  08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used)
     60  28 Mar 09 GKY Add RemoveOldCnrSwitches to remove pre 3.16 style ini keys;
     61                add State.version key for check
    6062
    6163***********************************************************************/
     
    14871489  strcpy(eos, "DetailsLATime");
    14881490  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1491
     1492#ifdef NEVER
     1493  // activate this code if we ever allow setting of subject location/length per container GKY 3-28-09
    14891494  strcpy(eos, "SubjectInLeftPane");
    14901495  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     
    14931498  strcpy(eos, "SubjectDisplayWidth");
    14941499  PrfWriteProfileData(fmprof, appname, s, NULL, 0);
     1500#endif
     1501
    14951502  strcpy(eos, "Pos");;
    14961503  PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     
    15171524  }
    15181525
     1526}
     1527
     1528/**
     1529 * Removes the pre 3.16 style ini entries when a state is deleted
     1530 */
     1531VOID RemoveOldCnrSwitches(PCSZ szPrefix, ULONG ulTemp)
     1532{
     1533  CHAR szKey[STATE_NAME_MAX_BYTES + 80];
     1534
     1535  sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, ulTemp);
     1536  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
     1537  sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, ulTemp);
     1538  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
     1539  sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, ulTemp);
     1540  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
     1541  sprintf(szKey, "%sDirCnrView.%lu", szPrefix, ulTemp);
     1542  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0);
     1543  sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, ulTemp);
     1544  PrfWriteProfileString(fmprof, FM3Str, szKey, NULL);
     1545  sprintf(szKey, "%sDirCnr.%lu.", szPrefix, ulTemp);
    15191546}
    15201547
  • trunk/dll/misc.h

    r1409 r1410  
    5555VOID WriteDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS *pds, BOOL state);
    5656VOID RemoveCnrSwitches(PCSZ keyroot, PCSZ statename);
     57VOID RemoveOldCnrSwitches(PCSZ szPrefix, ULONG ulTemp);
    5758VOID LoadLibPath(PSZ str, LONG len);
    5859VOID OpenEdit(HWND hwnd);
Note: See TracChangeset for help on using the changeset viewer.