diff options
author | Milan Crha <mcrha@redhat.com> | 2009-12-10 23:08:52 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-12-10 23:08:52 +0800 |
commit | 4a9bf4dffd98346f9eee848708df573df56ed1d6 (patch) | |
tree | ff25e44e04c981f030fdbd734520dd6f0c9703cd /calendar | |
parent | 23b4037df07370ee9f2bf069db2256620c0a2f82 (diff) | |
download | gsoc2013-evolution-4a9bf4dffd98346f9eee848708df573df56ed1d6.tar.gz gsoc2013-evolution-4a9bf4dffd98346f9eee848708df573df56ed1d6.tar.zst gsoc2013-evolution-4a9bf4dffd98346f9eee848708df573df56ed1d6.zip |
Bug #499322 - Use extension for "Save as" suggested file name
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/comp-util.c | 19 | ||||
-rw-r--r-- | calendar/gui/comp-util.h | 2 |
2 files changed, 21 insertions, 0 deletions
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 |