[polari/gnotification] Use new GNotification API



commit ca017e95403eaa64f777d1fa3a9027694ed0104d
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 |   20 +++++-------
 src/notify.js   |   90 -------------------------------------------------------
 3 files changed, 9 insertions(+), 102 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index ec8845e..e22c6ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,6 @@ dist_js_DATA = \
        joinDialog.js \
        main.js \
        mainWindow.js \
-       notify.js \
        pasteManager.js \
        roomList.js \
        tabCompletion.js \
diff --git a/src/chatView.js b/src/chatView.js
index bf9242a..05ee63d 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -6,7 +6,6 @@ const Pango = imports.gi.Pango;
 const Tp = imports.gi.TelepathyGLib;
 
 const Lang = imports.lang;
-const Notify = imports.notify;
 const Utils = imports.utils;
 
 const MAX_NICK_CHARS = 8;
@@ -46,8 +45,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);
 
@@ -385,20 +384,19 @@ const ChatView = new Lang.Class({
 
             if (!this._toplevelFocus) {
                 let summary = '%s %s'.format(this._room.display_name, nick);
-                let notification = new Notify.Notification(summary, text);
+                let notification = new Gio.Notification();
+                notification.set_title(summary);
+                notification.set_body(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);
             }
         }
 


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