Skip to content

Commit 8b3eb87

Browse files
committed
version 0.4.0 is ready
1 parent e1151fa commit 8b3eb87

File tree

6 files changed

+42
-23
lines changed

6 files changed

+42
-23
lines changed

Diff for: src/data/context.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ ul
191191
text-overflow: ellipsis;
192192
}
193193
#content[type="expanded"] .sender {
194-
max-width: 420px;
194+
max-width: 410px;
195195
}
196196

197197
#email {

Diff for: src/gmail-notifier.xpi

146 Bytes
Binary file not shown.

Diff for: src/lib/main.js

+16-15
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ var config = {
5454
return temp;
5555
},
5656
maxCount: 20,
57-
maxReport: 1 //Maximum number of simultaneous reports from a single account
57+
maxReport: 1, //Maximum number of simultaneous reports from a single account
58+
timeout: 9000
5859
},
5960
//Timing
6061
get period () {return (prefs.period > 10 ? prefs.period : 10) * 1000},
@@ -88,7 +89,7 @@ var config = {
8889

8990
/** tray callback handling **/
9091
tray.callback.install(function () {
91-
console.error(windows.active.focus);
92+
windows.active.focus();
9293
timer.setTimeout(onCommand, 100);
9394
});
9495
/** libraries **/
@@ -664,7 +665,7 @@ function Server () {
664665
return d.promise;
665666
}
666667
}
667-
var emails = config.email.feeds.map((feed) => new Email(feed, 5000));
668+
var emails = config.email.feeds.map((feed) => new Email(feed, config.email.timeout));
668669
return (function () {
669670
var color = "blue", count = -1;
670671
return function (forced) {
@@ -680,14 +681,14 @@ function Server () {
680681
icon(null, "blue");
681682
color = "blue";
682683
count = -1;
684+
unreadObjs = [];
683685
}
684686
if (forced) {
685687
open(config.email.url);
686688
notify(_("gmail"), _("msg1"), false);
687689
}
688690
tray.remove();
689691
gButton.tooltiptext = config.defaultTooltip;
690-
console.error(objs, "exit 4");
691692
return;
692693
}
693694
//Removing not logged-in accounts
@@ -704,7 +705,6 @@ console.error(objs, "exit 4");
704705
var newCount = objs.reduce((p,c) => p + c.xml.fullcount, 0);
705706
//
706707
if (!anyNewEmails && !forced && count === newCount) {
707-
console.error(objs, "exit 0", forced, anyNewEmails);
708708
return; //Everything is clear
709709
}
710710
count = newCount;
@@ -743,33 +743,33 @@ console.error(objs, "exit 0", forced, anyNewEmails);
743743
).replace(/\n$/, "");
744744
if (!forced && !anyNewEmails) {
745745
if (newCount) {
746-
icon(newCount, "red"); color = "red";
746+
icon(newCount, "red");
747+
color = "red";
747748
tray.set(newCount, tooltip);
748749
gButton.tooltiptext = tooltip;
749750
}
750751
else {
751-
icon(null, "gray"); color = "gray";
752+
icon(null, "gray");
753+
color = "gray";
752754
tray.remove();
753755
gButton.tooltiptext = tooltip;
754756
}
755-
console.error(objs, "exit 1", forced, anyNewEmails);
756757
}
757758
else if (forced && !newCount) {
758-
icon(null, "gray"); color = "gray";
759+
icon(null, "gray");
760+
color = "gray";
759761
tray.remove();
760762
gButton.tooltiptext = tooltip;
761-
console.error(objs, "exit 3", forced, anyNewEmails);
762763
}
763764
else {
764-
icon(newCount, "new"); color = "new";
765+
icon(newCount, "new");
766+
color = "new";
765767
if (prefs.notification) {
766768
notify(_("gmail"), report, true);
767769
}
768770
if (prefs.tray) tray.set(newCount, tooltip);
769771
if (prefs.alert) play();
770772
gButton.tooltiptext = tooltip;
771-
772-
console.error(objs, "exit 2", forced, anyNewEmails);
773773
}
774774
//Updating the toolbar panel if exists
775775
if (contextPanel.isShowing) {
@@ -811,6 +811,7 @@ sp.on("reset", function() {
811811
prefs.soundVolume = 80;
812812
prefs.tray = true;
813813
prefs.notificationFormat = "From: [author_email][break]Title: [title][break]Summary: [summary]";
814+
prefs.doTrayCallback = false;
814815
});
815816
sp.on("tray", function() {
816817
if (!prefs.tray) {
@@ -819,7 +820,7 @@ sp.on("tray", function() {
819820
else {
820821
tm.reset(true);
821822
}
822-
})
823+
});
823824

824825
/**
825826
* Send archive, mark as read, mark as unread, and trash commands to Gmail server
@@ -958,7 +959,7 @@ var notify = (function () { // https://github.com/fwenzel/copy-shorturl/blob/mas
958959
timer.setTimeout(function () {
959960
// If main window is not focused, restore it first!
960961
windows.active.focus();
961-
onCommand();
962+
timer.setTimeout(onCommand, 100);
962963
}, 100);
963964
}
964965
}, "");

Diff for: src/lib/tray/winnt/tray.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ nid.uTimeoutAndVersion = config.time.notification;
162162
nid.uFlags = 0x00000001 /* NIF_MESSAGE */ | 0x00000002 /* NIF_ICON */ | 0x00000004 /* NIF_TIP */ /* | 0x000000010 NIF_INFO */;
163163
nid.dwInfoFlags = 0x00000001 /* NIIF_INFO */;
164164
//nid.szInfoTitle = _("gmail"); // "Balloon Tooltip" title
165+
// Windows Version
166+
var version = parseInt((/\d\.\d/.exec(windows.active.navigator.oscpu) || ["0"])[0].replace(".", ""));
165167
nid.cbSize = (function () {
166168
function FIELD_OFFSET(aType, aField, aPos) {
167169
var addr2nb = (a) => ctypes.cast(a, ctypes.unsigned_long).value,
168170
s = new aType(),
169171
addr_field = typeof(aPos) === "undefined" ? addr2nb(s.addressOfField(aField)) : addr2nb(s[aField].addressOfElement(aPos));
170172
return addr_field - addr2nb(s.address());
171173
}
172-
// Windows Version
173-
var version = parseInt((/\d\.\d/.exec(windows.active.navigator.oscpu) || ["0"])[0].replace(".", ""));
174174
if (version >= 60) { //Vista
175175
return NOTIFYICONDATAW.size;
176176
}
@@ -190,7 +190,17 @@ var proxyWndProc = WNDPROC (function (hWnd, uMsg, wParam, lParam) {
190190
}
191191
return user32.DefWindowProcW(hWnd, uMsg, wParam, lParam);
192192
})
193-
var oldOffset = user32.SetWindowLongW(hWnd, -4 /* GWLP_WNDPROC */, ctypes.cast(proxyWndProc, LONG_PTR));
193+
194+
var oldOffset;
195+
if (!prefs.trayFirstRun) {
196+
prefs.trayFirstRun = true;
197+
if (version >= 60) { //Vista
198+
prefs.doTrayCallback = true;
199+
}
200+
}
201+
if (prefs.doTrayCallback) {
202+
oldOffset = user32.SetWindowLongW(hWnd, -4 /* GWLP_WNDPROC */, ctypes.cast(proxyWndProc, LONG_PTR));
203+
}
194204

195205
var isInstalled = false;
196206
exports.set = function (badge, msg) {
@@ -216,8 +226,9 @@ exports.callback = {
216226
callback = c;
217227
},
218228
remove: function () {
219-
console.error(0, oldOffset.toSource())
220-
user32.SetWindowLongW(hWnd, -4, oldOffset);
229+
if (oldOffset) {
230+
user32.SetWindowLongW(hWnd, -4, oldOffset);
231+
}
221232
}
222233
}
223234

Diff for: src/package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"contributors": ["CaTz", "ecaron"],
1111

1212
"url": "",
13-
"version": "0.4.0b1",
13+
"version": "0.4.0",
1414
"lib": "lib",
1515
"main": "main",
1616

@@ -77,6 +77,13 @@
7777
"type": "bool",
7878
"value": true
7979
},
80+
{
81+
"name": "doTrayCallback",
82+
"title": "Open toolbar panel when click on the taskbar notification icon (beta):",
83+
"description": "This feature is highly experimental and might make your Firefox browser unstable. [Restart required]",
84+
"type": "bool",
85+
"value": false
86+
},
8087
{
8188
"name": "alphabetic",
8289
"title": "Sort account selections alphabetically:",

Diff for: template/install.rdf

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<em:targetApplication>
1313
<Description>
1414
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
15-
<em:minVersion>27.0</em:minVersion>
15+
<em:minVersion>25.0</em:minVersion>
1616
<em:maxVersion>30.0</em:maxVersion>
1717
</Description>
1818
</em:targetApplication>

0 commit comments

Comments
 (0)