loginDialog: Get username directly from the conflicting session

The conflicting session is owned by the same user per definition.
Use the Name property of the conflicting session to get the
username instead of assuming that `this._user` is defined and
passing the username around.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3448>
This commit is contained in:
Alessandro Bono 2024-08-19 18:02:04 +02:00
parent a80ad53500
commit 647747fbd6
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@
<property name="Active" type="b" access="read"/>
<property name="Class" type="s" access="read"/>
<property name="Id" type="s" access="read"/>
<property name="Name" type="s" access="read"/>
<property name="Remote" type="b" access="read"/>
<property name="State" type="s" access="read"/>
<property name="Type" type="s" access="read"/>

View File

@ -414,9 +414,10 @@ export const ConflictingSessionDialog = GObject.registerClass({
'force-stop': {},
},
}, class ConflictingSessionDialog extends ModalDialog.ModalDialog {
_init(conflictingSession, greeterSession, userName) {
_init(conflictingSession, greeterSession) {
super._init();
const userName = conflictingSession.Name;
let bannerText;
if (greeterSession.Remote && conflictingSession.Remote)
/* Translators: is running for <username> */
@ -1091,8 +1092,7 @@ export const LoginDialog = GObject.registerClass({
_showConflictingSessionDialog(serviceName, conflictingSession) {
let conflictingSessionDialog = new ConflictingSessionDialog(conflictingSession,
this._greeterSessionProxy,
this._user.get_user_name());
this._greeterSessionProxy);
conflictingSessionDialog.connect('cancel', () => {
this._authPrompt.reset();