Permalink
Browse files

Merge pull request #50 from kamilprusko/master

Keep track of time when suspending system, plus some fixes
  • Loading branch information...
kamilprusko committed Mar 7, 2012
2 parents ab89050 + f9b2f07 commit 61f4def4e59dc76c073085e70a1242fa95f4dd86
Showing with 158 additions and 82 deletions.
  1. +2 −2 po/pl.po
  2. +28 −16 src/notification.js
  3. +128 −64 src/timer.js
View
@@ -107,15 +107,15 @@ msgstr "Koniec pomodoro!"
#: ../src/timer.js:370
msgid "Hide"
-msgstr "Ukryj"
+msgstr "Schowaj"
#: ../src/timer.js:376 ../src/timer.js:388
msgid "Start a new pomodoro"
msgstr "Zacznij nowe pomodoro"
#: ../src/timer.js:381
msgid "Show dialog"
-msgstr "Pokarz okienko"
+msgstr "Pokaż okienko"
#: ../src/timer.js:446
#, c-format
View
@@ -140,6 +140,7 @@ NotificationDialog.prototype = {
open: function(timestamp) {
if (ModalDialog.ModalDialog.prototype.open.call(this, timestamp)) {
+ this._closeNotification();
this._disconnectInternals();
this._enableEventCapture();
return true; // dialog already opened
@@ -189,31 +190,42 @@ NotificationDialog.prototype = {
},
_openNotification: function() {
- let source = new NotificationSource();
- this._notification = new MessageTray.Notification(source, this._title, this._description, null);
- this._notification.setResident(true);
-
- // Create buttons
- for (let i=0; i < this._notificationButtons.length; i++) {
+ if (!this._notification) {
+ let source = new NotificationSource();
+ this._notification = new MessageTray.Notification(source, this._title, this._description, null);
+ this._notification.setResident(true);
+
+ // Force to show description along with title,
+ // as this is private property API may change
try {
- this._notification.addButton(i, this._notificationButtons[i].label);
+ this._notification._titleFitsInBannerMode = true;
}
- catch (e) {
+ catch(e) {
global.logError('Pomodoro: ' + e.message);
}
- }
-
- // Connect actions
- this._notification.connect('action-invoked', Lang.bind(this, function(object, id) {
+
+ // Create buttons
+ for (let i=0; i < this._notificationButtons.length; i++) {
try {
- this._notificationButtons[id].action();
+ this._notification.addButton(i, this._notificationButtons[i].label);
}
catch (e) {
global.logError('Pomodoro: ' + e.message);
}
- }));
-
- source.notify(this._notification);
+ }
+
+ // Connect actions
+ this._notification.connect('action-invoked', Lang.bind(this, function(object, id) {
+ try {
+ this._notificationButtons[id].action();
+ }
+ catch (e) {
+ global.logError('Pomodoro: ' + e.message);
+ }
+ }));
+
+ source.notify(this._notification);
+ }
},
_closeNotification: function() {
Oops, something went wrong.

0 comments on commit 61f4def

Please sign in to comment.