[Xfce4-commits] <orage:master> 4.7.5.12 Added time to main calendar event box

Juha Kautto noreply at xfce.org
Fri Feb 5 16:26:02 CET 2010


Updating branch refs/heads/master
         to f9f1a081fcfac17e4db7f4d78160baa6162e8ea8 (commit)
       from 37068a9f22eb7eef1375795032ec33d6dda75f6e (commit)

commit f9f1a081fcfac17e4db7f4d78160baa6162e8ea8
Author: Juha Kautto <juha at xfce.org>
Date:   Fri Feb 5 17:22:10 2010 +0200

    4.7.5.12 Added time to main calendar event box
    
    Created enhancement BUG 6180: Show time in info box. (* shows current day.)
    Thanks to patch from Andre Bogus.

 configure.in.in |    2 +-
 src/functions.c |   11 +++++++++++
 src/functions.h |    1 +
 src/mainbox.c   |   16 ++++++++++++++--
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 3595f1d..62fbde9 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.5.11-git])
+m4_define([orage_version], [4.7.5.12-git])
 
 m4_define([gtk_minimum_version], [2.10.0])
 m4_define([xfce_minimum_version], [4.6.0])
diff --git a/src/functions.c b/src/functions.c
index 37c286c..fd6a720 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -583,6 +583,17 @@ char *orage_icaltime_to_i18_time(const char *icaltime)
     return(ct);
 }
 
+char *orage_icaltime_to_i18_time_short(const char *icaltime)
+{
+    struct tm t;
+    static char i18_time[10];
+
+    t = orage_icaltime_to_tm_time(icaltime, TRUE);
+    if (strftime(i18_time, 10, "%R", &t) == 0)
+        g_error("Orage: orage_icaltime_to_i18_time_short too long string in strftime");
+    return(i18_time);
+}
+
 char *orage_i18_time_to_icaltime(const char *i18_time)
 {
     struct tm t;
diff --git a/src/functions.h b/src/functions.h
index b0c7d3a..01261d6 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -93,6 +93,7 @@ char *orage_tm_date_to_i18_date(struct tm *tm_date);
 char *orage_tm_time_to_icaltime(struct tm *t);
 struct tm orage_icaltime_to_tm_time(const char *i18_date, gboolean real_tm);
 char *orage_icaltime_to_i18_time(const char *icaltime);
+char *orage_icaltime_to_i18_time_short(const char *icaltime);
 struct tm orage_cal_to_tm_time(GtkCalendar *cal, gint hh, gint mm);
 char *orage_cal_to_i18_time(GtkCalendar *cal, gint hh, gint mm);
 char *orage_cal_to_i18_date(GtkCalendar *cal);
diff --git a/src/mainbox.c b/src/mainbox.c
index eff306b..fc25b68 100644
--- a/src/mainbox.c
+++ b/src/mainbox.c
@@ -356,7 +356,7 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
     CalWin *cal = (CalWin *)g_par.xfcal;
     gchar *tip, *tmp, *tmp_title, *tmp_note;
     struct tm *t;
-    char      *l_time, *s_time, *e_time, *c_time, *na;
+    char  *l_time, *s_time, *s_timeonly, *e_time, *c_time, *na, *today;
     gint  len;
 
 #ifdef ORAGE_DEBUG
@@ -365,7 +365,19 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
     /***** add data into the vbox *****/
     ev = gtk_event_box_new();
     tmp_title = orage_process_text_commands(appt->title);
-    tmp = g_strdup_printf("  %s", tmp_title);
+    if (appt->allDay || todo) {
+        tmp = g_strdup_printf("  %s", tmp_title);
+    }
+    else {
+        s_timeonly = g_strdup(orage_icaltime_to_i18_time_short(
+                    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);
+        else
+            tmp = g_strdup_printf(" %s  %s", s_timeonly, appt->title);
+        g_free(s_timeonly);
+    }
     label = gtk_label_new(tmp);
     g_free(tmp);
     gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);



More information about the Xfce4-commits mailing list