Author: juha
Date: 2007-12-30 00:44:35 +0000 (Sun, 30 Dec 2007)
New Revision: 26517
Modified:
xfcalendar/trunk/src/appointment.c
xfcalendar/trunk/src/event-list.c
xfcalendar/trunk/src/ical-code.c
Log:
1) Fix time initialization with new appointments.
2) Use upper case only search in event list when possible
Modified: xfcalendar/trunk/src/appointment.c
===================================================================
--- xfcalendar/trunk/src/appointment.c 2007-12-29 01:32:03 UTC (rev 26516)
+++ xfcalendar/trunk/src/appointment.c 2007-12-30 00:44:35 UTC (rev 26517)
@@ -1346,7 +1346,7 @@
else
appt->start_tz_loc = g_strdup("floating");
appt->end_tz_loc = g_strdup(appt->start_tz_loc);
- appt->duration = 30;
+ appt->duration = 30*60;
g_sprintf(appt->completedtime,"%sT%02d%02d00"
, today, t->tm_hour, t->tm_min);
appt->completed_tz_loc = g_strdup(appt->start_tz_loc);
Modified: xfcalendar/trunk/src/event-list.c
===================================================================
--- xfcalendar/trunk/src/event-list.c 2007-12-29 01:32:03 UTC (rev 26516)
+++ xfcalendar/trunk/src/event-list.c 2007-12-30 00:44:35 UTC (rev 26517)
@@ -408,7 +408,8 @@
gchar *search_string = NULL, file_type[8];
gint i;
- search_string = g_strdup(gtk_entry_get_text((GtkEntry *)el->search_entry));
+ search_string = g_utf8_strup(gtk_entry_get_text(
+ (GtkEntry *)el->search_entry),-1);
/* first search base orage file */
if (!xfical_file_open(TRUE))
return;
Modified: xfcalendar/trunk/src/ical-code.c
===================================================================
--- xfcalendar/trunk/src/ical-code.c 2007-12-29 01:32:03 UTC (rev 26516)
+++ xfcalendar/trunk/src/ical-code.c 2007-12-30 00:44:35 UTC (rev 26517)
@@ -4163,9 +4163,10 @@
{
#undef P_N
#define P_N "xfical_appt_get_next_with_string_internal: "
- static gchar *text, *beg, *end;
+ static gchar *text_upper, *text, *beg, *end;
+ static upper_text;
gchar *cur, *tmp, mem;
- gsize text_len;
+ gsize text_len, len;
char *uid, ical_uid[XFICAL_UID_LEN+1];
xfical_appt *appt;
gboolean found_valid, search_done = FALSE;
@@ -4180,16 +4181,33 @@
if (first) {
/* FIXME: it would be good idea to convert to upper case.
* then we should not need to care about case and search would
- * be more user friendly
+ * be more user friendly.
+ * Note: This is not easy since UID must not be converted upper case
+ * or it will not be found.
*/
if (!g_file_get_contents(search_file, &text, &text_len, NULL)) {
g_warning(P_N "Could not open Orage ical file (%s)", search_file);
return(NULL);
}
+ text_upper = g_utf8_strup(text, -1);
+ if (text_len == strlen(text_upper)) {
+ /* we can do upper case search since uppercase and original
+ * string have same format. In other words we can find UID since
+ * it starts in the same place in both strings (not 100 % sure,
+ * but works reliable enough until somebody files a bug...) */
+ end = text_upper+text_len;
+ beg = find_next(text_upper, end, "\nBEGIN:");
+ upper_text = TRUE;
+ }
+ else { /* sorry, has to settle for normal comparison */
/* let's find first BEGIN:VEVENT or BEGIN:VTODO or BEGIN:VJOURNAL
* to start our search */
- end = text+text_len;
- beg = find_next(text, end, "\nBEGIN:");
+ end = text+text_len;
+ beg = find_next(text, end, "\nBEGIN:");
+ upper_text = FALSE;
+ g_warning(P_N "Can not do case independent comparison (%d/%d)"
+ , text_len, strlen(text_upper));
+ }
if (!beg) {
g_warning(P_N "Could not find initial BEGIN:V-type from Orage ical
file (%s)"
, search_file);
@@ -4248,7 +4266,15 @@
search_done = TRUE;
}
else {
- sscanf(uid, "UID:%sXFICAL_UID_LEN", ical_uid);
+ if (upper_text) {
+ /* we need to take UID from the original text, which
+ * has not been converted to upper case */
+ len = uid-text_upper;
+ tmp = text+len;
+ sscanf(tmp, "UID:%sXFICAL_UID_LEN", ical_uid);
+ }
+ else
+ sscanf(uid, "UID:%sXFICAL_UID_LEN", ical_uid);
if (strlen(ical_uid) > XFICAL_UID_LEN-2) {
g_warning(P_N "too long UID %s", ical_uid);
return(NULL);
@@ -4292,6 +4318,7 @@
}
g_free(text);
+ g_free(text_upper);
if (!search_done) {
g_warning(P_N "illegal ending %s", str);
}
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits