messageTray: Inherit Notification, Source and NotificationPolicy from GObject
Register notifications, sources and policies as GObject gtypes so that they can be passed in signals and use native properties and signals. Reimplement all the extending classes. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
This commit is contained in:

committed by
Florian Müllner

parent
7059dcced3
commit
b5676a2a5c
@ -1,7 +1,7 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported WindowAttentionHandler */
|
||||
|
||||
const Shell = imports.gi.Shell;
|
||||
const { GObject, Shell } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
@ -34,7 +34,7 @@ var WindowAttentionHandler = class {
|
||||
return;
|
||||
|
||||
let app = this._tracker.get_window_app(window);
|
||||
let source = new Source(app, window);
|
||||
let source = new WindowAttentionSource(app, window);
|
||||
Main.messageTray.add(source);
|
||||
|
||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||
@ -45,7 +45,7 @@ var WindowAttentionHandler = class {
|
||||
});
|
||||
notification.setForFeedback(true);
|
||||
|
||||
source.notify(notification);
|
||||
source.showNotification(notification);
|
||||
|
||||
source.signalIDs.push(window.connect('notify::title', () => {
|
||||
let [title, banner] = this._getTitleAndBanner(app, window);
|
||||
@ -54,9 +54,10 @@ var WindowAttentionHandler = class {
|
||||
}
|
||||
};
|
||||
|
||||
var Source = class WindowAttentionSource extends MessageTray.Source {
|
||||
constructor(app, window) {
|
||||
super(app.get_name());
|
||||
var WindowAttentionSource = GObject.registerClass(
|
||||
class WindowAttentionSource extends MessageTray.Source {
|
||||
_init(app, window) {
|
||||
super._init(app.get_name());
|
||||
|
||||
this._window = window;
|
||||
this._app = app;
|
||||
@ -102,4 +103,4 @@ var Source = class WindowAttentionSource extends MessageTray.Source {
|
||||
open() {
|
||||
Main.activateWindow(this._window);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user