From 53b69b59a8188d91b00d1a1a0451cd525d720265 Mon Sep 17 00:00:00 2001 From: csf Date: Tue, 16 Aug 2022 15:22:57 +0800 Subject: [PATCH] rename get_session -> session_get --- flutter/lib/common.dart | 2 +- flutter/lib/desktop/pages/remote_page.dart | 16 ++++++++-------- flutter/lib/mobile/pages/remote_page.dart | 14 +++++++------- flutter/lib/mobile/widgets/dialog.dart | 2 +- flutter/lib/models/model.dart | 8 ++++---- src/flutter_ffi.rs | 12 ++++++------ 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 93c151bee..0070d5294 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -482,7 +482,7 @@ RadioListTile getRadio( 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) { diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index f3996b31b..aa839fd01 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -490,7 +490,7 @@ class _RemotePageState extends State }), )) ]; - 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 more.add(PopupMenuItem( 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( child: Text(translate( @@ -610,7 +610,7 @@ class _RemotePageState extends State // 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 = []; 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( diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 6a5be8b8d..8a4df6a9d 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -623,7 +623,7 @@ class _RemotePageState extends State { Widget getBodyForDesktopWithListener(bool keyboard) { var paints = [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 { more.add(PopupMenuItem( 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( child: Text(translate((gFFI.ffiModel.inputBlocked ? 'Unb' : 'B') + @@ -738,7 +738,7 @@ class _RemotePageState extends State { // 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 = []; 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( diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart index e0f98443b..82aed42a1 100644 --- a/flutter/lib/mobile/widgets/dialog.dart +++ b/flutter/lib/mobile/widgets/dialog.dart @@ -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( diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 18fe6a7f9..f3e47ff7f 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -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) { diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 686111715..44d48ca8c 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -116,7 +116,7 @@ pub fn session_connect( Ok(()) } -pub fn get_session_remember(id: String) -> Option { +pub fn session_get_remember(id: String) -> Option { 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 { } } -pub fn get_session_toggle_option(id: String, arg: String) -> Option { +pub fn session_get_toggle_option(id: String, arg: String) -> Option { 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 { } } -pub fn get_session_toggle_option_sync(id: String, arg: String) -> SyncReturn { - let res = get_session_toggle_option(id, arg) == Some(true); +pub fn session_get_toggle_option_sync(id: String, arg: String) -> SyncReturn { + let res = session_get_toggle_option(id, arg) == Some(true); SyncReturn(res) } -pub fn get_session_image_quality(id: String) -> Option { +pub fn session_get_image_quality(id: String) -> Option { 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 { } } -pub fn get_session_option(id: String, arg: String) -> Option { +pub fn session_get_option(id: String, arg: String) -> Option { if let Some(session) = SESSIONS.read().unwrap().get(&id) { Some(session.get_option(&arg)) } else {