[Xfce4-commits] <orage:master> 4.7.6.5 enhancement 6845 alarms don't show the date and time of an event
Juha Kautto
noreply at xfce.org
Mon Dec 13 18:44:01 CET 2010
Updating branch refs/heads/master
to ee027a9fc352c1fb439bc01102044b921ec23ed1 (commit)
from 855a62f2777ffcbce51525f272f8c10ed8a142c5 (commit)
commit ee027a9fc352c1fb439bc01102044b921ec23ed1
Author: Juha Kautto <juha at xfce.org>
Date: Mon Dec 13 19:40:27 2010 +0200
4.7.6.5 enhancement 6845 alarms don't show the date and time of an event
Added event/todo start and end time to the header of the Orage alarm window.
It is also in the notify alarm window.
configure.in.in | 2 +-
src/ical-code.c | 21 +++++++++++++++++++--
src/reminder.c | 21 ++++++++++++++++++++-
src/reminder.h | 1 +
4 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index 3179c68..98d9ea4 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.7.6.4-git])
+m4_define([orage_version], [4.7.6.5-git])
m4_define([gtk_minimum_version], [2.10.0])
m4_define([xfce_minimum_version], [4.6.0])
diff --git a/src/ical-code.c b/src/ical-code.c
index f9c8275..e59e394 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -2568,11 +2568,13 @@ alarm_struct *process_alarm_trigger(icalcomponent *c
struct icalrecurrencetype rrule;
icalrecur_iterator* ri;
xfical_period per;
- struct icaltimetype next_alarm_time, next_start_time, rdate_alarm_time;
+ struct icaltimetype next_alarm_time, next_start_time, next_end_time,
+ rdate_alarm_time;
gboolean trg_active = FALSE;
alarm_struct *new_alarm;
struct icaldurationtype alarm_start_diff;
struct icaldatetimeperiodtype rdate_period;
+ gchar *tmp1, *tmp2;
/* pvl_elem property_iterator; */ /* for saving the iterator */
#ifdef ORAGE_DEBUG
@@ -2648,7 +2650,7 @@ alarm_struct *process_alarm_trigger(icalcomponent *c
/* alarm_start_diff goes from alarm to start, so we need to revert it
* 1) here (temporarily) since rdate is start time and we need to get the
- * alarm time. We do not use it after this so we can leave it wrong. */
+ * alarm time. */
if (alarm_start_diff.is_neg)
alarm_start_diff.is_neg = 0;
else
@@ -2717,6 +2719,21 @@ alarm_struct *process_alarm_trigger(icalcomponent *c
new_alarm = g_new0(alarm_struct, 1);
next_alarm_time = icaltime_convert_to_zone(next_alarm_time, local_icaltimezone);
new_alarm->alarm_time = g_strdup(icaltime_as_ical_string(next_alarm_time));
+ /* convert the diff back */
+ if (alarm_start_diff.is_neg)
+ alarm_start_diff.is_neg = 0;
+ else
+ alarm_start_diff.is_neg = 1;
+
+ next_start_time = icaltime_add(next_alarm_time, alarm_start_diff);
+ next_end_time = icaltime_add(next_start_time, per.duration);
+ tmp1 = g_strdup(orage_icaltime_to_i18_time(
+ icaltime_as_ical_string(next_start_time)));
+ tmp2 = g_strdup(orage_icaltime_to_i18_time(
+ icaltime_as_ical_string(next_end_time)));
+ new_alarm->action_time = g_strconcat(tmp1, " - ", tmp2, NULL);
+ g_free(tmp1);
+ g_free(tmp2);
return(new_alarm);
}
else {
diff --git a/src/reminder.c b/src/reminder.c
index 71946d9..9ba7bf3 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -83,6 +83,7 @@ static void alarm_free(gpointer galarm)
orage_message(-100, P_N);
#endif
g_free(alarm->alarm_time);
+ g_free(alarm->action_time);
g_free(alarm->uid);
g_free(alarm->title);
g_free(alarm->description);
@@ -196,6 +197,8 @@ static alarm_struct *alarm_copy(alarm_struct *alarm, gboolean init)
/* first alarm values which are not modified */
if (alarm->alarm_time != NULL)
n_alarm->alarm_time = g_strdup(alarm->alarm_time);
+ if (alarm->action_time != NULL)
+ n_alarm->action_time = g_strdup(alarm->action_time);
if (alarm->uid != NULL)
n_alarm->uid = g_strdup(alarm->uid);
if (alarm->title != NULL)
@@ -280,6 +283,7 @@ static alarm_struct *alarm_read_next_alarm(OrageRc *orc, gchar *time_now)
new_alarm->uid = orage_rc_get_group(orc);
new_alarm->alarm_time = orage_rc_get_str(orc, "ALARM_TIME", "0000");
+ new_alarm->action_time = orage_rc_get_str(orc, "ACTION_TIME", "0000");
new_alarm->title = orage_rc_get_str(orc, "TITLE", NULL);
new_alarm->description = orage_rc_get_str(orc, "DESCRIPTION", NULL);
new_alarm->persistent = TRUE; /* this must be */
@@ -358,6 +362,7 @@ static void alarm_store(gpointer galarm, gpointer par)
orage_rc_set_group(par, alarm->uid);
orage_rc_put_str(orc, "ALARM_TIME", alarm->alarm_time);
+ orage_rc_put_str(orc, "ACTION_TIME", alarm->action_time);
orage_rc_put_str(orc, "TITLE", alarm->title);
orage_rc_put_str(orc, "DESCRIPTION", alarm->description);
orage_rc_put_bool(orc, "DISPLAY_ORAGE", alarm->display_orage);
@@ -545,9 +550,14 @@ static void create_notify_reminder(alarm_struct *alarm)
return;
}
- strncpy(heading, _("Reminder "), 199);
+ strncpy(heading, _("Reminder "), 99);
if (alarm->title)
g_strlcat(heading, alarm->title, 50);
+ if (alarm->action_time) {
+ g_strlcat(heading, "\n<b>", 10);
+ g_strlcat(heading, alarm->action_time, 90);
+ g_strlcat(heading, "<\b>", 10);
+ }
n = notify_notification_new(heading, alarm->description, NULL, NULL);
alarm->active_alarm->active_notify = n;
if (g_par.trayIcon
@@ -681,6 +691,7 @@ static void create_orage_reminder(alarm_struct *alarm)
GtkWidget *btRecreateReminder;
GtkWidget *swReminder;
GtkWidget *hdReminder;
+ GtkWidget *hdtReminder;
orage_ddmmhh_hbox_struct *ddmmhh_hbox;
GtkWidget *e_hbox;
#if !GTK_CHECK_VERSION(2,16,0)
@@ -709,6 +720,13 @@ static void create_orage_reminder(alarm_struct *alarm)
g_free(tmp);
gtk_box_pack_start(GTK_BOX(vbReminder), hdReminder, FALSE, TRUE, 0);
+ hdtReminder = gtk_label_new(NULL);
+ gtk_label_set_selectable(GTK_LABEL(hdtReminder), TRUE);
+ tmp = g_markup_printf_escaped("<i>%s</i>", alarm->action_time);
+ gtk_label_set_markup(GTK_LABEL(hdtReminder), tmp);
+ g_free(tmp);
+ gtk_box_pack_start(GTK_BOX(vbReminder), hdtReminder, FALSE, TRUE, 0);
+
swReminder = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swReminder)
, GTK_SHADOW_NONE);
@@ -722,6 +740,7 @@ static void create_orage_reminder(alarm_struct *alarm)
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swReminder)
, lbReminder);
+ /* TIME AREA */
ddmmhh_hbox = (orage_ddmmhh_hbox_struct *)alarm->orage_display_data;
ddmmhh_hbox->spin_dd = gtk_spin_button_new_with_range(0, 100, 1);
ddmmhh_hbox->spin_dd_label = gtk_label_new(_("days"));
diff --git a/src/reminder.h b/src/reminder.h
index 5c30a57..67b83cd 100644
--- a/src/reminder.h
+++ b/src/reminder.h
@@ -36,6 +36,7 @@ typedef struct _active_alarm_struct
typedef struct _alarm_struct
{
gchar *alarm_time;
+ gchar *action_time; /* alarm is based on this time */
gchar *uid;
gchar *title;
gchar *description;
More information about the Xfce4-commits
mailing list