Skip to content

Commit

Permalink
Restart the browser so that it picks up resolv.conf changes
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
ilpianista committed Jul 13, 2023
1 parent 365974a commit 26253c6
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion qml/pages/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ Page {
iface: 'org.freedesktop.systemd1.Manager'
}

DBusInterface {
id: systemdUser

bus: DBus.SessionBus
service: 'org.freedesktop.systemd1'
path: '/org/freedesktop/systemd1'
iface: 'org.freedesktop.systemd1.Manager'
}

Connections {
target: client

Expand Down Expand Up @@ -69,6 +78,7 @@ Page {
status.text = client.getStatus();
up.enabled = true;
down.enabled = false;
restartBrowser();
}
}

Expand All @@ -77,7 +87,10 @@ Page {
text: qsTr("Up")
enabled: !client.isUp()

onClicked: client.up()
onClicked: {
client.up();
restartBrowser();
}
}
}

Expand Down Expand Up @@ -114,4 +127,19 @@ Page {
}
);
}

function restartBrowser() {
systemdUser.typedCall('RestartUnit',
[
{ 'type': 's', 'value': 'booster-browser@sailfish-browser.service' },
{ 'type': 's', 'value': 'fail' }
],
function(result) {
console.log("sailfish-browser restarted")
},
function(error, message) {
console.log("failed (" + error + ") with:", message)
}
);
}
}

0 comments on commit 26253c6

Please sign in to comment.