Skip to content

Commit

Permalink
Merge pull request #15 from kjlaw89/tray-bugs
Browse files Browse the repository at this point in the history
Fixes a few issues with the tray
Closes #13, #11, #14
  • Loading branch information
kjlaw89 authored May 5, 2018
2 parents 2078f6d + dbeb51a commit 40a06d9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
14 changes: 13 additions & 1 deletion data/com.github.kjlaw89.webwatcher.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@
<li>Does not require an external service (uses local network to check sites)</li>
<li>Runs in background automatically once started via System tray indicator</li>
</ul>
</description>
</description>
<releases>
<release version="1.0.1" date="2018-05-04">
<description>
<p>Fixed an issue where tray does not appear on first load making it hard to close app</p>
</description>
</release>
<release version="1.0.0" date="2018-05-04">
<description>
<p>Initial 1.0.0 release!</p>
</description>
</release>
</releases>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">none</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
Expand Down
5 changes: 3 additions & 2 deletions src/controllers/AppController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace App.Controllers {
// Watch online/offline events
site.status_changed.connect (this.site_status_changed);

if (site.status == "bad") {
if (site.active && site.status == "bad") {
this.offlineCount++;
}
}
Expand Down Expand Up @@ -124,6 +124,7 @@ namespace App.Controllers {

sites.add (site);
this.View.siteListView.addSite (site);
this.indicatorView.addSite (site);
break;
}
});
Expand Down Expand Up @@ -151,7 +152,7 @@ namespace App.Controllers {
}

private void site_status_changed (SiteModel site, SiteEvent status) {
if (!site.notify) {
if (!site.notify || !site.active) {
return;
}

Expand Down
6 changes: 5 additions & 1 deletion src/views/AppIndicatorView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace App.Views {
*/
public AppIndicatorView (AppIndicator.Indicator indicator) {
this.indicator = indicator;
this.show_all ();
build_menu ();
}

public void addSite (SiteModel site) {
Expand Down Expand Up @@ -85,6 +85,10 @@ namespace App.Views {
}

foreach (var entry in sitesList.entries) {
if (entry.key.active == false) {
continue;
}

this.add (entry.value);
}

Expand Down
6 changes: 6 additions & 0 deletions src/widgets/IndicatorItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace App.Widgets {

private string previousLabel;
private string previousStatus;
private bool? previousActiveStatus;
private SiteModel _site;

public signal void changed ();
Expand Down Expand Up @@ -91,6 +92,11 @@ namespace App.Widgets {

this.previousStatus = Site.status;
}

if (this.previousActiveStatus == null || this.previousActiveStatus != Site.active) {
this.previousActiveStatus = Site.active;
this.changed ();
}
}
}
}

0 comments on commit 40a06d9

Please sign in to comment.