[shell32] Control panel should display something if there are no applets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The control panel was silently doing nothing if there are no applets (which is probably quite common for Wine installations)

Changelog
	+ Check FindFirstFile against INVALID_HANDLE_VALUE not 0
	+ Display window & messagebox even if there are no applets
diff -u -r dlls/shell32/control.c dlls/shell32/control.c
--- dlls/shell32/control.c	2003-12-03 15:35:24.000000000 +0000
+++ dlls/shell32/control.c	2003-12-09 20:27:51.000000000 +0000
@@ -268,7 +268,12 @@
 	 Control_WndProc_Create(hWnd, (CREATESTRUCTA*)lParam2);
 	 return 0;
       case WM_DESTROY:
-	 while ((panel->first = Control_UnloadApplet(panel->first)));
+         {
+	    CPlApplet*	applet = panel->first;
+	    while (applet)
+	       applet = Control_UnloadApplet(applet);
+         }
+         PostQuitMessage(0);
 	 break;
       case WM_PAINT:
 	 return Control_WndProc_Paint(panel, lParam1);
@@ -288,7 +293,7 @@
 {
     WNDCLASSA	wc;
     MSG		msg;
-
+    const CHAR* appName = "Wine Control Panel";
     wc.style = CS_HREDRAW|CS_VREDRAW;
     wc.lpfnWndProc = Control_WndProc;
     wc.cbClsExtra = 0;
@@ -302,16 +307,22 @@
 
     if (!RegisterClassA(&wc)) return;
 
-    CreateWindowExA(0, wc.lpszClassName, "Wine Control Panel",
+    CreateWindowExA(0, wc.lpszClassName, appName,
 		    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
 		    CW_USEDEFAULT, CW_USEDEFAULT,
 		    CW_USEDEFAULT, CW_USEDEFAULT,
 		    hWnd, NULL, hInst, panel);
     if (!panel->hWnd) return;
+
+    if (!panel->first) {
+	/* FIXME appName & message should be localized  */
+	MessageBoxA(panel->hWnd, "Cannot load any applets", appName, MB_OK);
+	return;
+    }
+
     while (GetMessageA(&msg, panel->hWnd, 0, 0)) {
         TranslateMessage(&msg);
         DispatchMessageA(&msg);
-	if (!panel->first) break;
     }
 }
 
@@ -328,7 +339,7 @@
     *p++ = '\\';
     lstrcpyW(p, wszAllCpl);
 
-    if ((h = FindFirstFileW(buffer, &fd)) != 0) {
+    if ((h = FindFirstFileW(buffer, &fd)) != INVALID_HANDLE_VALUE) {
         do {
 	   lstrcpyW(p, fd.cFileName);
 	   Control_LoadApplet(hWnd, buffer, panel);
@@ -336,7 +347,7 @@
 	FindClose(h);
     }
 
-    if (panel->first) Control_DoInterface(panel, hWnd, hInst);
+    Control_DoInterface(panel, hWnd, hInst);
 }
 
 static	void	Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux