[polari] Use new GNotification API



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

    Use new GNotification API
    
    Bump the GIO requirement and replace our own org.freedesktop.Notifications
    implementation with the new GNotification API.

 configure.ac    |    2 +-
 src/Makefile.am |    1 -
 src/chatView.js |   18 ++++-------
 src/notify.js   |   90 -------------------------------------------------------
 4 files changed, 8 insertions(+), 103 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d852a71..ab201e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ LT_INIT([disable-static])
 GLIB_GSETTINGS
 
 PKG_CHECK_MODULES(POLARI,
-                  gio-2.0
+                  gio-2.0 >= 2.39.0
                   gobject-introspection-1.0
                   gtk+-3.0 >= 3.9.12
                   telepathy-glib);
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e02534..27d4b95 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,7 +39,6 @@ dist_js_DATA = \
        main.js \
        mainWindow.js \
        messageDialog.js \
-       notify.js \
        pasteManager.js \
        roomList.js \
        roomStack.js \
diff --git a/src/chatView.js b/src/chatView.js
index 46c7bff..df649f3 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;
@@ -110,8 +109,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);
 
@@ -640,20 +639,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.account;
             let param = GLib.Variant.new('(ssu)',
                                          [ account.get_object_path(),
                                            this._room.channel_name,
                                            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]