aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/comp-util.c19
-rw-r--r--calendar/gui/comp-util.h2
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