Hello,
I have started to work on winecfg a little in attempt to get used to
some workings of WINE. This is the first real open source project I have
actually tried to submit a patch to. I have started to work on a few
functions that were not implemented yet and before I forget to try to
submit a patch again I thought I would do it now.
The only part I have included in this patch is the ability to remove an
application from the "Application" tab. The way I assumed that this was
to do is remove the appropriate key from the registry and update the
listview. I realize this is a pitiful patch since it really doesn't add
much but I thought I would see if I am doing it correctly and to see if
does what it should. Any help is appreciated(I hope this patch is
inline, my first try at it.
Kirk
Index: programs/winecfg/appdefaults.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/appdefaults.c,v
retrieving revision 1.2
diff -u -r1.2 appdefaults.c
--- programs/winecfg/appdefaults.c 22 Oct 2003 00:01:46 -0000 1.2
+++ programs/winecfg/appdefaults.c 14 Jan 2004 22:44:49 -0000
@@ -102,6 +102,28 @@
WINE_TRACE("new selection is %s\n", currentApp);
}
+static void removeApplication(HWND hDlg)
+{
+ char* key;
+ int keyLength;
+ int newPos = SendDlgItemMessage(hDlg, IDC_LIST_APPS, LB_GETCURSEL, 0, 0);
+ int appLen = SendDlgItemMessage(hDlg, IDC_LIST_APPS, LB_GETTEXTLEN, newPos, 0);
+ if (currentApp) HeapFree(GetProcessHeap(), 0, currentApp);
+ currentApp = HeapAlloc(GetProcessHeap(), 0, appLen+1);
+ return_if_fail(
+ SendDlgItemMessage(hDlg, IDC_LIST_APPS, LB_GETTEXT, newPos, (LPARAM) currentApp) != LB_ERR
+ );
+
+ keyLength = strlen(WINE_KEY_ROOT "\\AppDefaults") + appLen + 1;
+ key = HeapAlloc(GetProcessHeap(), 0, keyLength);
+
+ sprintf(key, WINE_KEY_ROOT "\\AppDefaults\\%s\0", currentApp);
+
+ return_if_fail(
+ RegDeleteKey(HKEY_LOCAL_MACHINE, key) == ERROR_SUCCESS
+ );
+}
+
INT_PTR CALLBACK
AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -124,7 +146,7 @@
refreshDialog(hDlg);
break;
case IDC_REMOVE_APPDEFAULT:
- WRITEME(hDlg);
+ removeApplication(hDlg);
refreshDialog(hDlg);
break;
case IDC_LIST_APPS: