rename get_session -> session_get

This commit is contained in:
csf 2022-08-16 15:22:57 +08:00
parent 1b5075168e
commit 53b69b59a8
6 changed files with 27 additions and 27 deletions

View File

@ -482,7 +482,7 @@ RadioListTile<T> getRadio<T>(
CheckboxListTile getToggle(
String id, void Function(void Function()) setState, option, name,
{FFI? ffi}) {
final opt = bind.getSessionToggleOptionSync(id: id, arg: option);
final opt = bind.sessionGetToggleOptionSync(id: id, arg: option);
return CheckboxListTile(
value: opt,
onChanged: (v) {

View File

@ -490,7 +490,7 @@ class _RemotePageState extends State<RemotePage>
}),
))
];
final cursor = bind.getSessionToggleOptionSync(
final cursor = bind.sessionGetToggleOptionSync(
id: widget.id, arg: 'show-remote-cursor');
if (keyboard || cursor) {
paints.add(CursorPaint(
@ -565,7 +565,7 @@ class _RemotePageState extends State<RemotePage>
more.add(PopupMenuItem<String>(
child: Text(translate('Insert Lock')), value: 'lock'));
if (pi.platform == 'Windows' &&
await bind.getSessionToggleOption(id: id, arg: 'privacy-mode') !=
await bind.sessionGetToggleOption(id: id, arg: 'privacy-mode') !=
true) {
more.add(PopupMenuItem<String>(
child: Text(translate(
@ -610,7 +610,7 @@ class _RemotePageState extends State<RemotePage>
// TODO icon diff
// null means no session of id
// empty string means no password
var password = await bind.getSessionOption(id: id, arg: "os-password");
var password = await bind.sessionGetOption(id: id, arg: "os-password");
if (password != null) {
bind.sessionInputOsPassword(id: widget.id, value: password);
} else {
@ -837,12 +837,12 @@ class QualityMonitor extends StatelessWidget {
void showOptions(String id) async {
final _ffi = ffi(id);
String quality = await bind.getSessionImageQuality(id: id) ?? 'balanced';
String quality = await bind.sessionGetImageQuality(id: id) ?? 'balanced';
if (quality == '') quality = 'balanced';
String viewStyle =
await bind.getSessionOption(id: id, arg: 'view-style') ?? '';
await bind.sessionGetOption(id: id, arg: 'view-style') ?? '';
String scrollStyle =
await bind.getSessionOption(id: id, arg: 'scroll-style') ?? '';
await bind.sessionGetOption(id: id, arg: 'scroll-style') ?? '';
var displays = <Widget>[];
final pi = _ffi.ffiModel.pi;
final image = _ffi.ffiModel.getConnectionImage();
@ -957,8 +957,8 @@ void showOptions(String id) async {
void showSetOSPassword(
String id, bool login, OverlayDialogManager dialogManager) async {
final controller = TextEditingController();
var password = await bind.getSessionOption(id: id, arg: "os-password") ?? "";
var autoLogin = await bind.getSessionOption(id: id, arg: "auto-login") != "";
var password = await bind.sessionGetOption(id: id, arg: "os-password") ?? "";
var autoLogin = await bind.sessionGetOption(id: id, arg: "auto-login") != "";
controller.text = password;
dialogManager.show((setState, close) {
return CustomAlertDialog(

View File

@ -623,7 +623,7 @@ class _RemotePageState extends State<RemotePage> {
Widget getBodyForDesktopWithListener(bool keyboard) {
var paints = <Widget>[ImagePaint()];
final cursor = bind.getSessionToggleOptionSync(
final cursor = bind.sessionGetToggleOptionSync(
id: widget.id, arg: 'show-remote-cursor');
if (keyboard || cursor) {
paints.add(CursorPaint());
@ -694,7 +694,7 @@ class _RemotePageState extends State<RemotePage> {
more.add(PopupMenuItem<String>(
child: Text(translate('Insert Lock')), value: 'lock'));
if (pi.platform == 'Windows' &&
await bind.getSessionToggleOption(id: id, arg: 'privacy-mode') !=
await bind.sessionGetToggleOption(id: id, arg: 'privacy-mode') !=
true) {
more.add(PopupMenuItem<String>(
child: Text(translate((gFFI.ffiModel.inputBlocked ? 'Unb' : 'B') +
@ -738,7 +738,7 @@ class _RemotePageState extends State<RemotePage> {
// FIXME:
// null means no session of id
// empty string means no password
var password = await bind.getSessionOption(id: id, arg: "os-password");
var password = await bind.sessionGetOption(id: id, arg: "os-password");
if (password != null) {
bind.sessionInputOsPassword(id: widget.id, value: password);
} else {
@ -1012,10 +1012,10 @@ class QualityMonitor extends StatelessWidget {
}
void showOptions(String id, OverlayDialogManager dialogManager) async {
String quality = await bind.getSessionImageQuality(id: id) ?? 'balanced';
String quality = await bind.sessionGetImageQuality(id: id) ?? 'balanced';
if (quality == '') quality = 'balanced';
String viewStyle =
await bind.getSessionOption(id: id, arg: 'view-style') ?? '';
await bind.sessionGetOption(id: id, arg: 'view-style') ?? '';
var displays = <Widget>[];
final pi = gFFI.ffiModel.pi;
final image = gFFI.ffiModel.getConnectionImage();
@ -1113,8 +1113,8 @@ void showOptions(String id, OverlayDialogManager dialogManager) async {
void showSetOSPassword(
String id, bool login, OverlayDialogManager dialogManager) async {
final controller = TextEditingController();
var password = await bind.getSessionOption(id: id, arg: "os-password") ?? "";
var autoLogin = await bind.getSessionOption(id: id, arg: "auto-login") != "";
var password = await bind.sessionGetOption(id: id, arg: "os-password") ?? "";
var autoLogin = await bind.sessionGetOption(id: id, arg: "auto-login") != "";
controller.text = password;
dialogManager.show((setState, close) {
return CustomAlertDialog(

View File

@ -157,7 +157,7 @@ void setTemporaryPasswordLengthDialog(
void enterPasswordDialog(String id, OverlayDialogManager dialogManager) async {
final controller = TextEditingController();
var remember = await bind.getSessionRemember(id: id) ?? false;
var remember = await bind.sessionGetRemember(id: id) ?? false;
dialogManager.dismissAll();
dialogManager.show((setState, close) {
return CustomAlertDialog(

View File

@ -312,7 +312,7 @@ class FfiModel with ChangeNotifier {
}
} else {
_touchMode =
await bind.getSessionOption(id: peerId, arg: "touch-mode") != '';
await bind.sessionGetOption(id: peerId, arg: "touch-mode") != '';
}
if (evt['is_file_transfer'] == "true") {
@ -471,7 +471,7 @@ class CanvasModel with ChangeNotifier {
double get tabBarHeight => _tabBarHeight;
void updateViewStyle() async {
final style = await bind.getSessionOption(id: id, arg: 'view-style');
final style = await bind.sessionGetOption(id: id, arg: 'view-style');
if (style == null) {
return;
}
@ -517,7 +517,7 @@ class CanvasModel with ChangeNotifier {
}
updateScrollStyle() async {
final style = await bind.getSessionOption(id: id, arg: 'scroll-style');
final style = await bind.sessionGetOption(id: id, arg: 'scroll-style');
if (style == 'scrollbar') {
_scrollStyle = ScrollStyle.scrollbar;
_scrollX = 0.0;
@ -863,7 +863,7 @@ class QualityMonitorModel with ChangeNotifier {
QualityMonitorData get data => _data;
checkShowQualityMonitor(String id) async {
final show = await bind.getSessionToggleOption(
final show = await bind.sessionGetToggleOption(
id: id, arg: 'show-quality-monitor') ==
true;
if (_show != show) {

View File

@ -116,7 +116,7 @@ pub fn session_connect(
Ok(())
}
pub fn get_session_remember(id: String) -> Option<bool> {
pub fn session_get_remember(id: String) -> Option<bool> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_remember())
} else {
@ -124,7 +124,7 @@ pub fn get_session_remember(id: String) -> Option<bool> {
}
}
pub fn get_session_toggle_option(id: String, arg: String) -> Option<bool> {
pub fn session_get_toggle_option(id: String, arg: String) -> Option<bool> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_toggle_option(&arg))
} else {
@ -132,12 +132,12 @@ pub fn get_session_toggle_option(id: String, arg: String) -> Option<bool> {
}
}
pub fn get_session_toggle_option_sync(id: String, arg: String) -> SyncReturn<bool> {
let res = get_session_toggle_option(id, arg) == Some(true);
pub fn session_get_toggle_option_sync(id: String, arg: String) -> SyncReturn<bool> {
let res = session_get_toggle_option(id, arg) == Some(true);
SyncReturn(res)
}
pub fn get_session_image_quality(id: String) -> Option<String> {
pub fn session_get_image_quality(id: String) -> Option<String> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_image_quality())
} else {
@ -145,7 +145,7 @@ pub fn get_session_image_quality(id: String) -> Option<String> {
}
}
pub fn get_session_option(id: String, arg: String) -> Option<String> {
pub fn session_get_option(id: String, arg: String) -> Option<String> {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
Some(session.get_option(&arg))
} else {