[gnome-documents] notifications: Use inheritance instead of composition
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] notifications: Use inheritance instead of composition
- Date: Mon, 12 Oct 2015 18:35:42 +0000 (UTC)
commit 2d14e3ffc2cd44b97d0a44bbd59f8322ef33b025
Author: Alessandro Bono <shadow openaliasbox org>
Date: Wed Aug 19 17:05:11 2015 +0200
notifications: Use inheritance instead of composition
https://bugzilla.gnome.org/show_bug.cgi?id=752792
src/embed.js | 2 +-
src/notifications.js | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index d5d5cd6..f21c0cd 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -73,7 +73,7 @@ const Embed = new Lang.Class({
this._stackOverlay.add(this._stack);
// pack the OSD notification widget
- this._stackOverlay.add_overlay(Application.notificationManager.widget);
+ this._stackOverlay.add_overlay(Application.notificationManager);
// now create the actual content widgets
this._documents = new View.ViewContainer(WindowMode.WindowMode.DOCUMENTS);
diff --git a/src/notifications.js b/src/notifications.js
index 77ade90..9db8c5e 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -336,16 +336,17 @@ const IndexingNotification = new Lang.Class({
const NotificationManager = new Lang.Class({
Name: 'NotificationManager',
+ Extends: Gd.Notification,
_init: function() {
- this.widget = new Gd.Notification({ timeout: -1,
- show_close_button: false,
- halign: Gtk.Align.CENTER,
- valign: Gtk.Align.START });
+ this.parent({ timeout: -1,
+ show_close_button: false,
+ halign: Gtk.Align.CENTER,
+ valign: Gtk.Align.START });
this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
row_spacing: 6 });
- this.widget.add(this._grid);
+ this.add(this._grid);
// add indexing monitor notification
this._indexingNotification = new IndexingNotification();
@@ -355,14 +356,14 @@ const NotificationManager = new Lang.Class({
this._grid.add(notification.widget);
notification.widget.connect('destroy', Lang.bind(this, this._onWidgetDestroy));
- this.widget.show_all();
+ this.show_all();
},
_onWidgetDestroy: function() {
let children = this._grid.get_children();
if (children.length == 0)
- this.widget.hide();
+ this.hide();
}
});
Signals.addSignalMethods(NotificationManager.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]