@@ -10,8 +10,9 @@ static SCCRTN LGitOptionsCaps(enum SCCCOMMAND cmd)
1010 switch (cmd)
1111 {
1212 /*
13- * We support commit (checkin, add, remove) for remote operations.
13+ * We support commit (checkin, add, remove) and get for remote operations.
1414 */
15+ case SCC_COMMAND_GET:
1516 case SCC_COMMAND_ADD:
1617 case SCC_COMMAND_REMOVE:
1718 case SCC_COMMAND_CHECKIN:
@@ -34,12 +35,14 @@ static BOOL CALLBACK CommitOptsDialogProc(HWND hwnd,
3435 param = (LGitContext*)lParam;
3536 SetWindowLong (hwnd, GWL_USERDATA, (long )param); /* XXX: 64-bit... */
3637 CheckDlgButton (hwnd, IDC_OPTIONS_COMMIT_PUSH, param->commitOpts .push );
38+ LGitLog (" ! Push is %d\n " , param->commitOpts .push );
3739 return TRUE ;
3840 case WM_COMMAND:
3941 param = (LGitContext*)GetWindowLong (hwnd, GWL_USERDATA);
4042 switch (LOWORD (wParam)) {
4143 case IDOK:
4244 param->commitOpts .push = IsDlgButtonChecked (hwnd, IDC_OPTIONS_COMMIT_PUSH);
45+ LGitLog (" ! Push is now %d\n " , param->commitOpts .push );
4346 EndDialog (hwnd, 2 );
4447 return TRUE ;
4548 case IDCANCEL:
@@ -74,6 +77,60 @@ static SCCRTN SetCommitOptions(LGitContext *ctx, HWND hWnd, LPCMDOPTS *opts)
7477 return SCC_E_NONSPECIFICERROR;
7578}
7679
80+ static BOOL CALLBACK GetOptsDialogProc (HWND hwnd,
81+ unsigned int iMsg,
82+ WPARAM wParam,
83+ LPARAM lParam)
84+ {
85+ LGitContext *param;
86+ /* TODO: We should try to derive a path from the URL until overriden */
87+ switch (iMsg) {
88+ case WM_INITDIALOG:
89+ param = (LGitContext*)lParam;
90+ SetWindowLong (hwnd, GWL_USERDATA, (long )param); /* XXX: 64-bit... */
91+ CheckDlgButton (hwnd, IDC_OPTIONS_COMMIT_PULL, param->getOpts .pull );
92+ LGitLog (" ! Pull is %d\n " , param->getOpts .pull );
93+ return TRUE ;
94+ case WM_COMMAND:
95+ param = (LGitContext*)GetWindowLong (hwnd, GWL_USERDATA);
96+ switch (LOWORD (wParam)) {
97+ case IDOK:
98+ param->getOpts .pull = IsDlgButtonChecked (hwnd, IDC_OPTIONS_COMMIT_PULL);
99+ LGitLog (" ! Pull is now %d\n " , param->getOpts .pull );
100+ EndDialog (hwnd, 2 );
101+ return TRUE ;
102+ case IDCANCEL:
103+ EndDialog (hwnd, 1 );
104+ return TRUE ;
105+ }
106+ return FALSE ;
107+ default :
108+ return FALSE ;
109+ }
110+ }
111+
112+ static SCCRTN SetGetOptions (LGitContext *ctx, HWND hWnd, LPCMDOPTS *opts)
113+ {
114+ if (opts != NULL && *opts == NULL ) {
115+ *opts = &ctx->getOpts ;
116+ ZeroMemory (&ctx->commitOpts , sizeof (LGitGetOpts));
117+ }
118+ switch (DialogBoxParam (ctx->dllInst ,
119+ MAKEINTRESOURCE (IDD_OPTIONS_GET),
120+ hWnd,
121+ GetOptsDialogProc,
122+ (LPARAM)ctx)) {
123+ case 0 :
124+ LGitLog (" ! Uh-oh, dialog error\n " );
125+ break ;
126+ case 1 :
127+ return SCC_I_OPERATIONCANCELED;
128+ case 2 :
129+ return SCC_OK;
130+ }
131+ return SCC_E_NONSPECIFICERROR;
132+ }
133+
77134static SCCRTN SetPluginOptions (LGitContext *ctx, HWND hWnd)
78135{
79136 /* The provided options aren't useful since this is our responsibility. */
@@ -89,6 +146,9 @@ SCCRTN SccGetCommandOptions (LPVOID context,
89146 LGitLog (" **SccGetCommandOptions** Context=%p\n " , context);
90147 LGitLog (" command %s\n " , LGitCommandName (nCommand));
91148 LGitLog (" options %p\n " , ppvOptions);
149+ if (ppvOptions != NULL ) {
150+ LGitLog (" *options %p\n " , *ppvOptions);
151+ }
92152 LGitContext *ctx = (LGitContext*)context;
93153
94154 /* IDE calls first with NULL to see if we support this option */
@@ -98,14 +158,23 @@ SCCRTN SccGetCommandOptions (LPVOID context,
98158 /* Context may not be open. Don't do things needing repos from dialogs. */
99159
100160 /* Dispatch to shared dialogs. */
161+ SCCRTN ret;
101162 switch (nCommand) {;
163+ case SCC_COMMAND_GET:
164+ ret = SetGetOptions (ctx, hWnd, ppvOptions);
165+ break ;
102166 case SCC_COMMAND_ADD:
103167 case SCC_COMMAND_REMOVE:
104168 case SCC_COMMAND_CHECKIN:
105- return SetCommitOptions (ctx, hWnd, ppvOptions);
169+ ret = SetCommitOptions (ctx, hWnd, ppvOptions);
170+ break ;
106171 case SCC_COMMAND_OPTIONS:
107- return SetPluginOptions (ctx, hWnd);
172+ ret = SetPluginOptions (ctx, hWnd);
173+ break ;
108174 default :
109- return SCC_E_OPNOTSUPPORTED;
175+ ret = SCC_E_OPNOTSUPPORTED;
176+ break ;
110177 }
178+ LGitLog (" ! New ptr %p rc %d\n " , *ppvOptions, ret);
179+ return ret;
111180}
0 commit comments