@@ -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 **/
9091tray . 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} ) ;
815816sp . 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 } , "" ) ;
0 commit comments