Skip to content

Commit

Permalink
Close the tools window when the device is unplugged
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadoum committed Oct 27, 2023
1 parent 58015db commit bbd37b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion linux/gtk/ui/devicewidget.d
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import ui.utils;
class DeviceWidget: PreferencesGroup {
iDevice device;
LockdowndClient lockdowndClient;
Window toolSelectionWindow;

this(iDeviceInfo deviceInfo) {
string udid = deviceInfo.udid;
Expand Down Expand Up @@ -79,7 +80,7 @@ class DeviceWidget: PreferencesGroup {

void showTools(iDevice device) {
auto rootWindow = cast(Window) this.getRoot();
auto toolSelectionWindow = new ToolSelectionWindow(rootWindow, device);
toolSelectionWindow = new ToolSelectionWindow(rootWindow, device);
toolSelectionWindow.show();
}

Expand Down Expand Up @@ -120,4 +121,10 @@ class DeviceWidget: PreferencesGroup {

fileChooser.show();
}

void closeWindows() {
if (toolSelectionWindow) {
toolSelectionWindow.close();
}
}
}
4 changes: 3 additions & 1 deletion linux/gtk/ui/mainwindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class MainWindow: Window {

void removeDeviceWidget(iDeviceInfo deviceId) {
if (deviceId in deviceWidgets) {
deviceWidgets[deviceId].unparent();
auto deviceWidget = deviceWidgets[deviceId];
deviceWidget.unparent();
deviceWidget.closeWindows();
deviceWidgets.remove(deviceId);
if (deviceWidgets.length == 0) {
connectDeviceLabel.show();
Expand Down
2 changes: 1 addition & 1 deletion linux/gtk/ui/toolselectionwindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ToolSelectionWindow: Dialog {
uiTry!(() => tool.run((string message, bool canCancel = true) {
Tid parentTid = thisTid();
runInUIThread({
auto messageDialog = new MessageDialog(this, DialogFlags.MODAL, MessageType.INFO, canCancel ? ButtonsType.OK_CANCEL : ButtonsType.OK, message);
auto messageDialog = new MessageDialog(this, DialogFlags.DESTROY_WITH_PARENT | DialogFlags.MODAL, MessageType.INFO, canCancel ? ButtonsType.OK_CANCEL : ButtonsType.OK, message);
messageDialog.addOnResponse((response, _) {
if (canCancel) {
parentTid.send(response != ResponseType.OK);
Expand Down
2 changes: 1 addition & 1 deletion source/tools/sidestorepairingfile.d
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SideStoreTool: Tool {
}
break;
default:
if (notify("Unknown error, please check that the device is unlocked and trusts the computer (press OK to try again)")) {
if (notify("Unknown error, please check that the device is plugged correctly, unlocked and trusts the computer. (press OK to try again)")) {
return;
}
break;
Expand Down

0 comments on commit bbd37b6

Please sign in to comment.