[Xfce4-commits] <orage:master> 4.8.1.11 Fixed Bug 7920 - Alarm Procedure unreliable

Juha Kautto noreply at xfce.org
Tue Aug 30 14:22:02 CEST 2011


Updating branch refs/heads/master
         to 39df98ebb5ff0fe891b5b7d5e6385e1cc088f85d (commit)
       from 09df53e97f41c22a1652b2a4367b899432c4d5d0 (commit)

commit 39df98ebb5ff0fe891b5b7d5e6385e1cc088f85d
Author: Juha Kautto <juha at xfce.org>
Date:   Tue Aug 30 15:19:59 2011 +0300

    4.8.1.11 Fixed Bug 7920 - Alarm Procedure unreliable
    
    Fixed bug 7920, which basically was error in handling the space in between
    procedure type alarm cmd and parameters. When using new os libical, it
    removes spaces and Orage now adds the needed one space back. When using local
    libical, Orage added one space too much, which is also fixed now.

 configure.in.in   |    2 +-
 src/appointment.c |   27 +++++++++++++++++----------
 src/ical-code.c   |   15 +++++----------
 src/mainbox.c     |    6 +++---
 src/reminder.c    |    5 +++--
 5 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 3a24b99..54c3f8c 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.8.1.10-git])
+m4_define([orage_version], [4.8.1.11-git])
 
 m4_define([gtk_minimum_version], [2.10.0])
 m4_define([xfce_minimum_version], [4.6.0])
diff --git a/src/appointment.c b/src/appointment.c
index b043827..f886362 100644
--- a/src/appointment.c
+++ b/src/appointment.c
@@ -753,7 +753,7 @@ static gboolean orage_validate_datetime(appt_win *apptw, xfical_appt *appt)
 
 static void fill_appt_from_apptw_alarm(xfical_appt *appt, appt_win *apptw)
 {
-    gint i, j, k;
+    gint i, j, k, l;
     gchar *tmp;
 
     /* reminder time */
@@ -858,16 +858,23 @@ static void fill_appt_from_apptw_alarm(xfical_appt *appt, appt_win *apptw)
         appt->procedure_params = NULL;
     }
     tmp = (char *)gtk_entry_get_text(GTK_ENTRY(apptw->Proc_entry));
-    j = strlen(tmp);
-    for (i = 0; i < j && g_ascii_isspace(tmp[i]); i++)
-        ; /* skip blanks */
-    for (k = i; k < j && !g_ascii_isspace(tmp[k]); k++)
+    l = strlen(tmp);
+    for (i = 0; i < l && g_ascii_isspace(tmp[i]); i++)
+        ; /* skip blanks from cmd */
+    for (j = i; j < l && !g_ascii_isspace(tmp[j]); j++)
         ; /* find first blank after the cmd */
-        /* now i points to start of cmd and k points to end of cmd */
-    if (k-i)
-        appt->procedure_cmd = g_strndup(tmp+i, k-i);
-    if (j-k)
-        appt->procedure_params = g_strndup(tmp+k, j-k);
+        /* now i points to start of cmd and j points to end of cmd */
+    for (k = j; k < l && g_ascii_isspace(tmp[k]); k++)
+        ; /* skip blanks from parameters */
+        /* now k points to start of params and l points to end of params */
+    if (j-i)
+        appt->procedure_cmd = g_strndup(tmp+i, j-i);
+    if (l-k)
+        appt->procedure_params = g_strndup(tmp+k, l-k);
+    /*
+    g_print("parameter reading: tmp=(%s) cmd=(%s) params=(%s) i=%d j=%d k=%d l=%d\n",
+            tmp, appt->procedure_cmd, appt->procedure_params, i, j, k, l);
+    */
 }
 
 /*
diff --git a/src/ical-code.c b/src/ical-code.c
index ffaf956..f3eff06 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -2890,8 +2890,10 @@ static void process_alarm_data(icalcomponent *ca, alarm_struct *new_alarm)
         new_alarm->display_notify = appt->display_alarm_notify;
         new_alarm->notify_timeout = appt->display_notify_timeout;
         /* FIXME: use real alarm data */
+        /* 
         if (ORAGE_STR_EXISTS(appt->note))
             new_alarm->description = orage_process_text_commands(appt->note);
+            */
     }
     else if (appt->sound_alarm) {
         new_alarm->audio = appt->sound_alarm;
@@ -2905,14 +2907,8 @@ static void process_alarm_data(icalcomponent *ca, alarm_struct *new_alarm)
     else if(appt->procedure_alarm) {
         new_alarm->procedure = appt->procedure_alarm;
         if (ORAGE_STR_EXISTS(appt->procedure_cmd)) {
-            new_alarm->cmd = g_strconcat(appt->procedure_cmd
+            new_alarm->cmd = g_strconcat(appt->procedure_cmd, " "
                     , appt->procedure_params, NULL);
-            /*
-            if (ORAGE_STR_EXISTS(appt->procedure_params)) {
-                new_alarm->cmd = 
-                        g_string_append(new_alarm->cmd, appt->procedure_params);
-            }
-            */
         }
     }
 
@@ -3037,6 +3033,8 @@ static void xfical_alarm_build_list_internal_real(gboolean first_list_today
                     new_alarm->uid = g_strconcat(file_type, suid, NULL);
                     new_alarm->title = orage_process_text_commands(
                             (char *)icalcomponent_get_summary(c));
+                    new_alarm->description = orage_process_text_commands(
+                            (char *)icalcomponent_get_description(c));
                 }
             }
             if (trg_processed) {
@@ -3051,9 +3049,6 @@ static void xfical_alarm_build_list_internal_real(gboolean first_list_today
             }
         }  /* ALARM */
         if (trg_active) {
-            if (!new_alarm->description)
-                new_alarm->description = orage_process_text_commands(
-                        (char *)icalcomponent_get_description(c));
             alarm_add(new_alarm);
 /*
 	    orage_message(60, "new alarm: alarm:%s action:%s title:%s\n"
diff --git a/src/mainbox.c b/src/mainbox.c
index f445789..774994c 100644
--- a/src/mainbox.c
+++ b/src/mainbox.c
@@ -399,12 +399,12 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
                     appt->starttimecur));
         today = orage_tm_time_to_icaltime(orage_localtime());
         if (!strncmp(today, appt->starttimecur, 8)) /* today */
-            tmp = g_strdup_printf(" %s* %s", s_timeonly, appt->title);
+            tmp = g_strdup_printf(" %s* %s", s_timeonly, tmp_title);
         else {
             if (g_par.show_event_days > 1)
-                tmp = g_strdup_printf(" %s  %s", s_time, appt->title);
+                tmp = g_strdup_printf(" %s  %s", s_time, tmp_title);
             else
-                tmp = g_strdup_printf(" %s  %s", s_timeonly, appt->title);
+                tmp = g_strdup_printf(" %s  %s", s_timeonly, tmp_title);
         }
         g_free(s_timeonly);
     }
diff --git a/src/reminder.c b/src/reminder.c
index 3486772..c376c90 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -136,7 +136,7 @@ void alarm_list_free(void)
          alarm_l != NULL; 
          alarm_l = g_list_first(g_par.alarm_list)) {
         l_alarm = alarm_l->data;
-        if (l_alarm->temporary && (strcmp(time_now, l_alarm->alarm_time) < 0)) { 
+        if (l_alarm->temporary && (strcmp(time_now, l_alarm->alarm_time) < 0)) {
             /* We keep temporary alarms, which have not yet fired.
                Remove the element from the list, but do not loose it. */
             g_par.alarm_list = g_list_remove_link(g_par.alarm_list, alarm_l);
@@ -446,8 +446,9 @@ static gboolean sound_alarm(gpointer data)
         status = orage_exec(l_alarm->sound_cmd
                 , &l_alarm->active_alarm->sound_active, &error);
         if (!status) {
-            g_warning("reminder: play failed (%s)", l_alarm->sound);
+            g_warning("reminder: play failed (%s) %s", l_alarm->sound, error->message);
             l_alarm->repeat_cnt = 0; /* one warning is enough */
+            status = TRUE; /* we need to come back once to do cleanout */
         }
         else if (l_alarm->repeat_cnt > 0)
             l_alarm->repeat_cnt--;


More information about the Xfce4-commits mailing list