summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-06-10 16:20:15 +0200
committerWim Taymans <wtaymans@redhat.com>2014-06-10 16:20:15 +0200
commitb15231d4ee01c09d09d6589289d0873535a8391c (patch)
tree1c9f12be5dbce0c0cc5069226de22dccab5a8291
parent21a5c2e0f8f9cd01742c614aa28e6e4fef2fbf5b (diff)
Add notify
-rw-r--r--src/app/window.js39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/app/window.js b/src/app/window.js
index 4c0f14e..90ee000 100644
--- a/src/app/window.js
+++ b/src/app/window.js
@@ -20,6 +20,7 @@ const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
+const Notify = imports.gi.Notify;
const Lang = imports.lang;
const Params = imports.misc.params;
@@ -29,6 +30,8 @@ const Gettext = imports.gettext;
const Tweener = imports.tweener.tweener;
const Recording = imports.app.recording;
+Notify.init('gnome-screen-recorder');
+
const Page = {
SCREENSHOTS: 0,
RECORDINGS: 1
@@ -124,7 +127,8 @@ const NewScreenshotController = new Lang.Class({
-1,
null,
null);
- }
+
+ },
});
const NewRecordingController = new Lang.Class({
@@ -191,6 +195,39 @@ const NewRecordingController = new Lang.Class({
-1,
null,
null);
+
+ this.notification = new Notify.Notification ({
+ body: 'Desktop Recording started',
+ icon_name: null,
+ id: 0,
+ summary: null,});
+ this.notification.connect('closed', Lang.bind(this, this._onNotifyClosed));
+ this.notification.add_action('record-stop', 'Stop Recording',
+ Lang.bind (this, this._onStopRecord));
+ this.notification.show();
+ },
+
+ stopRecording: function() {
+ let connection = Gio.Application.get_default().get_dbus_connection();
+
+ connection.call_sync ('org.gnome.Shell.Screencast',
+ '/org/gnome/Shell/Screencast',
+ 'org.gnome.Shell.Screencast',
+ 'StopScreencast',
+ null,
+ null,
+ Gio.DBusConnectionFlags.NONE,
+ -1,
+ null,
+ null);
+ },
+
+ _onNotifyClosed: function(notification) {
+ this.stopRecording();
+ },
+
+ _onStopRecord: function(notification, id) {
+ notification.close();
}
});