Lines 660-666
find_attendee (icalcomponent *ical_comp,
Link Here
|
660 |
|
660 |
|
661 |
static void |
661 |
static void |
662 |
write_label_piece (EItipControl *itip, ECalComponentDateTime *dt, |
662 |
write_label_piece (EItipControl *itip, ECalComponentDateTime *dt, |
663 |
char *buffer, int size, |
663 |
GString *buffer, |
664 |
const char *stext, const char *etext, |
664 |
const char *stext, const char *etext, |
665 |
gboolean just_date) |
665 |
gboolean just_date) |
666 |
{ |
666 |
{ |
Lines 685-697
write_label_piece (EItipControl *itip, E
Link Here
|
685 |
tmp_tm.tm_hour = tmp_tm.tm_min = tmp_tm.tm_sec = 0; |
685 |
tmp_tm.tm_hour = tmp_tm.tm_min = tmp_tm.tm_sec = 0; |
686 |
|
686 |
|
687 |
if (stext != NULL) |
687 |
if (stext != NULL) |
688 |
strcat (buffer, stext); |
688 |
g_string_append (buffer, stext); |
689 |
|
689 |
|
690 |
e_time_format_date_and_time (&tmp_tm, |
690 |
e_time_format_date_and_time (&tmp_tm, |
691 |
calendar_config_get_24_hour_format (), |
691 |
calendar_config_get_24_hour_format (), |
692 |
FALSE, FALSE, |
692 |
FALSE, FALSE, |
693 |
time_buf, sizeof (time_buf)); |
693 |
time_buf, sizeof (time_buf)); |
694 |
strcat (buffer, time_buf); |
694 |
g_string_append (buffer, time_buf); |
695 |
|
695 |
|
696 |
if (!dt->value->is_utc && dt->tzid) { |
696 |
if (!dt->value->is_utc && dt->tzid) { |
697 |
zone = icalcomponent_get_timezone (priv->top_level, dt->tzid); |
697 |
zone = icalcomponent_get_timezone (priv->top_level, dt->tzid); |
Lines 703-723
write_label_piece (EItipControl *itip, E
Link Here
|
703 |
UTF-8. But it probably is not translated. */ |
703 |
UTF-8. But it probably is not translated. */ |
704 |
display_name = icaltimezone_get_display_name (zone); |
704 |
display_name = icaltimezone_get_display_name (zone); |
705 |
if (display_name && *display_name) { |
705 |
if (display_name && *display_name) { |
706 |
strcat (buffer, " <font size=-1>["); |
706 |
g_string_append_len (buffer, " <font size=-1>[", 16); |
707 |
|
707 |
|
708 |
/* We check if it is one of our builtin timezone names, |
708 |
/* We check if it is one of our builtin timezone names, |
709 |
in which case we call gettext to translate it. */ |
709 |
in which case we call gettext to translate it. */ |
710 |
if (icaltimezone_get_builtin_timezone (display_name)) { |
710 |
if (icaltimezone_get_builtin_timezone (display_name)) { |
711 |
strcat (buffer, _(display_name)); |
711 |
g_string_append_printf (buffer, "%s", _(display_name)); |
712 |
} else { |
712 |
} else { |
713 |
strcat (buffer, display_name); |
713 |
g_string_append_printf (buffer, "%s", display_name); |
714 |
} |
714 |
} |
715 |
strcat (buffer, "]</font>"); |
715 |
g_string_append_len (buffer, "]</font>", 8); |
716 |
} |
716 |
} |
717 |
} |
717 |
} |
718 |
|
718 |
|
719 |
if (etext != NULL) |
719 |
if (etext != NULL) |
720 |
strcat (buffer, etext); |
720 |
g_string_append (buffer, etext); |
721 |
} |
721 |
} |
722 |
|
722 |
|
723 |
static const char * |
723 |
static const char * |
Lines 754-772
get_dayname (struct icalrecurrencetype *
Link Here
|
754 |
|
754 |
|
755 |
static void |
755 |
static void |
756 |
write_recurrence_piece (EItipControl *itip, ECalComponent *comp, |
756 |
write_recurrence_piece (EItipControl *itip, ECalComponent *comp, |
757 |
char *buffer, int size) |
757 |
GString *buffer) |
758 |
{ |
758 |
{ |
759 |
GSList *rrules; |
759 |
GSList *rrules; |
760 |
struct icalrecurrencetype *r; |
760 |
struct icalrecurrencetype *r; |
761 |
int len, i; |
761 |
int i; |
762 |
|
762 |
|
763 |
strcpy (buffer, "<b>Recurring:</b> "); |
763 |
g_string_append_len (buffer, "<b>Recurring:</b> ", 18); |
764 |
len = strlen (buffer); |
|
|
765 |
buffer += len; |
766 |
size -= len; |
767 |
|
764 |
|
768 |
if (!e_cal_component_has_simple_recurrence (comp)) { |
765 |
if (!e_cal_component_has_simple_recurrence (comp)) { |
769 |
strcpy (buffer, _("Yes. (Complex Recurrence)")); |
766 |
g_string_append_printf ( |
|
|
767 |
buffer, "%s", _("Yes. (Complex Recurrence)")); |
770 |
return; |
768 |
return; |
771 |
} |
769 |
} |
772 |
|
770 |
|
Lines 782-788
write_recurrence_piece (EItipControl *it
Link Here
|
782 |
Every %d day/days" */ |
780 |
Every %d day/days" */ |
783 |
/* For Translators : 'Every day' is event Recurring every day */ |
781 |
/* For Translators : 'Every day' is event Recurring every day */ |
784 |
/* For Translators : 'Every %d days' is event Recurring every %d days. %d is a digit */ |
782 |
/* For Translators : 'Every %d days' is event Recurring every %d days. %d is a digit */ |
785 |
sprintf (buffer, ngettext("Every day", "Every %d days", r->interval), r->interval); |
783 |
g_string_append_printf ( |
|
|
784 |
buffer, ngettext ("Every day", |
785 |
"Every %d days", r->interval), |
786 |
r->interval); |
786 |
break; |
787 |
break; |
787 |
|
788 |
|
788 |
case ICAL_WEEKLY_RECURRENCE: |
789 |
case ICAL_WEEKLY_RECURRENCE: |
Lines 792-820
write_recurrence_piece (EItipControl *it
Link Here
|
792 |
Every %d week/weeks" */ |
793 |
Every %d week/weeks" */ |
793 |
/* For Translators : 'Every week' is event Recurring every week */ |
794 |
/* For Translators : 'Every week' is event Recurring every week */ |
794 |
/* For Translators : 'Every %d weeks' is event Recurring every %d weeks. %d is a digit */ |
795 |
/* For Translators : 'Every %d weeks' is event Recurring every %d weeks. %d is a digit */ |
795 |
sprintf (buffer, ngettext("Every week", "Every %d weeks", r->interval), r->interval); |
796 |
g_string_append_printf ( |
|
|
797 |
buffer, ngettext ("Every week", |
798 |
"Every %d weeks", r->interval), |
799 |
r->interval); |
796 |
} else { |
800 |
} else { |
797 |
/* For Translators : 'Every week on' is event Recurring every week on (dayname) and (dayname) and (dayname) */ |
801 |
/* For Translators : 'Every week on' is event Recurring every week on (dayname) and (dayname) and (dayname) */ |
798 |
/* For Translators : 'Every %d weeks on' is event Recurring: every %d weeks on (dayname) and (dayname). %d is a digit */ |
802 |
/* For Translators : 'Every %d weeks on' is event Recurring: every %d weeks on (dayname) and (dayname). %d is a digit */ |
799 |
sprintf (buffer, ngettext("Every week on ", "Every %d weeks on ", r->interval), r->interval); |
803 |
g_string_append_printf ( |
|
|
804 |
buffer, ngettext ("Every week on ", |
805 |
"Every %d weeks on ", r->interval), |
806 |
r->interval); |
800 |
|
807 |
|
801 |
for (i = 1; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { |
808 |
for (i = 1; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { |
802 |
if (i > 1) |
809 |
if (i > 1) |
803 |
strcat (buffer, ", "); |
810 |
g_string_append_len (buffer, ", ", 2); |
804 |
strcat (buffer, get_dayname (r, i - 1)); |
811 |
g_string_append (buffer, get_dayname (r, i - 1)); |
805 |
} |
812 |
} |
806 |
if (i > 1) |
813 |
if (i > 1) |
807 |
/* For Translators : 'and' is part of the sentence 'event recurring every week on (dayname) and (dayname)' */ |
814 |
/* For Translators : 'and' is part of the sentence 'event recurring every week on (dayname) and (dayname)' */ |
808 |
strcat (buffer, _(" and ")); |
815 |
g_string_append_printf (buffer, "%s", _(" and ")); |
809 |
strcat (buffer, get_dayname (r, i - 1)); |
816 |
g_string_append (buffer, get_dayname (r, i - 1)); |
810 |
} |
817 |
} |
811 |
break; |
818 |
break; |
812 |
|
819 |
|
813 |
case ICAL_MONTHLY_RECURRENCE: |
820 |
case ICAL_MONTHLY_RECURRENCE: |
814 |
if (r->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
821 |
if (r->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { |
815 |
/* For Translators : 'The %s day of' is part of the sentence 'event recurring on the (nth) day of every month.' */ |
822 |
/* For Translators : 'The %s day of' is part of the sentence 'event recurring on the (nth) day of every month.' */ |
816 |
sprintf (buffer, _("The %s day of "), |
823 |
g_string_append_printf ( |
817 |
nth (r->by_month_day[0])); |
824 |
buffer, _("The %s day of "), |
|
|
825 |
nth (r->by_month_day[0])); |
818 |
} else { |
826 |
} else { |
819 |
int pos; |
827 |
int pos; |
820 |
|
828 |
|
Lines 828-847
write_recurrence_piece (EItipControl *it
Link Here
|
828 |
|
836 |
|
829 |
/* For Translators : 'The %s %s of' is part of the sentence 'event recurring on the (nth) (dayname) of every month.' |
837 |
/* For Translators : 'The %s %s of' is part of the sentence 'event recurring on the (nth) (dayname) of every month.' |
830 |
eg,third monday of every month */ |
838 |
eg,third monday of every month */ |
831 |
sprintf (buffer, _("The %s %s of "), |
839 |
g_string_append_printf ( |
832 |
nth (pos), get_dayname (r, 0)); |
840 |
buffer, _("The %s %s of "), |
|
|
841 |
nth (pos), get_dayname (r, 0)); |
833 |
} |
842 |
} |
834 |
|
843 |
|
835 |
len = strlen (buffer); |
|
|
836 |
buffer += len; |
837 |
size -= len; |
838 |
/* For Translators: In this can also be translated as "With the period of %d |
844 |
/* For Translators: In this can also be translated as "With the period of %d |
839 |
month/months", where %d is a number. The entire sentence is of the form "Recurring: |
845 |
month/months", where %d is a number. The entire sentence is of the form "Recurring: |
840 |
Every %d month/months" */ |
846 |
Every %d month/months" */ |
841 |
/* For Translators : 'every month' is part of the sentence 'event recurring on the (nth) day of every month.' */ |
847 |
/* For Translators : 'every month' is part of the sentence 'event recurring on the (nth) day of every month.' */ |
842 |
/* For Translators : 'every %d months' is part of the sentence 'event recurring on the (nth) day of every %d months.' |
848 |
/* For Translators : 'every %d months' is part of the sentence 'event recurring on the (nth) day of every %d months.' |
843 |
%d is a digit */ |
849 |
%d is a digit */ |
844 |
sprintf (buffer, ngettext("every month","every %d months", r->interval), r->interval); |
850 |
g_string_append_printf ( |
|
|
851 |
buffer, ngettext ("every month", |
852 |
"every %d months", r->interval), |
853 |
r->interval); |
845 |
break; |
854 |
break; |
846 |
|
855 |
|
847 |
case ICAL_YEARLY_RECURRENCE: |
856 |
case ICAL_YEARLY_RECURRENCE: |
Lines 850-869
write_recurrence_piece (EItipControl *it
Link Here
|
850 |
Every %d year/years" */ |
859 |
Every %d year/years" */ |
851 |
/* For Translators : 'Every year' is event Recurring every year */ |
860 |
/* For Translators : 'Every year' is event Recurring every year */ |
852 |
/* For Translators : 'Every %d years' is event Recurring every %d years. %d is a digit */ |
861 |
/* For Translators : 'Every %d years' is event Recurring every %d years. %d is a digit */ |
853 |
sprintf (buffer, ngettext("Every year", "Every %d years", r->interval), r->interval); |
862 |
g_string_append_printf ( |
|
|
863 |
buffer, ngettext ("Every year", |
864 |
"Every %d years", r->interval), |
865 |
r->interval); |
854 |
break; |
866 |
break; |
855 |
|
867 |
|
856 |
default: |
868 |
default: |
857 |
g_return_if_reached (); |
869 |
g_return_if_reached (); |
858 |
} |
870 |
} |
859 |
|
871 |
|
860 |
len = strlen (buffer); |
|
|
861 |
buffer += len; |
862 |
size -= len; |
863 |
if (r->count) { |
872 |
if (r->count) { |
864 |
/* For Translators:'a total of %d time' is part of the sentence of the form 'event recurring every day,a total of % time.' %d is a digit*/ |
873 |
/* For Translators:'a total of %d time' is part of the sentence of the form 'event recurring every day,a total of % time.' %d is a digit*/ |
865 |
/* For Translators:'a total of %d times' is part of the sentence of the form 'event recurring every day,a total of % times.' %d is a digit*/ |
874 |
/* For Translators:'a total of %d times' is part of the sentence of the form 'event recurring every day,a total of % times.' %d is a digit*/ |
866 |
sprintf (buffer, ngettext("a total of %d time", " a total of %d times", r->count), r->count); |
875 |
g_string_append_printf ( |
|
|
876 |
buffer, ngettext ("a total of %d time", |
877 |
" a total of %d times", r->count), r->count); |
867 |
} else if (!icaltime_is_null_time (r->until)) { |
878 |
} else if (!icaltime_is_null_time (r->until)) { |
868 |
ECalComponentDateTime dt; |
879 |
ECalComponentDateTime dt; |
869 |
|
880 |
|
Lines 871-882
write_recurrence_piece (EItipControl *it
Link Here
|
871 |
dt.value = &r->until; |
882 |
dt.value = &r->until; |
872 |
dt.tzid = icaltimezone_get_tzid ((icaltimezone *)r->until.zone); |
883 |
dt.tzid = icaltimezone_get_tzid ((icaltimezone *)r->until.zone); |
873 |
|
884 |
|
874 |
write_label_piece (itip, &dt, buffer, size, |
885 |
write_label_piece (itip, &dt, buffer, |
875 |
/* For Translators : ', ending on' is part of the sentence of the form 'event recurring every day, ending on (date).'*/ |
886 |
/* For Translators : ', ending on' is part of the sentence of the form 'event recurring every day, ending on (date).'*/ |
876 |
_(", ending on "), NULL, TRUE); |
887 |
_(", ending on "), NULL, TRUE); |
877 |
} |
888 |
} |
878 |
|
889 |
|
879 |
strcat (buffer, "<br>"); |
890 |
g_string_append_len (buffer, "<br>", 4); |
880 |
} |
891 |
} |
881 |
|
892 |
|
882 |
static void |
893 |
static void |
Lines 884-930
set_date_label (EItipControl *itip, GtkH
Link Here
|
884 |
ECalComponent *comp) |
895 |
ECalComponent *comp) |
885 |
{ |
896 |
{ |
886 |
ECalComponentDateTime datetime; |
897 |
ECalComponentDateTime datetime; |
887 |
static char buffer[1024]; |
898 |
GString *buffer; |
888 |
gchar *str; |
899 |
gchar *str; |
889 |
gboolean wrote = FALSE, task_completed = FALSE; |
900 |
gboolean wrote = FALSE, task_completed = FALSE; |
890 |
ECalComponentVType type; |
901 |
ECalComponentVType type; |
891 |
|
902 |
|
|
|
903 |
buffer = g_string_sized_new (1024); |
892 |
type = e_cal_component_get_vtype (comp); |
904 |
type = e_cal_component_get_vtype (comp); |
893 |
|
905 |
|
894 |
buffer[0] = '\0'; |
|
|
895 |
e_cal_component_get_dtstart (comp, &datetime); |
906 |
e_cal_component_get_dtstart (comp, &datetime); |
896 |
if (datetime.value) { |
907 |
if (datetime.value) { |
897 |
/* For Translators : 'starts' is starts:date implying a task starts on what date */ |
908 |
/* For Translators : 'starts' is starts:date implying a task starts on what date */ |
898 |
str = g_strdup_printf ("<b>%s:</b>", _("Starts")); |
909 |
str = g_strdup_printf ("<b>%s:</b>", _("Starts")); |
899 |
write_label_piece (itip, &datetime, buffer, 1024, |
910 |
write_label_piece (itip, &datetime, buffer, str, "<br>", FALSE); |
900 |
str, |
911 |
gtk_html_write (html, html_stream, buffer->str, buffer->len); |
901 |
"<br>", FALSE); |
|
|
902 |
gtk_html_write (html, html_stream, buffer, strlen(buffer)); |
903 |
wrote = TRUE; |
912 |
wrote = TRUE; |
904 |
g_free (str); |
913 |
g_free (str); |
905 |
} |
914 |
} |
906 |
e_cal_component_free_datetime (&datetime); |
915 |
e_cal_component_free_datetime (&datetime); |
907 |
|
916 |
|
908 |
buffer[0] = '\0'; |
917 |
/* Reset the buffer. */ |
|
|
918 |
g_string_truncate (buffer, 0); |
919 |
|
909 |
e_cal_component_get_dtend (comp, &datetime); |
920 |
e_cal_component_get_dtend (comp, &datetime); |
910 |
if (datetime.value){ |
921 |
if (datetime.value){ |
911 |
/* For Translators : 'ends' is ends:date implying a task ends on what date */ |
922 |
/* For Translators : 'ends' is ends:date implying a task ends on what date */ |
912 |
str = g_strdup_printf ("<b>%s:</b>", _("Ends")); |
923 |
str = g_strdup_printf ("<b>%s:</b>", _("Ends")); |
913 |
write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE); |
924 |
write_label_piece (itip, &datetime, buffer, str, "<br>", FALSE); |
914 |
gtk_html_write (html, html_stream, buffer, strlen (buffer)); |
925 |
gtk_html_write (html, html_stream, buffer->str, buffer->len); |
915 |
wrote = TRUE; |
926 |
wrote = TRUE; |
916 |
g_free (str); |
927 |
g_free (str); |
917 |
} |
928 |
} |
918 |
e_cal_component_free_datetime (&datetime); |
929 |
e_cal_component_free_datetime (&datetime); |
919 |
|
930 |
|
920 |
buffer[0] = '\0'; |
931 |
/* Reset the buffer. */ |
|
|
932 |
g_string_truncate (buffer, 0); |
933 |
|
921 |
if (e_cal_component_has_recurrences (comp)) { |
934 |
if (e_cal_component_has_recurrences (comp)) { |
922 |
write_recurrence_piece (itip, comp, buffer, 1024); |
935 |
write_recurrence_piece (itip, comp, buffer); |
923 |
gtk_html_write (html, html_stream, buffer, strlen (buffer)); |
936 |
gtk_html_write (html, html_stream, buffer->str, buffer->len); |
924 |
wrote = TRUE; |
937 |
wrote = TRUE; |
925 |
} |
938 |
} |
926 |
|
939 |
|
927 |
buffer[0] = '\0'; |
940 |
/* Reset the buffer. */ |
|
|
941 |
g_string_truncate (buffer, 0); |
942 |
|
928 |
datetime.tzid = NULL; |
943 |
datetime.tzid = NULL; |
929 |
e_cal_component_get_completed (comp, &datetime.value); |
944 |
e_cal_component_get_completed (comp, &datetime.value); |
930 |
if (type == E_CAL_COMPONENT_TODO && datetime.value) { |
945 |
if (type == E_CAL_COMPONENT_TODO && datetime.value) { |
Lines 932-951
set_date_label (EItipControl *itip, GtkH
Link Here
|
932 |
timezone. */ |
947 |
timezone. */ |
933 |
str = g_strdup_printf ("<b>%s:</b>", _("Completed")); |
948 |
str = g_strdup_printf ("<b>%s:</b>", _("Completed")); |
934 |
datetime.value->is_utc = TRUE; |
949 |
datetime.value->is_utc = TRUE; |
935 |
write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE); |
950 |
write_label_piece (itip, &datetime, buffer, str, "<br>", FALSE); |
936 |
gtk_html_write (html, html_stream, buffer, strlen (buffer)); |
951 |
gtk_html_write (html, html_stream, buffer->str, buffer->len); |
937 |
wrote = TRUE; |
952 |
wrote = TRUE; |
938 |
task_completed = TRUE; |
953 |
task_completed = TRUE; |
939 |
g_free (str); |
954 |
g_free (str); |
940 |
} |
955 |
} |
941 |
e_cal_component_free_datetime (&datetime); |
956 |
e_cal_component_free_datetime (&datetime); |
942 |
|
957 |
|
943 |
buffer[0] = '\0'; |
958 |
/* Reset the buffer. */ |
|
|
959 |
g_string_truncate (buffer, 0); |
960 |
|
944 |
e_cal_component_get_due (comp, &datetime); |
961 |
e_cal_component_get_due (comp, &datetime); |
945 |
if (type == E_CAL_COMPONENT_TODO && !task_completed && datetime.value) { |
962 |
if (type == E_CAL_COMPONENT_TODO && !task_completed && datetime.value) { |
946 |
str = g_strdup_printf ("<b>%s:</b>", _("Due")); |
963 |
str = g_strdup_printf ("<b>%s:</b>", _("Due")); |
947 |
write_label_piece (itip, &datetime, buffer, 1024, str, "<br>", FALSE); |
964 |
write_label_piece (itip, &datetime, buffer, str, "<br>", FALSE); |
948 |
gtk_html_write (html, html_stream, buffer, strlen (buffer)); |
965 |
gtk_html_write (html, html_stream, buffer->str, buffer->len); |
949 |
wrote = TRUE; |
966 |
wrote = TRUE; |
950 |
g_free (str); |
967 |
g_free (str); |
951 |
} |
968 |
} |
Lines 954-959
set_date_label (EItipControl *itip, GtkH
Link Here
|
954 |
|
971 |
|
955 |
if (wrote) |
972 |
if (wrote) |
956 |
gtk_html_stream_printf (html_stream, "<br>"); |
973 |
gtk_html_stream_printf (html_stream, "<br>"); |
|
|
974 |
|
975 |
g_string_free (buffer, TRUE); |
957 |
} |
976 |
} |
958 |
|
977 |
|
959 |
static void |
978 |
static void |