[polari/gnotification: 1/2] Use new GNotification API



commit 56a4015517f5caed1d7fc51381f6440c33c52384
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 10 19:13:38 2013 +0100

    Use new GNotification API

 src/Makefile.am |    1 -
 src/chatView.js |   18 ++++-------
 src/notify.js   |   90 -------------------------------------------------------
 3 files changed, 7 insertions(+), 102 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index da04646..ef50af3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,7 +38,6 @@ dist_js_DATA = \
        main.js \
        mainWindow.js \
        messageDialog.js \
-       notify.js \
        pasteManager.js \
        roomList.js \
        tabCompletion.js \
diff --git a/src/chatView.js b/src/chatView.js
index 5d530ab..7136be0 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -8,7 +8,6 @@ const Tpl = imports.gi.TelepathyLogger;
 
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
-const Notify = imports.notify;
 const Utils = imports.utils;
 
 const MAX_NICK_CHARS = 8;
@@ -109,8 +108,8 @@ const ChatView = new Lang.Class({
         let adj = this.widget.vadjustment;
         this._scrollBottom = adj.upper - adj.page_size;
 
-        let app = Gio.Application.get_default();
-        app.pasteManager.addWidget(this._view);
+        this._app = Gio.Application.get_default();
+        this._app.pasteManager.addWidget(this._view);
 
         this._linkCursor = Gdk.Cursor.new(Gdk.CursorType.HAND1);
 
@@ -574,20 +573,17 @@ const ChatView = new Lang.Class({
 
         if (message.shouldHighlight && !this._toplevelFocus) {
             let summary = '%s %s'.format(this._room.display_name, message.nick);
-            let notification = new Notify.Notification(summary, message.text);
+            let notification = new Gio.Notification();
+            notification.set_title(summary);
+            notification.set_body(message.text);
 
             let account = this._room.channel.connection.get_account();
             let param = GLib.Variant.new('(ssu)',
                                          [ account.get_object_path(),
                                            this._room.channel.identifier,
                                            TP_CURRENT_TIME ]);
-            notification.addAction('default', 'default');
-            notification.connect('action-invoked', function() {
-                let app = Gio.Application.get_default();
-                let action = app.lookup_action('join-room');
-                action.activate(param);
-            });
-            notification.show();
+            notification.set_default_action_and_target('app.join-room', param);
+            this._app.send_notification(null, notification);
         }
 
         let buffer = this._view.get_buffer();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]