[Xfce4-commits] r26382 - in xfcalendar/trunk: . po src
Juha Kautto
juha at xfce.org
Wed Nov 21 00:04:15 CET 2007
Author: juha
Date: 2007-11-20 23:04:15 +0000 (Tue, 20 Nov 2007)
New Revision: 26382
Modified:
xfcalendar/trunk/configure.in.in
xfcalendar/trunk/po/fi.po
xfcalendar/trunk/src/appointment.c
xfcalendar/trunk/src/event-list.c
xfcalendar/trunk/src/functions.c
xfcalendar/trunk/src/functions.h
xfcalendar/trunk/src/ical-code.c
xfcalendar/trunk/src/ical-code.h
xfcalendar/trunk/src/mainbox.c
xfcalendar/trunk/src/mainbox.h
xfcalendar/trunk/src/reminder.c
Log:
Bug 3601: part 2. Add VTODO as bold in the main window
and fix the vtodo implementation overall.
version bumped to 4.5.11.1
Modified: xfcalendar/trunk/configure.in.in
===================================================================
--- xfcalendar/trunk/configure.in.in 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/configure.in.in 2007-11-20 23:04:15 UTC (rev 26382)
@@ -9,7 +9,7 @@
dnl
dnl Version information
-m4_define([orage_version], [4.5.10.3-svn])
+m4_define([orage_version], [4.5.11.1-svn])
m4_define([gtk_minimum_version], [2.6.0])
m4_define([xfce_minimum_version], [4.4.0])
Modified: xfcalendar/trunk/po/fi.po
===================================================================
--- xfcalendar/trunk/po/fi.po 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/po/fi.po 2007-11-20 23:04:15 UTC (rev 26382)
@@ -2865,11 +2865,11 @@
#: ../src/main.c:284
msgid "--version (-v) \t\tshow version of orage\n"
-msgstr "--version (-) \t\tnäytä Oragen versio\n"
+msgstr "--version (-v) \t\tnäytä Oragen versio\n"
#: ../src/main.c:285
msgid "--help (-h) \t\tprint this text\n"
-msgstr "--help (.h) \t\tkirjoita tämä teksti\n"
+msgstr "--help (-h) \t\tkirjoita tämä teksti\n"
#: ../src/main.c:286
msgid "--preferences (-p) \tshow preferences form\n"
Modified: xfcalendar/trunk/src/appointment.c
===================================================================
--- xfcalendar/trunk/src/appointment.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/appointment.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -734,6 +734,9 @@
{
gint result;
+ /* Journal does not have end time so no need to check */
+ if (appt->type == XFICAL_TYPE_JOURNAL)
+ return(TRUE);
if (xfical_compare_times(appt) > 0) {
result = xfce_message_dialog(GTK_WINDOW(apptw->Window),
_("Warning"),
@@ -743,10 +746,10 @@
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL);
- return FALSE;
+ return(FALSE);
}
else {
- return TRUE;
+ return(TRUE);
}
}
@@ -835,17 +838,19 @@
/* duration */
appt->use_duration = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(apptw->Dur_checkbutton));
- appt->duration = gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(apptw->Dur_spin_dd)) * 24*60*60
- + gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(apptw->Dur_spin_hh)) * 60*60
- + gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(apptw->Dur_spin_mm)) * 60;
+ if (appt->allDay)
+ appt->duration = gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(apptw->Dur_spin_dd)) * 24*60*60;
+ else
+ appt->duration = gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(apptw->Dur_spin_dd)) * 24*60*60
+ + gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(apptw->Dur_spin_hh)) * 60*60
+ + gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(apptw->Dur_spin_mm)) * 60;
- /* Check that end time is after start time.
- * Journal does not have end time so no need to check */
- if (appt->type != XFICAL_TYPE_JOURNAL
- && !orage_validate_datetime(apptw, appt))
+ /* Check that end time is after start time. */
+ if (!orage_validate_datetime(apptw, appt))
return(FALSE);
/* completed date and time.
@@ -1325,7 +1330,7 @@
, (gdouble)tm_date.tm_hour);
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(apptw->CompletedTime_spin_mm)
- , (gdouble)tm_date.tm_hour);
+ , (gdouble)tm_date.tm_min);
if (appt->completed_tz_loc) {
gtk_button_set_label(GTK_BUTTON(apptw->CompletedTimezone_button)
, _(appt->completed_tz_loc));
@@ -1801,6 +1806,7 @@
gtk_notebook_append_page(GTK_NOTEBOOK(apptw->Notebook)
, apptw->General_notebook_page, apptw->General_tab_label);
+ /* type */
apptw->Type_label = gtk_label_new(_("Type "));
hbox = gtk_hbox_new(FALSE, 0);
apptw->Type_event_rb = gtk_radio_button_new_with_label(NULL, _("Event"));
@@ -1825,24 +1831,28 @@
, apptw->Type_label, hbox
, row = 0, (GTK_EXPAND | GTK_FILL), (0));
+ /* title */
apptw->Title_label = gtk_label_new(_("Title "));
apptw->Title_entry = gtk_entry_new();
orage_table_add_row(apptw->TableGeneral
, apptw->Title_label, apptw->Title_entry
, ++row, (GTK_EXPAND | GTK_FILL), (0));
+ /* location */
apptw->Location_label = gtk_label_new(_("Location"));
apptw->Location_entry = gtk_entry_new();
orage_table_add_row(apptw->TableGeneral
, apptw->Location_label, apptw->Location_entry
, ++row, (GTK_EXPAND | GTK_FILL), (0));
+ /* All day */
apptw->AllDay_checkbutton =
gtk_check_button_new_with_mnemonic(_("All day event"));
orage_table_add_row(apptw->TableGeneral
, NULL, apptw->AllDay_checkbutton
, ++row, (GTK_EXPAND | GTK_FILL), (0));
+ /* start time */
apptw->Start_label = gtk_label_new(_("Start"));
apptw->StartDate_button = gtk_button_new();
apptw->StartTime_spin_hh = gtk_spin_button_new_with_range(0, 23, 1);
@@ -1861,6 +1871,7 @@
G_CALLBACK(oc_set_height_changed), NULL);
*/
+ /* end time */
apptw->End_label = gtk_label_new(_("End"));
apptw->EndDate_button = gtk_button_new();
apptw->EndTime_spin_hh = gtk_spin_button_new_with_range(0, 23, 1);
@@ -1875,6 +1886,7 @@
, apptw->End_label, apptw->EndTime_hbox
, ++row, (GTK_SHRINK | GTK_FILL), (GTK_SHRINK | GTK_FILL));
+ /* duration */
apptw->Dur_hbox = gtk_hbox_new(FALSE, 0);
apptw->Dur_checkbutton =
gtk_check_button_new_with_mnemonic(_("Duration"));
@@ -1896,6 +1908,7 @@
, NULL, apptw->Dur_hbox
, ++row, (GTK_FILL), (GTK_FILL));
+ /* Availability (only for EVENT) */
apptw->Availability_label = gtk_label_new(_("Availability"));
apptw->Availability_cb = gtk_combo_box_new_text();
combo_box_append_array(apptw->Availability_cb
@@ -1904,6 +1917,7 @@
, apptw->Availability_label, apptw->Availability_cb
, ++row, (GTK_FILL), (GTK_FILL));
+ /* completed (only for TODO) */
apptw->Completed_label = gtk_label_new(_("Completed"));
apptw->Completed_hbox = gtk_hbox_new(FALSE, 0);
apptw->Completed_checkbutton =
@@ -1927,6 +1941,7 @@
, apptw->Completed_label, apptw->Completed_hbox
, ++row, (GTK_FILL), (GTK_FILL));
+ /* note */
apptw->Note = gtk_label_new(_("Note"));
apptw->Note_Scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
event = gtk_event_box_new(); /* only needed for tooltips */
@@ -2382,6 +2397,7 @@
appt_win *create_appt_win(char *action, char *par, el_win *event_list)
{
appt_win *apptw;
+ GdkWindow *window;
/* initialisation + main window + base vbox */
apptw = g_new(appt_win, 1);
@@ -2423,6 +2439,10 @@
recur_hide_show(apptw);
type_hide_show(apptw);
gtk_widget_grab_focus(apptw->Title_entry);
+ window = GTK_WIDGET(apptw->Window)->window;
+ gdk_x11_window_set_user_time(window, gdk_x11_get_server_time(window));
+ gtk_window_present(GTK_WINDOW(apptw->Window));
+
}
else { /* failed to get data */
app_free_memory(apptw);
Modified: xfcalendar/trunk/src/event-list.c
===================================================================
--- xfcalendar/trunk/src/event-list.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/event-list.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -313,7 +313,7 @@
GtkTreeIter iter1;
GtkListStore *list1;
gchar *title = NULL;
- gchar flags[5];
+ gchar flags[6];
gchar *stime;
gchar /* *s_sort,*/ *s_sort1;
gchar source[5];
@@ -348,8 +348,15 @@
flags[3] = appt->uid[0]; /* file type */
- flags[4] = '\0';
+ if (appt->type == XFICAL_TYPE_EVENT)
+ flags[4] = 'E';
+ else if (appt->type == XFICAL_TYPE_TODO)
+ flags[4] = 'T';
+ else
+ flags[4] = 'J';
+ flags[5] = '\0';
+
if (appt->title != NULL)
title = g_strdup(appt->title);
else if (appt->note != NULL) {
@@ -1265,7 +1272,7 @@
gtk_tree_view_append_column(GTK_TREE_VIEW(el->TreeView), col);
gtk_tree_view_column_set_visible(col, FALSE);
- gtk_tooltips_set_tip(el->Tooltips, el->TreeView, _("Double click line to edit it.\n\nFlags in order:\n\t 1. Alarm: n=no alarm\n\t\t A=visual Alarm S=also Sound alarm\n\t 2. Recurrence: n=no recurrence\n\t\t D=Daily W=Weekly M=Monthly Y=Yearly\n\t 3. Type: f=free B=Busy\n\t 4. Located in file: O=Orage\n\t\t A=Archive F=Foreign"), NULL);
+ gtk_tooltips_set_tip(el->Tooltips, el->TreeView, _("Double click line to edit it.\n\nFlags in order:\n\t 1. Alarm: n=no alarm\n\t\t A=visual Alarm S=also Sound alarm\n\t 2. Recurrence: n=no recurrence\n\t\t D=Daily W=Weekly M=Monthly Y=Yearly\n\t 3. Type: f=free B=Busy\n\t 4. Located in file:\n\t\tO=Orage A=Archive F=Foreign\n\t 5. Appointment type:\n\t\tE=Event T=Todo J=Journal"), NULL);
g_signal_connect(el->TreeView, "row-activated",
G_CALLBACK(editEvent), el);
Modified: xfcalendar/trunk/src/functions.c
===================================================================
--- xfcalendar/trunk/src/functions.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/functions.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -46,17 +46,14 @@
gboolean orage_date_button_clicked(GtkWidget *button, GtkWidget *win)
{
- GtkWidget *selDate_Window_dialog;
- GtkWidget *selDate_Calendar_calendar;
+ GtkWidget *selDate_dialog;
+ GtkWidget *selDate_calendar;
gint result;
- char *date_to_display=NULL;
- /*
- struct tm *t;
- */
+ char *new_date=NULL, *cur_date;
struct tm cur_t;
- gboolean changed;
+ gboolean changed, allocated=FALSE;
- selDate_Window_dialog = gtk_dialog_new_with_buttons(
+ selDate_dialog = gtk_dialog_new_with_buttons(
_("Pick the date"), GTK_WINDOW(win),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
_("Today"),
@@ -65,49 +62,42 @@
GTK_RESPONSE_ACCEPT,
NULL);
- selDate_Calendar_calendar = gtk_calendar_new();
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(selDate_Window_dialog)->vbox)
- , selDate_Calendar_calendar);
+ selDate_calendar = gtk_calendar_new();
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(selDate_dialog)->vbox)
+ , selDate_calendar);
- cur_t = orage_i18_date_to_tm_date(gtk_button_get_label(
- GTK_BUTTON(button)));
- orage_select_date(GTK_CALENDAR(selDate_Calendar_calendar)
+ cur_date = (char *)gtk_button_get_label(GTK_BUTTON(button));
+ if (cur_date)
+ cur_t = orage_i18_date_to_tm_date(cur_date);
+ else /* something was wrong. let's return some valid value */
+ cur_t = orage_i18_date_to_tm_date(orage_localdate_i18());
+
+ orage_select_date(GTK_CALENDAR(selDate_calendar)
, cur_t.tm_year+1900, cur_t.tm_mon, cur_t.tm_mday);
- gtk_widget_show_all(selDate_Window_dialog);
+ gtk_widget_show_all(selDate_dialog);
- result = gtk_dialog_run(GTK_DIALOG(selDate_Window_dialog));
+ result = gtk_dialog_run(GTK_DIALOG(selDate_dialog));
switch(result){
case GTK_RESPONSE_ACCEPT:
- /*
- gtk_calendar_get_date(GTK_CALENDAR(selDate_Calendar_calendar)
- , (guint *)&cur_t.tm_year, (guint *)&cur_t.tm_mon
- , (guint *)&cur_t.tm_mday);
- cur_t.tm_year -= 1900;
- date_to_display = orage_tm_date_to_i18_date(&cur_t);
- */
- date_to_display = orage_cal_to_i18_date(
- GTK_CALENDAR(selDate_Calendar_calendar));
+ new_date = orage_cal_to_i18_date(GTK_CALENDAR(selDate_calendar));
break;
case 1:
- /*
- t = orage_localtime();
- date_to_display = orage_tm_date_to_i18_date(t);
- */
- date_to_display = orage_localdate_i18();
+ new_date = orage_localdate_i18();
break;
case GTK_RESPONSE_DELETE_EVENT:
default:
- date_to_display = (gchar *)gtk_button_get_label(
- GTK_BUTTON(button));
+ new_date = g_strdup(cur_date);
+ allocated = TRUE;
break;
}
- if (g_ascii_strcasecmp((gchar *)date_to_display
- , (gchar *)gtk_button_get_label(GTK_BUTTON(button))) != 0)
+ if (g_ascii_strcasecmp(new_date, cur_date) != 0)
changed = TRUE;
else
changed = FALSE;
- gtk_button_set_label(GTK_BUTTON(button), (const gchar *)date_to_display);
- gtk_widget_destroy(selDate_Window_dialog);
+ gtk_button_set_label(GTK_BUTTON(button), (const gchar *)new_date);
+ if (allocated)
+ g_free(new_date);
+ gtk_widget_destroy(selDate_dialog);
return(changed);
}
@@ -152,90 +142,6 @@
return(success);
}
-struct tm orage_i18_date_to_tm_date(const char *i18_date)
-{
- char *ret;
- struct tm tm_date = {0,0,0,0,0,0,0,0,0};
-
- ret = (char *)strptime(i18_date, "%x", &tm_date);
- if (ret == NULL)
- g_error("Orage: orage_i18_date_to_tm_date wrong format (%s)", i18_date);
- else if (ret[0] != '\0')
- g_error("Orage: orage_i18_date_to_tm_date too long format (%s-%s)"
- , i18_date, ret);
- return(tm_date);
-}
-
-char *orage_tm_date_to_i18_date(struct tm *tm_date)
-{
- static char i18_date[32];
-
- if (strftime(i18_date, 32, "%x", tm_date) == 0)
- g_error("Orage: orage_tm_date_to_i18_date too long string in strftime");
- return(i18_date);
-}
-
-char *orage_cal_to_i18_date(GtkCalendar *cal)
-{
- struct tm tm_date = {0,0,0,0,0,0,0,0,0};
-
- gtk_calendar_get_date(cal
- , (unsigned int *)&tm_date.tm_year
- , (unsigned int *)&tm_date.tm_mon
- , (unsigned int *)&tm_date.tm_mday);
- tm_date.tm_year -= 1900;
- return(orage_tm_date_to_i18_date(&tm_date));
-}
-
-struct tm orage_icaltime_to_tm_time(const char *icaltime, gboolean real_tm)
-{
- int i;
- struct tm t = {0,0,0,0,0,0,0,0,0};
-
- i = sscanf(icaltime, XFICAL_APPT_TIME_FORMAT
- , &t.tm_year, &t.tm_mon, &t.tm_mday
- , &t.tm_hour, &t.tm_min, &t.tm_sec);
- switch (i) {
- case 3: /* date */
- t.tm_hour = -1;
- t.tm_min = -1;
- t.tm_sec = -1;
- break;
- case 6: /* time */
- break;
- default: /* error */
- g_error("orage: orage_icaltime_to_tm_time error %s %d", icaltime, i);
- break;
- }
- if (real_tm) { /* normalise to standard tm format */
- t.tm_year -= 1900;
- t.tm_mon -= 1;
- }
- return(t);
-}
-
-char *orage_tm_time_to_icaltime(struct tm *t)
-{
- static char icaltime[XFICAL_APPT_TIME_FORMAT_LEN];
-
- g_sprintf(icaltime, XFICAL_APPT_TIME_FORMAT
- , t->tm_year + 1900, t->tm_mon + 1, t->tm_mday
- , t->tm_hour, t->tm_min, t->tm_sec);
-
- return(icaltime);
-}
-
-char *orage_i18_date_to_icaltime(const char *i18_date)
-{
- struct tm t;
- char *ct;
-
- t = orage_i18_date_to_tm_date(i18_date);
- ct = orage_tm_time_to_icaltime(&t);
- ct[8] = '\0'; /* we know it is date */
- return(ct);
-}
-
void orage_message(const char *format, ...)
{
va_list args;
@@ -343,6 +249,112 @@
return menu_item;
}
+struct tm orage_i18_date_to_tm_date(const char *i18_date)
+{
+ char *ret;
+ struct tm tm_date = {0,0,0,0,0,0,0,0,0};
+
+ ret = (char *)strptime(i18_date, "%x", &tm_date);
+ if (ret == NULL)
+ g_error("Orage: orage_i18_date_to_tm_date wrong format (%s)", i18_date);
+ else if (ret[0] != '\0')
+ g_error("Orage: orage_i18_date_to_tm_date too long format (%s-%s)"
+ , i18_date, ret);
+ return(tm_date);
+}
+
+char *orage_tm_time_to_i18_time(struct tm *tm_time)
+{
+ static char i18_time[40];
+
+ if (strftime(i18_time, 40, "%x %R", tm_time) == 0)
+ g_error("Orage: orage_tm_time_to_i18_time too long string in strftime");
+ return(i18_time);
+}
+
+char *orage_tm_date_to_i18_date(struct tm *tm_date)
+{
+ static char i18_date[32];
+
+ if (strftime(i18_date, 32, "%x", tm_date) == 0)
+ g_error("Orage: orage_tm_date_to_i18_date too long string in strftime");
+ return(i18_date);
+}
+
+char *orage_cal_to_i18_date(GtkCalendar *cal)
+{
+ struct tm tm_date = {0,0,0,0,0,0,0,0,0};
+
+ gtk_calendar_get_date(cal
+ , (unsigned int *)&tm_date.tm_year
+ , (unsigned int *)&tm_date.tm_mon
+ , (unsigned int *)&tm_date.tm_mday);
+ tm_date.tm_year -= 1900;
+ return(orage_tm_date_to_i18_date(&tm_date));
+}
+
+struct tm orage_icaltime_to_tm_time(const char *icaltime, gboolean real_tm)
+{
+ int i;
+ struct tm t = {0,0,0,0,0,0,0,0,0};
+
+ i = sscanf(icaltime, XFICAL_APPT_TIME_FORMAT
+ , &t.tm_year, &t.tm_mon, &t.tm_mday
+ , &t.tm_hour, &t.tm_min, &t.tm_sec);
+ switch (i) {
+ case 3: /* date */
+ t.tm_hour = -1;
+ t.tm_min = -1;
+ t.tm_sec = -1;
+ break;
+ case 6: /* time */
+ break;
+ default: /* error */
+ g_error("orage: orage_icaltime_to_tm_time error %s %d", icaltime, i);
+ break;
+ }
+ if (real_tm) { /* normalise to standard tm format */
+ t.tm_year -= 1900;
+ t.tm_mon -= 1;
+ }
+ return(t);
+}
+
+char *orage_tm_time_to_icaltime(struct tm *t)
+{
+ static char icaltime[XFICAL_APPT_TIME_FORMAT_LEN];
+
+ g_sprintf(icaltime, XFICAL_APPT_TIME_FORMAT
+ , t->tm_year + 1900, t->tm_mon + 1, t->tm_mday
+ , t->tm_hour, t->tm_min, t->tm_sec);
+
+ return(icaltime);
+}
+
+char *orage_icaltime_to_i18_time(const char *icaltime)
+{ /* timezone is not converted */
+ struct tm t;
+ char *ct;
+
+ t = orage_icaltime_to_tm_time(icaltime, TRUE);
+ if (t.tm_hour == -1)
+ ct = orage_tm_date_to_i18_date(&t);
+ else
+ ct = orage_tm_time_to_i18_time(&t);
+ return(ct);
+}
+
+char *orage_i18_date_to_icaltime(const char *i18_date)
+{
+ struct tm t;
+ char *ct;
+
+ t = orage_i18_date_to_tm_date(i18_date);
+ ct = orage_tm_time_to_icaltime(&t);
+ ct[8] = '\0'; /* we know it is date */
+ return(ct);
+}
+
struct tm *orage_localtime()
{
time_t tt;
Modified: xfcalendar/trunk/src/functions.h
===================================================================
--- xfcalendar/trunk/src/functions.h 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/functions.h 2007-11-20 23:04:15 UTC (rev 26382)
@@ -68,12 +68,16 @@
struct tm orage_i18_date_to_tm_date(const char *display);
+char *orage_tm_time_to_i18_time(struct tm *tm_date);
+
char *orage_tm_date_to_i18_date(struct tm *tm_date);
struct tm orage_icaltime_to_tm_time(const char *i18_date, gboolean real_tm);
char *orage_tm_time_to_icaltime(struct tm *t);
+char *orage_icaltime_to_i18_time(const char *icaltime);
+
char *orage_i18_date_to_icaltime(const char *i18_date);
char *orage_cal_to_i18_date(GtkCalendar *cal);
Modified: xfcalendar/trunk/src/ical-code.c
===================================================================
--- xfcalendar/trunk/src/ical-code.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/ical-code.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -944,13 +944,12 @@
per.stime = convert_to_local_timezone(per.stime, p);
}
else {
- g_warning(P_N "start time not found (%s)", icalcomponent_get_uid(c));
per.stime = icaltime_null_time();
}
/* Either endtime/duetime or duration may be there.
* But neither is required.
- * VTODO may also have completed time
+ * VTODO may also have completed time but it does not have dtstart always
*/
per.ikind = icalcomponent_isa(c);
if (per.ikind == ICAL_VEVENT_COMPONENT)
@@ -1143,6 +1142,10 @@
#ifdef ORAGE_DEBUG
g_print(P_N "\n");
#endif
+ if (appt->allDay) { /* cut the string after Date: yyyymmdd */
+ appt->starttime[8] = '\0';
+ appt->endtime[8] = '\0';
+ }
if (appt->use_duration) {
if (! ORAGE_STR_EXISTS(appt->starttime)) {
g_warning(P_N "null start time");
@@ -1173,7 +1176,7 @@
duration = icaltime_subtract(etime, stime);
appt->duration = icaldurationtype_as_int(duration);
- return (icaltime_compare(stime, etime));
+ return(icaltime_compare(stime, etime));
}
else {
g_warning(P_N "null time %s %s"
@@ -1666,8 +1669,11 @@
}
if (appt->type != XFICAL_TYPE_JOURNAL) {
- /* journal has no duration nor enddate or due */
- if (appt->use_duration) { /* both event and todo can have duration */
+ /* journal has no duration nor enddate or due
+ * journal also has no priority or transparent setting
+ * journal also has not alarms or repeat settings */
+ if (appt->use_duration) {
+ /* both event and todo can have duration */
duration = icaldurationtype_from_int(appt->duration);
icalcomponent_add_property(icmp
, icalproperty_new_duration(duration));
@@ -1710,6 +1716,7 @@
, icalproperty_new_due(wtime));
}
}
+
if (appt->priority != 0)
icalcomponent_add_property(icmp
, icalproperty_new_priority(appt->priority));
@@ -3039,7 +3046,7 @@
, gchar *file_type)
{
#undef P_N
-#define P_N "xfical_appt_get_next_on_day: "
+#define P_N "xfical_appt_get_next_on_day_internal: "
struct icaltimetype asdate, aedate /* period to check */
, nsdate, nedate; /* repeating event occurrency start and end */
xfical_period per; /* event start and end times with duration */
@@ -3090,11 +3097,10 @@
, icaltime_as_ical_string(per.ctime));
*/
if (type == XFICAL_TYPE_TODO) {
- if (icaltime_is_null_time(per.ctime))
+ if (icaltime_is_null_time(per.ctime)
+ || local_compare(per.ctime, per.stime) <= 0)
/* VTODO is never completed */
- date_found = TRUE;
- else if (local_compare(per.ctime, per.stime) <= 0)
- /* this is VTODO and it has completed before start, so
+ /* or it has completed before start, so
* this one is not done and needs to be counted */
date_found = TRUE;
}
@@ -3108,25 +3114,12 @@
, ICAL_RRULE_PROPERTY)) != 0) { /* check recurring */
nsdate = icaltime_null_time();
rrule = icalproperty_get_rrule(p);
- /* FIXME:
- * for soem VTODOs you do not want to start over regularly
- * from the starttime, but actually from the latest completed
- * time. This kind of VTODOs do not have startdate! */
- /*
- if (type == XFICAL_TYPE_TODO) {
- if (!icaltime_is_null_time(per.ctime))
- ri = icalrecur_iterator_new(rrule, per.ctime);
- else
- ri = icalrecur_iterator_new(rrule, per.stime);
- }
- else
- */
- ri = icalrecur_iterator_new(rrule, per.stime);
+ ri = icalrecur_iterator_new(rrule, per.stime);
for (nsdate = icalrecur_iterator_next(ri),
nedate = icaltime_add(nsdate, per.duration);
!icaltime_is_null_time(nsdate)
&& ((type == XFICAL_TYPE_TODO
- && local_compare(nsdate, per.ctime) < 0)
+ && local_compare(nsdate, per.ctime) <= 0)
|| (type != XFICAL_TYPE_TODO
&& local_compare_date_only(nedate, asdate) < 0));
nsdate = icalrecur_iterator_next(ri),
@@ -3253,12 +3246,42 @@
}
+static gboolean xfical_mark_calendar_days(GtkCalendar *gtkcal
+ , int cur_year, int cur_month
+ , int s_year, int s_month, int s_day
+ , int e_year, int e_month, int e_day)
+{
+ gint start_day, day_cnt, end_day;
+ gboolean marked = FALSE;
+
+ /*
+ g_print("\t***xfical_mark_calendar_days: marked=%d cur year=%d, cur mon=%d \n\t\tstart year=%d start mon=%d start day=%d end year=%d, end mon=%d, end day=%d\n", marked, cur_year,cur_month, s_year,s_month,s_day, e_year,e_month,e_day);
+ */
+ if ((s_year*12+s_month) <= (cur_year*12+cur_month)
+ && (cur_year*12+cur_month) <= (e_year*12+e_month)) {
+ /* event is in our year+month = visible in calendar */
+ if (s_year == cur_year && s_month == cur_month)
+ start_day = s_day;
+ else
+ start_day = 1;
+ if (e_year == cur_year && e_month == cur_month)
+ end_day = e_day;
+ else
+ end_day = 31;
+ for (day_cnt = start_day; day_cnt <= end_day; day_cnt++) {
+ gtk_calendar_mark_day(gtkcal, day_cnt);
+ marked = TRUE;
+ }
+ }
+ return(marked);
+}
+
/* Mark days with appointments into calendar
* year: Year to be searched
* month: Month to be searched
*/
-void xfical_mark_calendar_internal(GtkCalendar *gtkcal, icalcomponent *base
- , int year, int month)
+static void xfical_mark_calendar_internal(GtkCalendar *gtkcal
+ , icalcomponent *base, int year, int month)
{
#undef P_N
#define P_N "xfical_mark_calendar_internal: "
@@ -3269,32 +3292,21 @@
icalrecur_iterator* ri;
icalproperty *p = NULL;
gint start_day, day_cnt, end_day;
+ gboolean marked;
#ifdef ORAGE_DEBUG
g_print(P_N "\n");
#endif
+ /*
for (c = icalcomponent_get_first_component(base, ICAL_VEVENT_COMPONENT);
c != 0;
c = icalcomponent_get_next_component(base, ICAL_VEVENT_COMPONENT)) {
per = get_period(c);
- if ((per.stime.year*12+per.stime.month) <= (year*12+month)
- && (year*12+month) <= (per.etime.year*12+per.etime.month)) {
- /* event is in our year+month = visible in calendar */
- if (per.stime.year == year && per.stime.month == month)
- start_day = per.stime.day;
- else
- start_day = 1;
- if (per.etime.year == year && per.etime.month == month)
- end_day = per.etime.day;
- else
- end_day = 31;
- for (day_cnt = start_day; day_cnt <= end_day; day_cnt++)
- {
- gtk_calendar_mark_day(gtkcal, day_cnt);
- }
- }
+ xfical_mark_calendar_days(gtkcal, year, month
+ , per.stime.year, per.stime.month, per.stime.day
+ , per.etime.year, per.etime.month, per.etime.day);
if ((p = icalcomponent_get_first_property(c
- , ICAL_RRULE_PROPERTY)) != 0) { /* check recurring EVENTs */
+ , ICAL_RRULE_PROPERTY)) != 0) {
nsdate = icaltime_null_time();
rrule = icalproperty_get_rrule(p);
ri = icalrecur_iterator_new(rrule, per.stime);
@@ -3304,41 +3316,94 @@
&& (nsdate.year*12+nsdate.month) <= (year*12+month);
nsdate = icalrecur_iterator_next(ri),
nedate = icaltime_add(nsdate, per.duration)) {
- if ((nsdate.year*12+nsdate.month) <= (year*12+month)
- && (year*12+month) <= (nedate.year*12+nedate.month)) {
- /* event is in our year+month = visible in calendar */
- if (nsdate.year == year && nsdate.month == month)
- start_day = nsdate.day;
- else
- start_day = 1;
- if (nedate.year == year && nedate.month == month)
- end_day = nedate.day;
- else
- end_day = 31;
- for (day_cnt = start_day; day_cnt <= end_day; day_cnt++)
- {
- gtk_calendar_mark_day(gtkcal, day_cnt);
- }
- }
+ xfical_mark_calendar_days(gtkcal, year, month
+ , nsdate.year, nsdate.month, nsdate.day
+ , nedate.year, nedate.month, nedate.day);
}
icalrecur_iterator_free(ri);
}
}
+ */
+ /* Note that all VEVENTS are marked, but only the first VTODO
+ * end date is marked */
+ for (c = icalcomponent_get_first_component(base, ICAL_ANY_COMPONENT);
+ c != 0;
+ c = icalcomponent_get_next_component(base, ICAL_ANY_COMPONENT)) {
+ per = get_period(c);
+ if (per.ikind == ICAL_VEVENT_COMPONENT && 0 == 1) {
+ xfical_mark_calendar_days(gtkcal, year, month
+ , per.stime.year, per.stime.month, per.stime.day
+ , per.etime.year, per.etime.month, per.etime.day);
+ if ((p = icalcomponent_get_first_property(c
+ , ICAL_RRULE_PROPERTY)) != 0) { /* check recurring EVENTs */
+ nsdate = icaltime_null_time();
+ rrule = icalproperty_get_rrule(p);
+ ri = icalrecur_iterator_new(rrule, per.stime);
+ for (nsdate = icalrecur_iterator_next(ri),
+ nedate = icaltime_add(nsdate, per.duration);
+ !icaltime_is_null_time(nsdate)
+ && (nsdate.year*12+nsdate.month) <= (year*12+month);
+ nsdate = icalrecur_iterator_next(ri),
+ nedate = icaltime_add(nsdate, per.duration)) {
+ xfical_mark_calendar_days(gtkcal, year, month
+ , nsdate.year, nsdate.month, nsdate.day
+ , nedate.year, nedate.month, nedate.day);
+ }
+ icalrecur_iterator_free(ri);
+ }
+ } /* ICAL_VEVENT_COMPONENT */
+ else if (per.ikind == ICAL_VTODO_COMPONENT) {
+ marked = FALSE;
+ if (icaltime_is_null_time(per.ctime)
+ || (local_compare(per.ctime, per.stime) <= 0)) {
+ /* VTODO needs to be checked either if it never completed
+ * or it has completed before start */
+ marked = xfical_mark_calendar_days(gtkcal, year, month
+ , per.etime.year, per.etime.month, per.etime.day
+ , per.etime.year, per.etime.month, per.etime.day);
+ }
+ if (!marked && (p = icalcomponent_get_first_property(c
+ , ICAL_RRULE_PROPERTY)) != 0) {
+ /* check recurring TODOs */
+ nsdate = icaltime_null_time();
+ rrule = icalproperty_get_rrule(p);
+ ri = icalrecur_iterator_new(rrule, per.stime);
+ for (nsdate = icalrecur_iterator_next(ri),
+ nedate = icaltime_add(nsdate, per.duration);
+ !icaltime_is_null_time(nsdate)
+ && (nsdate.year*12+nsdate.month) <= (year*12+month)
+ && (local_compare(nsdate, per.ctime) < 0);
+ nsdate = icalrecur_iterator_next(ri),
+ nedate = icaltime_add(nsdate, per.duration)) {
+ /* find the active one like in
+ * xfical_appt_get_next_on_day_internal */
+ }
+ icalrecur_iterator_free(ri);
+ if (!icaltime_is_null_time(nsdate)) {
+ marked = xfical_mark_calendar_days(gtkcal, year, month
+ , nedate.year, nedate.month, nedate.day
+ , nedate.year, nedate.month, nedate.day);
+ }
+ }
+ } /* ICAL_VTODO_COMPONENT */
+ }
}
-void xfical_mark_calendar(GtkCalendar *gtkcal, int year, int month)
+void xfical_mark_calendar(GtkCalendar *gtkcal)
{
#undef P_N
#define P_N "xfical_mark_calendar: "
gint i;
+ guint year, month, day;
#ifdef ORAGE_DEBUG
g_print(P_N "\n");
#endif
+ gtk_calendar_get_date(gtkcal, &year, &month, &day);
gtk_calendar_clear_marks(gtkcal);
- xfical_mark_calendar_internal(gtkcal, ical, year, month);
+ xfical_mark_calendar_internal(gtkcal, ical, year, month+1);
for (i = 0; i < g_par.foreign_count; i++) {
- xfical_mark_calendar_internal(gtkcal, f_ical[i].ical, year, month);
+ xfical_mark_calendar_internal(gtkcal, f_ical[i].ical, year, month+1);
}
}
@@ -3591,7 +3656,7 @@
if (per.ikind == ICAL_VTODO_COMPONENT
&& ((per.ctime.year*12 + per.ctime.month)
< (per.stime.year*12 + per.stime.month))) {
- /* VTODO not com,pleted, do not archive */
+ /* VTODO not completed, do not archive */
orage_message(_("\tVTODO not complete; not archived"));
}
else {
Modified: xfcalendar/trunk/src/ical-code.h
===================================================================
--- xfcalendar/trunk/src/ical-code.h 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/ical-code.h 2007-11-20 23:04:15 UTC (rev 26382)
@@ -134,7 +134,7 @@
xfical_appt *xfical_appt_get_next_with_string(char *str, gboolean first
, gchar *file_type);
-void xfical_mark_calendar(GtkCalendar *gtkcal, int year, int month);
+void xfical_mark_calendar(GtkCalendar *gtkcal);
void xfical_alarm_build_list(gboolean first_list_today);
gboolean xfical_alarm_passed(char *alarm_stime);
Modified: xfcalendar/trunk/src/mainbox.c
===================================================================
--- xfcalendar/trunk/src/mainbox.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/mainbox.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -51,14 +51,9 @@
gboolean orage_mark_appointments()
{
- guint year, month, day;
-
if (!xfical_file_open(TRUE))
return(FALSE);
- gtk_calendar_get_date(GTK_CALENDAR(g_par.xfcal->mCalendar)
- , &year, &month, &day);
- xfical_mark_calendar(GTK_CALENDAR(g_par.xfcal->mCalendar)
- , year, month+1);
+ xfical_mark_calendar(GTK_CALENDAR(g_par.xfcal->mCalendar));
xfical_file_close(TRUE);
return(TRUE);
}
@@ -301,15 +296,38 @@
GtkWidget *ev, *label;
CalWin *cal = g_par.xfcal;
gchar *tip;
+ struct tm *t;
+ char *l_time, *s_time, *e_time, *c_time, *na;
+ gint len;
+
ev = gtk_event_box_new();
label = gtk_label_new(appt->title);
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
+ t = orage_localtime();
+ l_time = orage_tm_time_to_icaltime(t);
+ if (appt->starttimecur[8] == 'T') /* date+time */
+ len = 15;
+ else /* date only */
+ len = 8;
+ if (strncmp(appt->endtimecur, l_time, len) < 0) /* gone */
+ gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &cal->mRed);
+ else if (strncmp(appt->starttimecur, l_time, len) <= 0
+ && strncmp(appt->endtimecur, l_time, len) >= 0)
+ gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &cal->mBlue);
gtk_container_add(GTK_CONTAINER(ev), label);
gtk_box_pack_start(GTK_BOX(cal->mInfo_vbox), ev, FALSE, FALSE, 0);
- tip = g_strdup_printf("%s\n%s-%s\n%s", appt->title, appt->starttimecur
- , appt->endtimecur ,appt->note);
+ na = _("Not defined");
+ s_time = g_strdup(orage_icaltime_to_i18_time(appt->starttimecur));
+ e_time = g_strdup(orage_icaltime_to_i18_time(appt->endtimecur));
+ c_time = g_strdup(appt->completed
+ ? orage_icaltime_to_i18_time(appt->completedtime) : na);
+ tip = g_strdup_printf(_("Title: %s\n Start:\t%s\n Due:\t%s\n Done:\t%s\nNote:\n%s")
+ , appt->title, s_time, e_time, c_time, appt->note);
gtk_tooltips_set_tip(cal->Tooltips, ev, tip, NULL);
+ g_free(s_time);
+ g_free(e_time);
+ g_free(c_time);
g_free(tip);
g_object_set_data_full(G_OBJECT(ev), "UID", g_strdup(appt->uid), g_free);
g_signal_connect((gpointer)ev, "button-press-event"
@@ -317,7 +335,8 @@
}
-static void info_rows(char *a_day, xfical_type ical_type, gchar *file_type)
+static void insert_rows(GList **todo_list, char *a_day, xfical_type ical_type
+ , gchar *file_type)
{
xfical_appt *appt;
@@ -326,11 +345,29 @@
appt;
appt = xfical_appt_get_next_on_day(a_day, FALSE, 0
, ical_type , file_type)) {
- add_info_row(appt);
- xfical_appt_free(appt);
+ *todo_list = g_list_append(*todo_list, appt);
}
}
+static gint todo_order(gconstpointer a, gconstpointer b)
+{
+ xfical_appt *appt1, *appt2;
+
+ appt1 = (xfical_appt *)a;
+ appt2 = (xfical_appt *)b;
+
+ return(strcmp(appt1->starttimecur, appt2->starttimecur));
+}
+
+static void todo_process(gpointer a, gpointer dummy)
+{
+ xfical_appt *appt;
+
+ appt = (xfical_appt *)a;
+ add_info_row(appt);
+ xfical_appt_free(appt);
+}
+
void build_mainbox_info(void)
{
CalWin *cal = g_par.xfcal;
@@ -340,8 +377,8 @@
xfical_type ical_type;
gchar file_type[8];
gint i;
+ GList *todo_list=NULL;
-
gtk_widget_destroy(cal->mInfo_scrolledWin);
cal->mInfo_scrolledWin = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(cal->mInfo_scrolledWin)
@@ -362,13 +399,19 @@
if (!xfical_file_open(TRUE))
return;
strcpy(file_type, "O00.");
- info_rows(a_day, ical_type, file_type);
+ insert_rows(&todo_list, a_day, ical_type, file_type);
/* then process all foreign files */
for (i = 0; i < g_par.foreign_count; i++) {
g_sprintf(file_type, "F%02d.", i);
- info_rows(a_day, ical_type, file_type);
+ insert_rows(&todo_list, a_day, ical_type, file_type);
}
xfical_file_close(TRUE);
+ if (todo_list) {
+ todo_list = g_list_sort(todo_list, todo_order);
+ g_list_foreach(todo_list, (GFunc)todo_process, NULL);
+ g_list_free(todo_list);
+ todo_list = NULL;
+ }
gtk_widget_show_all(cal->mInfo_scrolledWin);
}
@@ -377,7 +420,14 @@
{
GdkPixbuf *orage_logo;
CalWin *cal = g_par.xfcal;
+ GdkColormap *pic1_cmap;
+ pic1_cmap = gdk_colormap_get_system();
+ gdk_color_parse("red", &cal->mRed);
+ gdk_colormap_alloc_color(pic1_cmap, &cal->mRed, FALSE, TRUE);
+ gdk_color_parse("blue", &cal->mBlue);
+ gdk_colormap_alloc_color(pic1_cmap, &cal->mBlue, FALSE, TRUE);
+
/* using static icon here since this dynamic icon is not updated
* when date changes. Could be added, but not worth it.
* Dynamic icon is used in systray and about windows */
Modified: xfcalendar/trunk/src/mainbox.h
===================================================================
--- xfcalendar/trunk/src/mainbox.h 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/mainbox.h 2007-11-20 23:04:15 UTC (rev 26382)
@@ -52,6 +52,8 @@
GtkWidget *mInfo_scrolledWin;
GtkWidget *mInfo_vbox;
+
+ GdkColor mRed, mBlue;
} CalWin;
void build_mainWin();
Modified: xfcalendar/trunk/src/reminder.c
===================================================================
--- xfcalendar/trunk/src/reminder.c 2007-11-19 14:44:28 UTC (rev 26381)
+++ xfcalendar/trunk/src/reminder.c 2007-11-20 23:04:15 UTC (rev 26382)
@@ -114,6 +114,7 @@
create_notify_reminder(alarm);
}
#endif
+ alarm->audio = FALSE;
alarm_free_memory(alarm);
status = FALSE; /* no more alarms, end timeouts */
}
@@ -150,7 +151,16 @@
{
alarm_struct *alarm = (alarm_struct *)par;
+ /* This causes core if notify is the last alarm, because libnotify
+ * closes the notification and hence raises notify_closed, which
+ * frees the memory. If we want to keep notification visible, we
+ * need to handle this somehow. For example let notify_closed know
+ * that there will be new notification and memory must not be freed.
+ * Or by allocating memory here again, which must not be done if there
+ * are more alarms active. Fro now just remove the line and let notify
+ * window go away like libnotify wants.
create_notify_reminder(alarm);
+ */
create_appt_win("UPDATE", alarm->uid->str, NULL);
}
More information about the Xfce4-commits
mailing list