From f8567bb1a7915f25cda424e6da7f7154f00ebbf8 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Tue, 20 Feb 2024 17:33:35 +0100 Subject: [PATCH] messageList: Drop methods to customize the body of a message Since only the telepathy client needed a special actor as expanded body we can now drop the methods for it. Part-of: --- js/ui/messageList.js | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 8338e7766..b5ee41cd7 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -507,6 +507,8 @@ export const Message = GObject.registerClass({ this.bodyLabel = new URLHighlighter('', false, this._useBodyMarkup); this.bodyLabel.add_style_class_name('message-body'); this._bodyStack.add_child(this.bodyLabel); + this._expandedLabel = new URLHighlighter('', true, this._useBodyMarkup); + this._bodyStack.add_child(this._expandedLabel); this.setBody(body); this.connect('destroy', this._onDestroy.bind(this)); @@ -543,8 +545,7 @@ export const Message = GObject.registerClass({ this._bodyText = text; this.bodyLabel.setMarkup(text ? text.replace(/\n/g, ' ') : '', this._useBodyMarkup); - if (this._expandedLabel) - this._expandedLabel.setMarkup(text, this._useBodyMarkup); + this._expandedLabel.setMarkup(text, this._useBodyMarkup); } setUseBodyMarkup(enable) { @@ -579,34 +580,11 @@ export const Message = GObject.registerClass({ return button; } - setExpandedBody(actor) { - if (actor == null) { - if (this._bodyStack.get_n_children() > 1) - this._bodyStack.get_child_at_index(1).destroy(); - return; - } - - if (this._bodyStack.get_n_children() > 1) - throw new Error('Message already has an expanded body actor'); - - this._bodyStack.insert_child_at_index(actor, 1); - } - - setExpandedLines(nLines) { - this._bodyStack.layout_manager.expandLines = nLines; - } - expand(animate) { this.expanded = true; this._actionBin.visible = this._actionBin.get_n_children() > 0; - if (this._bodyStack.get_n_children() < 2) { - this._expandedLabel = new URLHighlighter(this._bodyText, - true, this._useBodyMarkup); - this.setExpandedBody(this._expandedLabel); - } - const duration = animate ? MessageTray.ANIMATION_TIME : 0; this._bodyStack.ease_property('@layout.expansion', 1, { progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,