Skip to content

Commit

Permalink
Cleanup of calendar when add-on uninstalled
Browse files Browse the repository at this point in the history
Removed old screenshots, bumped supported version to 46.*
  • Loading branch information
Roy Kokkelkoren committed May 1, 2016
1 parent a88f98f commit cdd78ea
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion chrome/content/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ Components.utils.import("resource://calendar/modules/calUtils.jsm");
Components.utils.import("resource://todotxt/logger.jsm");

window.addEventListener("load", function(e) {
var ID = "{00C350E2-3F65-11E5-8E8B-FBF81D5D46B0}";
let ID = "{00C350E2-3F65-11E5-8E8B-FBF81D5D46B0}";
var calManager = cal.getCalendarManager();
let found = false;

// Add observers to trigger when add-on is uninstalled
AddonManager.addAddonListener({
onUninstalling: function(addon) {
if (addon.id == "[email protected]")
removeCal(calManager);
todotxtLogger.debug("overlay.js","Uninstalling");
},
});

for each (calendar in calManager.getCalendars({})){
if(calendar.providerID == ID){
todotxtLogger.debug("overlay.js","Calendar found");
Expand All @@ -26,3 +35,14 @@ function createCal(calManager){
newCal.name = "Todo.txt";
calManager.registerCalendar(newCal);
}

function removeCal(calManager){
let ID = "{00C350E2-3F65-11E5-8E8B-FBF81D5D46B0}";
for each (calendar in calManager.getCalendars({})){
if(calendar.providerID == ID){
calManager.removeCalendar(calendar);
todotxtLogger.debug("overlay.js","Calendar found and removed");
break;
}
}
}
4 changes: 2 additions & 2 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:name>Todo.txt Extension</em:name>
<em:version>0.6</em:version>
<em:version>0.7</em:version>
<em:type>2</em:type>
<em:creator>Roy Kokkelkoren</em:creator>
<em:description>Thunderbird extension for the Todo.txt application</em:description>
Expand All @@ -20,7 +20,7 @@
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>17.0</em:minVersion>
<em:maxVersion>44.*</em:maxVersion>
<em:maxVersion>46.*</em:maxVersion>
</Description>
</em:targetApplication>

Expand Down
Binary file removed screenshots/screenshot_1.png
Binary file not shown.
Binary file removed screenshots/screenshot_2.png
Binary file not shown.
Binary file removed screenshots/screenshot_3.png
Binary file not shown.
Binary file removed screenshots/screenshot_4.png
Binary file not shown.
Binary file removed screenshots/screenshot_5.png
Binary file not shown.

0 comments on commit cdd78ea

Please sign in to comment.