telepathyClient: Stop displaying presence in notification

The presence indicator in notification uses API only needed for the
telepathyClient, since it's a complete fringe feature nowadays it's not
worth maintaining specific API for it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3103>
This commit is contained in:
Julian Sparber 2024-01-25 17:54:09 +01:00 committed by Marge Bot
parent 739725e521
commit 5f7e8d292d

View File

@ -332,8 +332,7 @@ class ChatSource extends MessageTray.Source {
this._contact.connectObject( this._contact.connectObject(
'notify::alias', this._updateAlias.bind(this), 'notify::alias', this._updateAlias.bind(this),
'notify::avatar-file', this._updateAvatarIcon.bind(this), 'notify::avatar-file', this._updateAvatarIcon.bind(this), this);
'presence-changed', this._presenceChanged.bind(this), this);
// Add ourselves as a source. // Add ourselves as a source.
Main.messageTray.add(this); Main.messageTray.add(this);
@ -393,35 +392,6 @@ class ChatSource extends MessageTray.Source {
return new Gio.ThemedIcon({name: 'avatar-default'}); return new Gio.ThemedIcon({name: 'avatar-default'});
} }
getSecondaryIcon() {
let iconName;
let presenceType = this._contact.get_presence_type();
switch (presenceType) {
case Tp.ConnectionPresenceType.AVAILABLE:
iconName = 'user-available';
break;
case Tp.ConnectionPresenceType.BUSY:
iconName = 'user-busy';
break;
case Tp.ConnectionPresenceType.OFFLINE:
iconName = 'user-offline';
break;
case Tp.ConnectionPresenceType.HIDDEN:
iconName = 'user-invisible';
break;
case Tp.ConnectionPresenceType.AWAY:
iconName = 'user-away';
break;
case Tp.ConnectionPresenceType.EXTENDED_AWAY:
iconName = 'user-idle';
break;
default:
iconName = 'user-offline';
}
return new Gio.ThemedIcon({name: iconName});
}
_updateAvatarIcon() { _updateAvatarIcon() {
this.iconUpdated(); this.iconUpdated();
if (this._notification) { if (this._notification) {
@ -630,15 +600,6 @@ class ChatSource extends MessageTray.Source {
} }
} }
_presenceChanged(_contact, _presence, _status, _message) {
if (this._notification) {
this._notification.update(
this._notification.title,
this._notification.bannerBodyText,
{secondaryGIcon: this.getSecondaryIcon()});
}
}
_pendingRemoved(channel, message) { _pendingRemoved(channel, message) {
let idx = this._pendingMessages.indexOf(message); let idx = this._pendingMessages.indexOf(message);
@ -674,9 +635,8 @@ const ChatNotification = HAVE_TP ? GObject.registerClass({
'timestamp-changed': {param_types: [ChatNotificationMessage.$gtype]}, 'timestamp-changed': {param_types: [ChatNotificationMessage.$gtype]},
}, },
}, class ChatNotification extends MessageTray.Notification { }, class ChatNotification extends MessageTray.Notification {
_init(source) { constructor(source) {
super._init(source, source.title, null, super(source, source.title, null, null);
{secondaryGIcon: source.getSecondaryIcon()});
this.setUrgency(MessageTray.Urgency.HIGH); this.setUrgency(MessageTray.Urgency.HIGH);
this.setResident(true); this.setResident(true);