mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-20 12:38:06 -05:00
Remember which file a session was opened from, so it can be the default one
to save back to. [originally from svn r2648]
This commit is contained in:
parent
99c1029649
commit
3afb0f5da8
@ -80,6 +80,8 @@ typedef struct Session {
|
|||||||
int raw_mouse;
|
int raw_mouse;
|
||||||
UnicodeToTextInfo uni_to_font; /* Only one of uni_to_font and */
|
UnicodeToTextInfo uni_to_font; /* Only one of uni_to_font and */
|
||||||
charset_t font_charset; /* font_charset is used at a time. */
|
charset_t font_charset; /* font_charset is used at a time. */
|
||||||
|
int hasfile;
|
||||||
|
FSSpec savefile;
|
||||||
} Session;
|
} Session;
|
||||||
|
|
||||||
extern Session *sesslist;
|
extern Session *sesslist;
|
||||||
|
24
mac/macdlg.c
24
mac/macdlg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macdlg.c,v 1.4 2003/01/18 20:09:21 ben Exp $ */
|
/* $Id: macdlg.c,v 1.5 2003/01/18 20:52:59 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Ben Harris
|
* Copyright (c) 2002 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -35,6 +35,7 @@
|
|||||||
#include <StandardFile.h>
|
#include <StandardFile.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
@ -51,6 +52,7 @@ void mac_newsession(void)
|
|||||||
memset(s, 0, sizeof(*s));
|
memset(s, 0, sizeof(*s));
|
||||||
do_defaults(NULL, &s->cfg);
|
do_defaults(NULL, &s->cfg);
|
||||||
s->back = &loop_backend;
|
s->back = &loop_backend;
|
||||||
|
s->hasfile = FALSE;
|
||||||
|
|
||||||
s->settings_window = GetNewDialog(wSettings, NULL, (WindowPtr)-1);
|
s->settings_window = GetNewDialog(wSettings, NULL, (WindowPtr)-1);
|
||||||
|
|
||||||
@ -75,6 +77,12 @@ void mac_opensession(void) {
|
|||||||
if (sesshandle == NULL) goto fail;
|
if (sesshandle == NULL) goto fail;
|
||||||
load_open_settings(sesshandle, TRUE, &s->cfg);
|
load_open_settings(sesshandle, TRUE, &s->cfg);
|
||||||
close_settings_r(sesshandle);
|
close_settings_r(sesshandle);
|
||||||
|
if (sfr.sfFlags & kIsStationery)
|
||||||
|
s->hasfile = FALSE;
|
||||||
|
else {
|
||||||
|
s->hasfile = TRUE;
|
||||||
|
s->savefile = sfr.sfFile;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Select protocol. This is farmed out into a table in a
|
* Select protocol. This is farmed out into a table in a
|
||||||
@ -99,9 +107,14 @@ void mac_opensession(void) {
|
|||||||
|
|
||||||
void mac_savesession(void)
|
void mac_savesession(void)
|
||||||
{
|
{
|
||||||
|
Session *s = (Session *)GetWRefCon(FrontWindow());
|
||||||
|
void *sesshandle;
|
||||||
|
|
||||||
/* Don't remember which file a session goes with yet, so... */
|
assert(s->hasfile);
|
||||||
mac_savesessionas();
|
sesshandle = open_settings_w_fsp(&s->savefile);
|
||||||
|
if (sesshandle == NULL) return; /* XXX report error */
|
||||||
|
save_open_settings(sesshandle, TRUE, &s->cfg);
|
||||||
|
close_settings_w(sesshandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac_savesessionas(void)
|
void mac_savesessionas(void)
|
||||||
@ -110,7 +123,8 @@ void mac_savesessionas(void)
|
|||||||
StandardFileReply sfr;
|
StandardFileReply sfr;
|
||||||
void *sesshandle;
|
void *sesshandle;
|
||||||
|
|
||||||
StandardPutFile("\pSave session as:", "\puntitled", &sfr);
|
StandardPutFile("\pSave session as:",
|
||||||
|
s->hasfile ? s->savefile.name : "\puntitled", &sfr);
|
||||||
if (!sfr.sfGood) return;
|
if (!sfr.sfGood) return;
|
||||||
|
|
||||||
if (!sfr.sfReplacing) {
|
if (!sfr.sfReplacing) {
|
||||||
@ -121,6 +135,8 @@ void mac_savesessionas(void)
|
|||||||
if (sesshandle == NULL) return; /* XXX report error */
|
if (sesshandle == NULL) return; /* XXX report error */
|
||||||
save_open_settings(sesshandle, TRUE, &s->cfg);
|
save_open_settings(sesshandle, TRUE, &s->cfg);
|
||||||
close_settings_w(sesshandle);
|
close_settings_w(sesshandle);
|
||||||
|
s->hasfile = TRUE;
|
||||||
|
s->savefile = sfr.sfFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac_activatedlg(WindowPtr window, EventRecord *event)
|
void mac_activatedlg(WindowPtr window, EventRecord *event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user