[Xfce4-commits] <orage:master> 4.7.4.10 minor ehancements 5867 (default date) and 5849 (birthday year)

Juha Kautto noreply at xfce.org
Sat Oct 17 13:50:01 CEST 2009


Updating branch refs/heads/master
         to 62cede2cd77d26f09f88da8c62fb351e85a8570c (commit)
       from a23aef8bed6c320bf9ebaaae68a74ce3ae7e27ac (commit)

commit 62cede2cd77d26f09f88da8c62fb351e85a8570c
Author: Juha Kautto <juha at xfce.org>
Date:   Sat Oct 17 14:41:46 2009 +0300

    4.7.4.10 minor ehancements 5867 (default date) and 5849 (birthday year)
    
    BUG 5867 enhancement: new appointment started from main calendar window
    defaults to selected date.
    
    Bug 5849 enhancement: added <&Ynnnn> parameter as year difference between
    current year and nnnn. This is usefull with birthdays.

 NEWS              |   13 ++++++-
 configure.in.in   |    2 +-
 src/appointment.c |    4 +-
 src/day-view.c    |   31 ++++++++--------
 src/event-list.c  |   23 +++++++-----
 src/functions.c   |   99 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 src/functions.h   |   10 +++--
 src/ical-code.c   |    6 ++--
 src/mainbox.c     |   39 ++++++++++++--------
 src/reminder.c    |    8 +++-
 10 files changed, 176 insertions(+), 59 deletions(-)

diff --git a/NEWS b/NEWS
index 5591a0a..07c5181 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+20091017: Minor enhancements
+---------
+        * New parameter to define how many days are shown in the main
+          calendar eventbox (Bug 5848).
+        * New parameter to define default extra days in event list window
+          (Bug 5847).
+        * New appointment started from main calendar window now defaults 
+          to selected date (Bug 5867).
+        * Possibility to use <&Ynnnn> parameter as year difference between 
+          current year and nnnn. This is usefull with birthdays (Bug 5849).
+
 20091002: Globaltime and panel plugin updates
 ---------
         * Change timezone selection to be exactly the same than in Orage
@@ -8,7 +19,7 @@
             - Page Up and Page Down can be used to tune only 1 minute.
             - Removed message informing time change mode is starting.
         * Timezone extra information now shows correct time change time
-            - wel, it is 1 sec off, but close enough...
+            - well, it is 1 sec off, but close enough...
         * Timezone extra information now shows also next time and how it changes
 
 20090906: Version 4.7.4 
diff --git a/configure.in.in b/configure.in.in
index 21cf47e..b717e14 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.4.9-test])
+m4_define([orage_version], [4.7.4.10-test])
 
 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 fe1d3c6..f4ecdeb 100644
--- a/src/appointment.c
+++ b/src/appointment.c
@@ -1360,7 +1360,7 @@ static xfical_exception *new_exception(char *text)
     }
     else {
         strcpy(recur_exception->type, "EXDATE");
-        strcpy(recur_exception->time, orage_i18_date_to_icaltime(text));
+        strcpy(recur_exception->time, orage_i18_date_to_icaldate(text));
     }
     text[i-2] = ' ';
     return(recur_exception);
@@ -2730,7 +2730,7 @@ static void build_general_page(appt_win *apptw)
             , ++row, (GTK_EXPAND | GTK_FILL), (GTK_EXPAND | GTK_FILL));
 
     gtk_tooltips_set_tip(apptw->Tooltips, event
-            , _("<D> inserts current date in local date format.\n<T> inserts time and\n<DT> inserts date and time."), NULL);
+            , _("These shorthand commands take effect immediately:\n    <D> inserts current date in local date format\n    <T> inserts time and\n    <DT> inserts date and time.\n\nThese are converted only later when they are seen:\n    <&Ynnnn> is translated to current year minus nnnn.\n(This can be used for example in birthday reminders to tell how old the person will be.)"), NULL);
 
     /* Take care of the title entry to build the appointment window title */
     g_signal_connect((gpointer)apptw->Title_entry, "changed"
diff --git a/src/day-view.c b/src/day-view.c
index f05c1cd..ff282ba 100644
--- a/src/day-view.c
+++ b/src/day-view.c
@@ -169,7 +169,7 @@ static void create_new_appointment(day_win *dw)
     char *s_date, a_day[10];
 
     s_date = (char *)gtk_button_get_label(GTK_BUTTON(dw->StartDate_button));
-    strcpy(a_day, orage_i18_date_to_icaltime(s_date));
+    strcpy(a_day, orage_i18_date_to_icaldate(s_date));
 
     do_appt_win("NEW", a_day, dw);
 }
@@ -427,7 +427,7 @@ static void add_row(day_win *dw, xfical_appt *appt)
     gint row, start_row, end_row;
     gint col, start_col, end_col, first_col, last_col;
     gint height, start_height, end_height;
-    gchar *text, *tip, *start_date, *end_date;
+    gchar *tip, *start_date, *end_date, *tmp_title, *tmp_note;
     GtkWidget *ev, *lab, *hb;
     struct tm tm_start, tm_end, tm_first;
     GdkColor *color;
@@ -449,9 +449,11 @@ static void add_row(day_win *dw, xfical_appt *appt)
     }
 
     /* then add the appointment */
-    text = g_strdup(appt->title ? appt->title : _("Unknown"));
+    tmp_title = orage_process_text_commands(
+            appt->title ? appt->title : _("Unknown"));
+    tmp_note = orage_process_text_commands(appt->note);
     ev = gtk_event_box_new();
-    lab = gtk_label_new(text);
+    lab = gtk_label_new(tmp_title);
     gtk_container_add(GTK_CONTAINER(ev), lab);
 
     if (appt->starttimecur[8] != 'T') { /* whole day event */
@@ -467,8 +469,7 @@ static void add_row(day_win *dw, xfical_appt *appt)
              */
         }
         tip = g_strdup_printf("%s\n%s - %s\n%s"
-                , appt->title, appt->starttimecur, appt->endtimecur
-                , appt->note);
+                , tmp_title, appt->starttimecur, appt->endtimecur, tmp_note);
     }
     else {
         if ((color = orage_category_list_contains(appt->categories)) != NULL)
@@ -487,8 +488,8 @@ static void add_row(day_win *dw, xfical_appt *appt)
         }
         if (orage_days_between(&tm_start, &tm_end) == 0)
             tip = g_strdup_printf("%s\n%02d:%02d-%02d:%02d\n%s"
-                    , appt->title, tm_start.tm_hour, tm_start.tm_min
-                    , tm_end.tm_hour, tm_end.tm_min, appt->note);
+                    , tmp_title, tm_start.tm_hour, tm_start.tm_min
+                    , tm_end.tm_hour, tm_end.tm_min, tmp_note);
         else {
     /* we took the date in unnormalized format, so we need to do that now */
             tm_start.tm_year -= 1900;
@@ -498,10 +499,9 @@ static void add_row(day_win *dw, xfical_appt *appt)
             start_date = g_strdup(orage_tm_date_to_i18_date(&tm_start));
             end_date = g_strdup(orage_tm_date_to_i18_date(&tm_end));
             tip = g_strdup_printf("%s\n%s %02d:%02d - %s %02d:%02d\n%s"
-                    , appt->title
+                    , tmp_title
                     , start_date, tm_start.tm_hour, tm_start.tm_min
-                    , end_date, tm_end.tm_hour, tm_end.tm_min
-                    , appt->note);
+                    , end_date, tm_end.tm_hour, tm_end.tm_min, tmp_note);
             g_free(start_date);
             g_free(end_date);
         }
@@ -516,7 +516,8 @@ static void add_row(day_win *dw, xfical_appt *appt)
     g_signal_connect((gpointer)ev, "button-press-event"
             , G_CALLBACK(on_button_press_event_cb), dw);
     g_free(tip);
-    g_free(text);
+    g_free(tmp_title);
+    g_free(tmp_note);
 
     /* and finally draw the line to show how long the appointment is,
      * but only if it is Busy type event (=availability != 0) 
@@ -581,12 +582,12 @@ static void app_rows(day_win *dw, xfical_type ical_type, gchar *file_type)
 static void app_data(day_win *dw)
 {
     xfical_type ical_type;
-    gchar file_type[8];
+    gchar *s_date, file_type[8];
     gint i;
 
     ical_type = XFICAL_TYPE_EVENT;
-    strcpy(dw->a_day, orage_i18_date_to_icaltime(gtk_button_get_label(
-            GTK_BUTTON(dw->StartDate_button))));
+    s_date = (char *)gtk_button_get_label(GTK_BUTTON(dw->StartDate_button));
+    strcpy(dw->a_day, orage_i18_date_to_icaldate(s_date));
     dw->days = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dw->day_spin));
 
     /* first search base orage file */
diff --git a/src/event-list.c b/src/event-list.c
index 6cb5b15..0a91b4f 100644
--- a/src/event-list.c
+++ b/src/event-list.c
@@ -365,10 +365,11 @@ static void add_el_row(el_win *el, xfical_appt *appt, char *par)
 {
     GtkTreeIter     iter1;
     GtkListStore   *list1;
-    gchar          *title = NULL;
+    gchar          *title = NULL, *tmp;
     gchar           flags[6]; 
     gchar          *stime;
     gchar          /* *s_sort,*/ *s_sort1;
+    gchar          *tmp_note;
     gint            len = 50;
 
     stime = format_time(el, appt, par);
@@ -410,15 +411,17 @@ static void add_el_row(el_win *el, xfical_appt *appt, char *par)
     flags[5] = '\0';
 
     if (appt->title != NULL)
-        title = g_strdup(appt->title);
+        title = orage_process_text_commands(appt->title);
     else if (appt->note != NULL) { 
     /* let's take len chars of the first line from the text */
-        if ((title = g_strstr_len(appt->note, strlen(appt->note), "\n")) 
-            != NULL) {
-            if ((strlen(appt->note)-strlen(title)) < len)
-                len = strlen(appt->note)-strlen(title);
+        tmp_note = orage_process_text_commands(appt->note);
+        if ((tmp = g_strstr_len(tmp_note, strlen(tmp_note), "\n")) != NULL) {
+            /* there is line change. take text only up to that */
+            if ((strlen(tmp_note)-strlen(tmp)) < len)
+                len = strlen(tmp_note)-strlen(tmp);
         }
-        title = g_strndup(appt->note, len);
+        title = g_strndup(tmp_note, len);
+        g_free(tmp_note);
     }
 
     s_sort1 = g_strconcat(appt->starttimecur, appt->endtimecur, NULL);
@@ -623,10 +626,10 @@ static void todo_data(el_win *el)
 
 static void journal_data(el_win *el)
 {
-    char      a_day[9];  /* yyyymmdd */
+    char     a_day[9];  /* yyyymmdd */
 
     el->days = 10*365; /* long enough time to get everything from future */
-    strcpy(a_day, orage_i18_date_to_icaltime(gtk_button_get_label(
+    strcpy(a_day, orage_i18_date_to_icaldate(gtk_button_get_label(
             GTK_BUTTON(el->journal_start_button))));
 
     app_data(el, a_day, NULL);
@@ -877,7 +880,7 @@ static void create_new_appointment(el_win *el)
     char *title, a_day[10];
 
     title = (char *)gtk_window_get_title(GTK_WINDOW(el->Window));
-    strcpy(a_day, orage_i18_date_to_icaltime(title));
+    strcpy(a_day, orage_i18_date_to_icaldate(title));
     do_appt_win("NEW", a_day, el);
 }
 
diff --git a/src/functions.c b/src/functions.c
index 5d3b8df..e227748 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -308,6 +308,84 @@ GtkWidget *orage_menu_item_new_with_mnemonic(const gchar *label
     return menu_item;
 }
 
+/* this will change <&Xnnn> type commands to numbers or text as defined.
+ * Currently the only command is 
+ * <&Ynnnn> which calculates years between current year and nnnn */
+char *orage_process_text_commands(char *text)
+{
+#undef P_N
+#define P_N "process_text_commands: "
+    /* these point to the original string and travel it until no more commands 
+     * are found:
+     * cur points to the current head
+     * cmd points to the start of new command
+     * end points to the end of new command */
+    char *cur, *end, *cmd;
+    /* these point to the new string, which has commands in processed form:
+     * new is the new fragment to be added
+     * beq is the total new string. */
+    char *new=NULL, *beq=NULL;
+    char *tmp; /* temporary pointer to handle freeing */
+    int start_year = -1, year_diff, res;
+    struct tm *cur_time;
+
+    /**** RULE <&Ynnnn> difference of the nnnn year and current year *****/
+    /* This is usefull in birthdays for example: I will be <&Y1980>
+     * translates to "I will be 29" if the alarm is raised on 2009 */
+    for (cur = text; cur && (cmd = strstr(cur, "<&Y")); cur = end) {
+        if (end = strstr(cmd, ">")) {
+            end[0] = '\0'; /* temporarily. */
+            res = sscanf(cmd, "<&Y%d", &start_year);
+            end[0] = '>'; /* put it back. */
+            if (res == 1 && start_year > 0) { /* we assume success */
+                cur_time = orage_localtime();
+                year_diff = cur_time->tm_year + 1900 - start_year;
+                if (year_diff > 0) { /* sane value */
+                    end++; /* next char after > */
+                    cmd[0] = '\0'; /* temporarily. (this ends cur) */
+                    new = g_strdup_printf("%s%d", cur, year_diff);
+                    cmd[0] = '<'; /* put it back */
+                    if (beq) { /* this is normal round after first */
+                        tmp = beq;
+                        beq = g_strdup_printf("%s%s", tmp, new);
+                        g_free(tmp);
+                    }
+                    else { /* first round, we do not have beq yet */
+                        beq = g_strdup(new);
+                    }
+                    g_free(new);
+                }
+                else
+                    orage_message(150, P_N "start year is too big (%d)."
+                            , start_year);
+            }
+            else
+                orage_message(150, P_N "failed to understand parameter (%s)."
+                        , cmd);
+        }
+        else
+            orage_message(150, P_N "parameter (%s) misses ending >.", cmd);
+    }
+
+    if (beq) {
+        /* we found and processed at least one command, 
+         * add the remaining fragment and return it */
+        tmp = beq;
+        beq = g_strdup_printf("%s%s", tmp, cur);
+        g_free(tmp);
+    }
+    else {
+        /* we did not find any commands,
+         * so just return duplicate of the original string */
+        beq = g_strdup(text);
+    }
+    return(beq);
+}
+
+/*******************************************************
+ * time convert and manipulation functions
+ *******************************************************/
+
 struct tm orage_i18_time_to_tm_time(const char *i18_time)
 {
     char *ret;
@@ -392,6 +470,17 @@ char *orage_cal_to_i18_date(GtkCalendar *cal)
     return(orage_tm_date_to_i18_date(&tm_date));
 }
 
+char *orage_cal_to_icaldate(GtkCalendar *cal)
+{
+    struct tm tm_date = {0,0,0,0,0,0,0,0,-1};
+    char *icalt;
+
+    tm_date = orage_cal_to_tm_time(cal, 1, 1);
+    icalt = orage_tm_time_to_icaltime(&tm_date);
+    icalt[8] = '\0'; /* we know it is date */
+    return(icalt);
+}
+
 struct tm orage_icaltime_to_tm_time(const char *icaltime, gboolean real_tm)
 {
     struct tm t = {0,0,0,0,0,0,0,0,0};
@@ -459,15 +548,15 @@ char *orage_i18_time_to_icaltime(const char *i18_time)
     return(ct);
 }
 
-char *orage_i18_date_to_icaltime(const char *i18_date)
+char *orage_i18_date_to_icaldate(const char *i18_date)
 {
     struct tm t;
-    char      *ct;
+    char      *icalt;
 
     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);
+    icalt = orage_tm_time_to_icaltime(&t);
+    icalt[8] = '\0'; /* we know it is date */
+    return(icalt);
 }
 
 struct tm *orage_localtime()
diff --git a/src/functions.h b/src/functions.h
index 685b00d..99dc19f 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -74,21 +74,23 @@ GtkWidget *orage_image_menu_item_new_from_stock(const gchar *stock_id
 GtkWidget *orage_separator_menu_item_new(GtkWidget *menu);
 GtkWidget *orage_menu_item_new_with_mnemonic(const gchar *label
         , GtkWidget *menu);
+char *orage_process_text_commands(char *text);
 
 struct tm *orage_localtime();
+char *orage_localdate_i18();
 struct tm orage_i18_time_to_tm_time(const char *i18_time);
 struct tm orage_i18_date_to_tm_date(const char *i18_date);
+char *orage_i18_time_to_icaltime(const char *i18_time);
+char *orage_i18_date_to_icaldate(const char *i18_date);
 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);
+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_i18_time_to_icaltime(const char *i18_time);
-char *orage_i18_date_to_icaltime(const char *i18_date);
 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);
-char *orage_localdate_i18();
+char *orage_cal_to_icaldate(GtkCalendar *cal);
 void orage_move_day(struct tm *t, int day);
 gint orage_days_between(struct tm *t1, struct tm *t2);
 
diff --git a/src/ical-code.c b/src/ical-code.c
index ff30e67..31fd0ca 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -2762,7 +2762,7 @@ 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;
         if (ORAGE_STR_EXISTS(appt->note))
-            new_alarm->description = g_strdup(appt->note);
+            new_alarm->description = orage_process_text_commands(appt->note);
     }
     else if (appt->sound_alarm) {
         new_alarm->audio = appt->sound_alarm;
@@ -2906,7 +2906,7 @@ static void xfical_alarm_build_list_internal_real(gboolean first_list_today
                     trg_active = TRUE;
                     suid = (char *)icalcomponent_get_uid(c);
                     new_alarm->uid = g_strconcat(file_type, suid, NULL);
-                    new_alarm->title = g_strdup(
+                    new_alarm->title = orage_process_text_commands(
                             (char *)icalcomponent_get_summary(c));
                 }
             }
@@ -2923,7 +2923,7 @@ static void xfical_alarm_build_list_internal_real(gboolean first_list_today
         }  /* ALARM */
         if (trg_active) {
             if (!new_alarm->description)
-                new_alarm->description = g_strdup(
+                new_alarm->description = orage_process_text_commands(
                         (char *)icalcomponent_get_description(c));
             g_par.alarm_list = g_list_prepend(g_par.alarm_list, new_alarm);
             cnt_alarm_add++;
diff --git a/src/mainbox.c b/src/mainbox.c
index 412a28d..d1039b0 100644
--- a/src/mainbox.c
+++ b/src/mainbox.c
@@ -74,16 +74,15 @@ static void mFile_newApp_activate_cb(GtkMenuItem *menuitem, gpointer user_data)
 {
 #undef P_N
 #define P_N "mFile_newApp_activate_cb: "
-    struct tm *t;
+    CalWin *cal = (CalWin *)user_data;
     char cur_date[9];
 
 #ifdef ORAGE_DEBUG
     orage_message(-100, P_N);
 #endif
-    t = orage_localtime();
-    g_snprintf(cur_date, 9, "%04d%02d%02d", t->tm_year+1900
-            , t->tm_mon+1, t->tm_mday);
-    create_appt_win("NEW", cur_date);  
+    /* cal has always a day selected here, so it is safe to read it */
+    strcpy(cur_date, orage_cal_to_icaldate(GTK_CALENDAR(cal->mCalendar)));
+    create_appt_win("NEW", cur_date);
 }
 
 static void mFile_interface_activate_cb(GtkMenuItem *menuitem
@@ -353,7 +352,7 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
 #define P_N "add_info_row: "
     GtkWidget *ev, *label;
     CalWin *cal = (CalWin *)g_par.xfcal;
-    gchar *tip, *tmp;
+    gchar *tip, *tmp, *tmp_title, *tmp_note;
     struct tm *t;
     char      *l_time, *s_time, *e_time, *c_time, *na;
     gint  len;
@@ -363,7 +362,8 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
 #endif
     /***** add data into the vbox *****/
     ev = gtk_event_box_new();
-    tmp = g_strdup_printf("  %s", appt->title);
+    tmp_title = orage_process_text_commands(appt->title);
+    tmp = g_strdup_printf("  %s", tmp_title);
     label = gtk_label_new(tmp);
     g_free(tmp);
     gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
@@ -396,6 +396,7 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
     }
 
     /***** set hint *****/
+    tmp_note = orage_process_text_commands(appt->note);
     s_time = g_strdup(orage_icaltime_to_i18_time(appt->starttimecur));
     if (todo) {
         na = _("Never");
@@ -404,15 +405,17 @@ static void add_info_row(xfical_appt *appt, GtkBox *parentBox, gboolean todo)
         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);
+                , tmp_title, s_time, e_time, c_time, tmp_note);
         g_free(c_time);
     }
     else { /* it is event */
         e_time = g_strdup(orage_icaltime_to_i18_time(appt->endtimecur));
         tip = g_strdup_printf(_("Title: %s\n Start:\t%s\n End:\t%s\n Note:\n%s")
-                , appt->title, s_time, e_time, appt->note);
+                , tmp_title, s_time, e_time, tmp_note);
     }
     gtk_tooltips_set_tip(cal->Tooltips, ev, tip, NULL);
+    g_free(tmp_title);
+    g_free(tmp_note);
     g_free(s_time);
     g_free(e_time);
     g_free(tip);
@@ -505,7 +508,7 @@ static void create_mainbox_event_info_box(void)
 #undef P_N
 #define P_N "create_mainbox_event_info_box: "
     CalWin *cal = (CalWin *)g_par.xfcal;
-    gchar *tmp;
+    gchar *tmp, *tmp2, *tmp3;
     struct tm tm_date_start, tm_date_end;
 
 #ifdef ORAGE_DEBUG
@@ -516,15 +519,19 @@ static void create_mainbox_event_info_box(void)
     cal->mEvent_vbox = gtk_vbox_new(FALSE, 0);
     gtk_box_pack_start(GTK_BOX(cal->mVbox), cal->mEvent_vbox, FALSE, FALSE, 0);
     cal->mEvent_label = gtk_label_new(NULL);
-    if (g_par.show_event_days == 1) 
-        tmp = g_strdup_printf(_("<b>Events for %s:</b>")
-                , orage_tm_date_to_i18_date(&tm_date_start));
+    if (g_par.show_event_days == 1) {
+        tmp2 = g_strdup(orage_tm_date_to_i18_date(&tm_date_start));
+        tmp = g_strdup_printf(_("<b>Events for %s:</b>"), tmp2);
+        g_free(tmp2);
+    }
     else {
         tm_date_end = tm_date_start;
         orage_move_day(&tm_date_end, g_par.show_event_days-1);
-        tmp = g_strdup_printf(_("<b>Events for %s - %s:</b>")
-                , orage_tm_date_to_i18_date(&tm_date_start)
-                , orage_tm_date_to_i18_date(&tm_date_end));
+        tmp2 = g_strdup(orage_tm_date_to_i18_date(&tm_date_start));
+        tmp3 = g_strdup(orage_tm_date_to_i18_date(&tm_date_end));
+        tmp = g_strdup_printf(_("<b>Events for %s - %s:</b>"), tmp2, tmp3);
+        g_free(tmp2);
+        g_free(tmp3);
     }
     gtk_label_set_markup(GTK_LABEL(cal->mEvent_label), tmp);
     g_free(tmp);
diff --git a/src/reminder.c b/src/reminder.c
index f265968..0688cce 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -131,7 +131,7 @@ static OrageRc *orage_persistent_file_open(gboolean read_only)
     if (!read_only)  /* we need to empty it before each write */
         g_remove(fpath);
     if ((orc = (OrageRc *)orage_rc_file_open(fpath, read_only)) == NULL) {
-        orage_message(150, "orage_persistent_file_open: persistent alarms file open failed.");
+        orage_message(150, P_N "persistent alarms file open failed.");
     }
     g_free(fpath);
 
@@ -521,6 +521,7 @@ static void create_orage_reminder(alarm_struct *alarm)
     GtkWidget *btOkReminder;
     GtkWidget *swReminder;
     GtkWidget *hdReminder;
+    gchar *tmp;
 
 #ifdef ORAGE_DEBUG
     orage_message(-100, P_N);
@@ -535,8 +536,11 @@ static void create_orage_reminder(alarm_struct *alarm)
 
     vbReminder = GTK_DIALOG(wReminder)->vbox;
 
-    hdReminder = gtk_label_new(alarm->title);
+    hdReminder = gtk_label_new(NULL);
     gtk_label_set_selectable(GTK_LABEL(hdReminder), TRUE);
+    tmp = g_markup_printf_escaped("<b>%s</b>", alarm->title);
+    gtk_label_set_markup(GTK_LABEL(hdReminder), tmp);
+    g_free(tmp);
     gtk_box_pack_start(GTK_BOX(vbReminder), hdReminder, FALSE, TRUE, 0);
 
     swReminder = gtk_scrolled_window_new(NULL, NULL);



More information about the Xfce4-commits mailing list