[california/wip/740088-invite] Generate a pristine "invite.ics" for the mail client



commit aee68925e1ed05b231b5f2eacaf4a95713cd90b8
Author: Jim Nelson <jim yorba org>
Date:   Tue Nov 18 18:10:15 2014 -0800

    Generate a pristine "invite.ics" for the mail client

 src/host/host-create-update-event.vala |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index 902d0eb..516c411 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -403,19 +403,23 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         Component.iCalendar ics = new Component.iCalendar(iCal.icalproperty_method.REQUEST,
             Component.ICAL_PRODID, Component.ICAL_VERSION, null, event.attendees);
         
+        // export .ics to temporary directory so the filename is a pristine "invite.ics"
         string temporary_filename;
         try {
-            int temporary_handle = FileUtils.open_tmp("california-invite-XXXXXX.ics",
-                out temporary_filename);
+            // "invite.ics" is the name of the file for an event invite delivered via email ...
+            // please translate but keep the .ics extension, as that's common to most calendar
+            // applications
+            temporary_filename = 
File.new_for_path(DirUtils.make_tmp("california-XXXXXX")).get_child(_("invite.ics")).get_path();
+            debug(temporary_filename);
             FileUtils.set_contents(temporary_filename, ics.source);
-            FileUtils.close(temporary_handle);
             
-            // ensure this file is only readable by the user ... this needs to be done after the
-            // file is closed
+            // ensure this file is only readable by the user
             FileUtils.chmod(temporary_filename, (int) (Posix.S_IRUSR | Posix.S_IWUSR));
         } catch (Error err) {
             Application.instance.error_message(deck.get_toplevel() as Gtk.Window,
                 _("Unable to export .ics: %s").printf(err.message));
+            
+            return;
         }
         
         // build the mailto: for the default mail application


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]