lundi 26 janvier 2015

How can I tell if a Calendar is selected in Calendar.app (via code)


Is there a way to programmatically tell which calendars are currently shown (checkbox is checked) in the Calendar.app sidebar in OS X Yosemite?


Prior to OS X Yosemite, the "Checked" property in the Calendar app Info.plist file reflected the UI status. In Yosemite it does not update when you check or uncheck the calendar in the Calendar.app sidebar


For Example:



  1. Create some calendars, including, for example, the default US Holiday Calendar. My calendars are all in iCloud.

  2. In Terminal.app: $ cd ~/Library/Calendars/

  3. In Terminal.app: $ grep -A1 Checked *.calendar/Info.plist


I see the following:



204425FA-B3AC-4640-A8B6-7823EB315031.calendar/Info.plist: <key>Checked</key>
204425FA-B3AC-4640-A8B6-7823EB315031.calendar/Info.plist- <integer>1</integer>
--
7768ACE8-CE96-4B72-AC39-7556344E799F.calendar/Info.plist: <key>Checked</key>
7768ACE8-CE96-4B72-AC39-7556344E799F.calendar/Info.plist- <integer>1</integer>
--
E8FEC3D7-EF80-41A3-A9EF-A5F48B8E0582.calendar/Info.plist: <key>Checked</key>
E8FEC3D7-EF80-41A3-A9EF-A5F48B8E0582.calendar/Info.plist- <integer>1</integer>




  1. Uncheck some or all of those calendars by clicking the checkbox in the Calender.app left side-pane




  2. Re-run the command from step 3: "grep -A1 Checked *.calendar/Info.plist". Nothing changes.




Prior to Yosemite, the plist file was updated.





Aucun commentaire:

Enregistrer un commentaire