Commit 5a2cde65 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

- All settings in the drive edit dialog are now instant apply.

- Replace OK/Cancel buttons on the right with a close button on the bottom. - Warn the user when a C drive is not present. - Add drive functionality will now always create a C drive if one isn't present. - Misc crasher fixes. - Drive list box now reflects drives that take their data from a device correctly. - Various code cleanups.
parent ab58bf17
......@@ -108,27 +108,6 @@ BEGIN
PUSHBUTTON "&Edit",IDC_DRIVE_EDIT,197,80,50,22
END
IDD_DRIVE_EDIT DIALOG DISCARDABLE 0, 0, 207, 110
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Drive Configuration"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",ID_DRIVE_OK,150,7,50,14
PUSHBUTTON "Cancel",ID_DRIVE_CANCEL,150,24,50,14
EDITTEXT IDC_DRIVE_EDIT_NAME,42,8,78,13,ES_AUTOHSCROLL
LTEXT "Drive:",-1,11,10,29,12
EDITTEXT IDC_DRIVE_EDIT_LABEL,42,23,78,13,ES_AUTOHSCROLL
LTEXT "Label:",-1,11,25,29,12
EDITTEXT IDC_DRIVE_EDIT_TYPE,42,38,78,13,ES_AUTOHSCROLL
LTEXT "Type:",-1,11,40,29,12
EDITTEXT IDC_DRIVE_EDIT_PATH,42,53,78,13,ES_AUTOHSCROLL
LTEXT "Path:",-1,11,55,29,12
EDITTEXT IDC_DRIVE_EDIT_FS,42,68,78,13,ES_AUTOHSCROLL
LTEXT "FS:",-1,11,70,29,12
EDITTEXT IDC_DRIVE_EDIT_DEVICE,42,83,78,13,ES_AUTOHSCROLL
LTEXT "Device:",-1,11,85,29,12
END
IDD_DRIVECFG DIALOG DISCARDABLE 0, 0, 260, 250
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Sans Serif"
......@@ -144,21 +123,20 @@ BEGIN
PUSHBUTTON "Browse...",IDC_BUTTON_REAL,202,60,44,14
PUSHBUTTON "Important Folders...",IDC_BUTTON_FOLDERS,173,85,73,14
GROUPBOX "Other Drives",IDC_STATIC,7,107,246,112
LISTBOX IDC_LIST_DRIVES,14,118,232,76,LBS_SORT | LBS_NOINTEGRALHEIGHT |
LBS_MULTICOLUMN | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_DRIVES,14,118,232,76,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Add...",IDC_BUTTON_ADD,14,199,37,14
PUSHBUTTON "Remove",IDC_BUTTON_REMOVE,55,199,37,14
PUSHBUTTON "Edit...",IDC_BUTTON_EDIT,97,199,37,14
PUSHBUTTON "Autodetect...",IDC_BUTTON_AUTODETECT,197,199,49,14
LTEXT "WARNING: You don't seem to have a C drive defined. Click 'Add Drive' to add one.", IDS_DRIVE_NO_C, 7,223,250,110
END
IDD_DRIVE_EDIT2 DIALOG DISCARDABLE 0, 0, 272, 153
IDD_DRIVE_EDIT DIALOG DISCARDABLE 0, 0, 203, 169
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Drive Configuration"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",ID_BUTTON_OK,217,5,50,14
PUSHBUTTON "Cancel",ID_BUTTON_CANCEL,217,22,50,14
DEFPUSHBUTTON "&Close",ID_BUTTON_OK,145,150,50,13
LTEXT "Letter:",IDC_STATIC,5,23,26,9
EDITTEXT IDC_EDIT_LABEL,63,114,78,13,ES_AUTOHSCROLL
LTEXT "Label:",IDC_STATIC_LABEL,33,117,29,12
......@@ -167,7 +145,7 @@ BEGIN
LTEXT "Path:",IDC_STATIC,5,9,20,9
LTEXT "Names:",IDC_STATIC,5,39,25,9
EDITTEXT IDC_EDIT_SERIAL,63,129,78,13,ES_AUTOHSCROLL
LTEXT "Serial:",IDC_STATIC_SERIAL,33,133,29,12
LTEXT "Serial:",IDC_STATIC_SERIAL,33,130,29,12
COMBOBOX IDC_COMBO_LETTER,31,20,78,60,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Browse...",IDC_BUTTON_BROWSE_PATH,154,5,40,13
......@@ -181,7 +159,8 @@ BEGIN
PUSHBUTTON "Browse...",IDC_BUTTON_BROWSE_DEVICE,148,89,40,13
CONTROL "Manually Assign:",IDC_RADIO_ASSIGN,"Button",
BS_AUTORADIOBUTTON,21,104,69,10
GROUPBOX "Label and Serial Number",IDC_BOX_LABELSERIAL,15,68,180,79
GROUPBOX "Label and Serial Number",IDC_BOX_LABELSERIAL,6,68,189,79
END
STRINGTABLE DISCARDABLE
......
......@@ -34,8 +34,7 @@
#define IDD_DLLCFG 110
#define IDD_DRIVECFG 111
#define IDD_SYSTEMCFG 112
#define IDD_DRIVE_EDIT 113
#define IDD_DRIVE_EDIT2 114
#define IDD_DRIVE_EDIT 114
#define IDB_WINE_LOGO 200
#define IDC_TABABOUT 1001
#define IDC_APPLYBTN 1002
......@@ -102,3 +101,4 @@
#define IDC_STATIC_SERIAL 1072
#define IDC_STATIC_LABEL 1073
#define IDC_ENABLE_DESKTOP 1074
#define IDS_DRIVE_NO_C 1075
......@@ -191,6 +191,15 @@ HRESULT removeConfigValue(char *subkey, char *valueName) {
return S_OK;
}
/* removes the requested configuration section (subkey) from the registry, assuming it exists */
/* this function might be slightly pointless, but in future we may wish to treat recursion specially etc, so we'll keep it for now */
HRESULT removeConfigSection(char *section) {
HRESULT hr;
WINE_TRACE("section=%s\n", section);
return hr = RegDeleteKey(configKey, section);
}
/* ========================================================================= */
/* Transaction management code */
......@@ -204,7 +213,7 @@ void destroyTransaction(struct transaction *trans) {
WINE_TRACE("destroying %p\n", trans);
free(trans->section);
free(trans->key);
if (trans->key) free(trans->key);
if (trans->newValue) free(trans->newValue);
if (trans->next) trans->next->prev = trans->prev;
......@@ -216,18 +225,16 @@ void destroyTransaction(struct transaction *trans) {
}
void addTransaction(char *section, char *key, enum transaction_action action, char *newValue) {
struct transaction *trans = malloc(sizeof(struct transaction));
struct transaction *trans = calloc(sizeof(struct transaction),1);
assert( section != NULL );
assert( key != NULL );
if (action == ACTION_SET) assert( newValue != NULL );
if (action == ACTION_SET) assert( key != NULL );
trans->section = strdup(section);
trans->key = strdup(key);
trans->newValue = strdup(newValue);
if (key) trans->key = strdup(key);
if (newValue) trans->newValue = strdup(newValue);
trans->action = action;
trans->next = NULL;
trans->prev = NULL;
if (tqtail == NULL) {
tqtail = trans;
......@@ -249,8 +256,14 @@ void processTransaction(struct transaction *trans) {
WINE_TRACE("Setting %s\\%s to '%s'\n", trans->section, trans->key, trans->newValue);
setConfigValue(trans->section, trans->key, trans->newValue);
} else if (trans->action == ACTION_REMOVE) {
WINE_TRACE("Removing %s\\%s", trans->section, trans->key);
removeConfigValue(trans->section, trans->key);
if (trans->key) {
WINE_TRACE("Removing %s\\%s\n", trans->section, trans->key);
removeConfigValue(trans->section, trans->key);
} else {
/* NULL key means remove that section entirely */
WINE_TRACE("Removing section %s\n", trans->section);
removeConfigSection(trans->section);
}
}
/* TODO: implement notifications here */
}
......@@ -266,7 +279,6 @@ void processTransQueue(void)
}
}
/* ================================== utility functions ============================ */
/* returns a string with the window text of the dialog item. user is responsible for freeing the result */
......
......@@ -43,6 +43,9 @@
return ret; \
}
#define WRITEME(owner) MessageBox(owner, "Write me!", "", MB_OK | MB_ICONEXCLAMATION);
/* Transaction management */
enum transaction_action {
ACTION_SET,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment