[RAPPS]
authorAlexander Shaposhnikov <sanchaez@reactos.org>
Sat, 26 Aug 2017 19:41:09 +0000 (19:41 +0000)
committerAlexander Shaposhnikov <sanchaez@reactos.org>
Sat, 26 Aug 2017 19:41:09 +0000 (19:41 +0000)
- Fixed switching between "Installed" and "Available"
- Added default icon to "Installed"

svn path=/branches/GSoC_2017/rapps/; revision=75681

reactos/base/applications/rapps/available.cpp
reactos/base/applications/rapps/gui.cpp

index 09e0d55..f30d8f0 100644 (file)
@@ -240,12 +240,11 @@ VOID CAvailableApps::FreeCachedEntries()
     /* loop and deallocate all the cached app infos in the list */
     while (InfoListPosition)
     {
-        CAvailableApplicationInfo* Info = m_InfoList.GetAt(InfoListPosition);
-        m_InfoList.RemoveHead();
+        CAvailableApplicationInfo* Info = m_InfoList.GetNext(InfoListPosition);
         delete Info;
-
-        InfoListPosition = m_InfoList.GetHeadPosition();
     }
+
+    m_InfoList.RemoveAll();
 }
 
 VOID CAvailableApps::DeleteCurrentAppsDB()
@@ -317,6 +316,7 @@ BOOL CAvailableApps::ForceUpdateAppsDB()
 
 BOOL CAvailableApps::EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
 {
+
     HANDLE hFind = INVALID_HANDLE_VALUE;
     WIN32_FIND_DATAW FindFileData;
 
index 5f3edf2..e9071a6 100644 (file)
@@ -1396,15 +1396,13 @@ private:
             return TRUE;
         }
 
-        ItemInfo = (PINSTALLED_INFO) HeapAlloc(GetProcessHeap(), 0, sizeof(INSTALLED_INFO));
+        ItemInfo = new INSTALLED_INFO(*Info);
         if (!ItemInfo)
         {
             RegCloseKey(Info->hSubKey);
             return FALSE;
         }
 
-        RtlCopyMemory(ItemInfo, Info, sizeof(INSTALLED_INFO));
-
         Index = ListViewAddItem(ItemIndex, 0, szName, (LPARAM) ItemInfo);
 
         /* Get version info */
@@ -1481,7 +1479,7 @@ private:
         nSelectedApps = 0;
         if (EnumType < 0) EnumType = SelectedEnumType;
 
-        if (IS_INSTALLED_ENUM(EnumType))
+        if (IS_INSTALLED_ENUM(SelectedEnumType))
         {
             FreeInstalledAppList();
         }
@@ -1501,6 +1499,9 @@ private:
 
         if (IS_INSTALLED_ENUM(EnumType))
         {
+            HICON hIcon = (HICON) LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
+            ImageList_AddIcon(hImageListView, hIcon);
+            DestroyIcon(hIcon);
             /* Enum installed applications and updates */
             EnumInstalledApplications(EnumType, TRUE, s_EnumInstalledAppProc);
             EnumInstalledApplications(EnumType, FALSE, s_EnumInstalledAppProc);