From 4a9bf4dffd98346f9eee848708df573df56ed1d6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 10 Dec 2009 16:08:52 +0100 Subject: Bug #499322 - Use extension for "Save as" suggested file name --- calendar/gui/comp-util.c | 19 +++++++++++++++++++ calendar/gui/comp-util.h | 2 ++ 2 files changed, 21 insertions(+) (limited to 'calendar/gui') diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index a745b61e12..c5254a427f 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -860,3 +860,22 @@ comp_util_sanitize_recurrence_master (ECalComponent *comp, ECal *client) g_object_unref (master); } + +gchar * +icalcomp_suggest_filename (icalcomponent *icalcomp, const gchar *default_name) +{ + icalproperty *prop; + const gchar *summary = NULL; + + if (!icalcomp) + return g_strconcat (default_name, ".ics", NULL); + + prop = icalcomponent_get_first_property (icalcomp, ICAL_SUMMARY_PROPERTY); + if (prop) + summary = icalproperty_get_summary (prop); + + if (!summary || !*summary) + summary = default_name; + + return g_strconcat (summary, ".ics", NULL); +} diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h index 2faea3e217..d328627145 100644 --- a/calendar/gui/comp-util.h +++ b/calendar/gui/comp-util.h @@ -59,4 +59,6 @@ void cal_comp_set_dtend_with_oldzone (ECal *client, ECalComponent *comp, const E gboolean cal_comp_process_source_list_drop (ECal *destination, icalcomponent *comp, GdkDragAction action, const gchar *source_uid, ESourceList *source_list); void comp_util_sanitize_recurrence_master (ECalComponent *comp, ECal *client); +gchar *icalcomp_suggest_filename (icalcomponent *icalcomp, const gchar *default_name); + #endif -- cgit