From 482c6555903571a0fb8d51ec4669d54c6086d174 Mon Sep 17 00:00:00 2001 From: Mariana Picolo Date: Wed, 1 Jul 2020 19:18:04 -0300 Subject: [PATCH] messageTray: Remove SourceActorWithLabel class https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1346 --- js/ui/messageTray.js | 73 +------------------------------------------- 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 718aee657..d89af2b83 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1,6 +1,6 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported NotificationPolicy, NotificationGenericPolicy, - NotificationApplicationPolicy, Source, SourceActor, SourceActorWithLabel, + NotificationApplicationPolicy, Source, SourceActor, SystemNotificationSource, MessageTray */ const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi; @@ -655,77 +655,6 @@ class SourceActor extends St.Widget { } }); -var SourceActorWithLabel = GObject.registerClass( -class SourceActorWithLabel extends SourceActor { - _init(source, size) { - super._init(source, size); - - this._counterLabel = new St.Label({ x_align: Clutter.ActorAlign.CENTER, - x_expand: true, - y_align: Clutter.ActorAlign.CENTER, - y_expand: true }); - - this._counterBin = new St.Bin({ style_class: 'summary-source-counter', - child: this._counterLabel, - layout_manager: new Clutter.BinLayout() }); - this._counterBin.hide(); - - this._counterBin.connect('style-changed', () => { - let themeNode = this._counterBin.get_theme_node(); - this._counterBin.translation_x = themeNode.get_length('-shell-counter-overlap-x'); - this._counterBin.translation_y = themeNode.get_length('-shell-counter-overlap-y'); - }); - - this.add_actor(this._counterBin); - - this._countUpdatedId = this._source.connect('notify::count', this._updateCount.bind(this)); - this._updateCount(); - - this.connect('destroy', () => { - this._source.disconnect(this._countUpdatedId); - }); - } - - vfunc_allocate(box) { - super.vfunc_allocate(box); - - let childBox = new Clutter.ActorBox(); - - let [, , naturalWidth, naturalHeight] = this._counterBin.get_preferred_size(); - let direction = this.get_text_direction(); - - if (direction == Clutter.TextDirection.LTR) { - // allocate on the right in LTR - childBox.x1 = box.x2 - naturalWidth; - childBox.x2 = box.x2; - } else { - // allocate on the left in RTL - childBox.x1 = 0; - childBox.x2 = naturalWidth; - } - - childBox.y1 = box.y2 - naturalHeight; - childBox.y2 = box.y2; - - this._counterBin.allocate(childBox); - } - - _updateCount() { - if (this._actorDestroyed) - return; - - this._counterBin.visible = this._source.countVisible; - - let text; - if (this._source.count < 100) - text = this._source.count.toString(); - else - text = String.fromCharCode(0x22EF); // midline horizontal ellipsis - - this._counterLabel.set_text(text); - } -}); - var Source = GObject.registerClass({ Properties: { 'count': GObject.ParamSpec.int(