[Xfce4-commits] <orage:master> 4.9.10.2 Improvements to bugs 9250 and 9507

Juha Kautto noreply at xfce.org
Fri Nov 22 11:32:02 CET 2013


Updating branch refs/heads/master
         to f5d0d8ee8c7ab2c9ec7ee4c7347fbfbb669f0443 (commit)
       from 419881c48ab799322940ebc6866ea598f9f38165 (commit)

commit f5d0d8ee8c7ab2c9ec7ee4c7347fbfbb669f0443
Author: Juha Kautto <juha at xfce.org>
Date:   Fri Nov 22 12:27:39 2013 +0200

    4.9.10.2 Improvements to bugs 9250 and 9507
    
    Fixed problem with excluded dates. Changed the way list of old event
    selection works. Hopefully clearer now.

 configure.in.in           |    2 +-
 src/event-list.c          |   37 +++++++++++++++--------
 src/ical-code.c           |   72 ++++++++++++++++++++++++---------------------
 src/parameters.c          |   29 ++++++++++++++++--
 src/parameters.h          |    1 +
 src/parameters_internal.h |    1 +
 6 files changed, 93 insertions(+), 49 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 148fe19..faedad3 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.9.10.0-git])
+m4_define([orage_version], [4.9.10.2-git])
 
 m4_define([gtk_minimum_version], [2.14.0])
 m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/event-list.c b/src/event-list.c
index ad497d1..986240f 100644
--- a/src/event-list.c
+++ b/src/event-list.c
@@ -599,13 +599,15 @@ static void event_data(el_win *el)
     if (el->days == 0)
         refresh_time_field(el);
     el->days = gtk_spin_button_get_value(GTK_SPIN_BUTTON(el->event_spin));
+    /*
     el->only_first = gtk_toggle_button_get_active(
             GTK_TOGGLE_BUTTON(el->event_only_first_checkbutton));
+            */
     el->show_old = gtk_toggle_button_get_active(
             GTK_TOGGLE_BUTTON(el->event_show_old_checkbutton));
     title = (char *)gtk_window_get_title(GTK_WINDOW(el->Window));
     t_title = orage_i18_date_to_tm_date(title); 
-    if (el->show_old) {
+    if (el->show_old && el->only_first) {
         /* just take any old enough date, so that all events fit in */
         strncpy(a_day, "19000101", 8); 
         /* we need to adjust also number of days shown */
@@ -924,12 +926,17 @@ static void on_spin_changed(GtkSpinButton *b, gpointer user_data)
     refresh_el_win((el_win *)user_data);
 }
 
-static void on_only_first_changed(GtkCheckButton *b, gpointer user_data)
+static void on_only_first_clicked(GtkCheckButton *b, gpointer user_data)
 {
+    el_win *el = (el_win *)user_data;
+
+    el->only_first = gtk_toggle_button_get_active(
+            GTK_TOGGLE_BUTTON(el->event_only_first_checkbutton));
+    gtk_widget_set_sensitive(el->event_show_old_checkbutton, el->only_first);
     refresh_el_win((el_win *)user_data);
 }
 
-static void on_show_old_changed(GtkCheckButton *b, gpointer user_data)
+static void on_show_old_clicked(GtkCheckButton *b, gpointer user_data)
 {
     refresh_el_win((el_win *)user_data);
 }
@@ -1209,25 +1216,31 @@ static void build_event_tab(el_win *el)
        do this. Using hboxes takes actually more memory */
     el->event_notebook_page = orage_table_new(1, BORDER_SIZE);
 
-    label = gtk_label_new(_("Extra days to show "));
+    label = gtk_label_new(_("Extra days to show:"));
 
     el->event_spin = gtk_spin_button_new_with_range(0, 99999, 1);
     gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(el->event_spin), TRUE);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(el->event_spin)
             , (gdouble)el->days);
-    gtk_box_pack_start(GTK_BOX(hbox), el->event_spin, FALSE, FALSE, 15);
+    gtk_box_pack_start(GTK_BOX(hbox), el->event_spin, FALSE, FALSE, 2);
 
     el->event_only_first_checkbutton =
-            gtk_check_button_new_with_label(_("only first"));
+            gtk_check_button_new_with_label(_("only first repeating"));
+    gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(el->event_only_first_checkbutton)
+                    , el->only_first);
     gtk_widget_set_tooltip_text(el->event_only_first_checkbutton
-            , _("Check this if you only want to see the first repeating event. By default all are shown.\nNote that this also shows all urgencies."));
+            , _("Check this if you only want to see the first repeating event. By default all are shown.\nNote that this also shows all urgencies.\nNote that repeating events may appear earlier in the list as the first occurrence only is listed."));
     gtk_box_pack_start(GTK_BOX(hbox), el->event_only_first_checkbutton
             , FALSE, FALSE, 15);
 
     el->event_show_old_checkbutton =
             gtk_check_button_new_with_label(_("also old"));
     gtk_widget_set_tooltip_text(el->event_show_old_checkbutton
-            , _("Check this if you want to see old events also. You should set the 'only first' also or the list will be very long.\nNote that repeating events may appear earlier if you select 'only first'."));
+            , _("Check this if you want to see old events also. This can only be selected after 'only first repeating' is enabled to avoid very long lists.\nNote that extra days selection still defines if newer appointments are listed'."));
+    gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(el->event_show_old_checkbutton), el->only_first);
+    gtk_widget_set_sensitive(el->event_show_old_checkbutton, el->only_first);
     gtk_box_pack_start(GTK_BOX(hbox), el->event_show_old_checkbutton
             , FALSE, FALSE, 15);
 
@@ -1239,9 +1252,9 @@ static void build_event_tab(el_win *el)
     g_signal_connect((gpointer)el->event_spin, "value-changed"
             , G_CALLBACK(on_spin_changed), el);
     g_signal_connect((gpointer)el->event_only_first_checkbutton, "clicked"
-            , G_CALLBACK(on_only_first_changed), el);
+            , G_CALLBACK(on_only_first_clicked), el);
     g_signal_connect((gpointer)el->event_show_old_checkbutton, "clicked"
-            , G_CALLBACK(on_show_old_changed), el);
+            , G_CALLBACK(on_show_old_clicked), el);
 }
 
 static void build_todo_tab(el_win *el)
@@ -1398,9 +1411,9 @@ el_win *create_el_win(char *start_date)
     /* initialisation + main window + base vbox */
     el = g_new(el_win, 1);
     el->today = FALSE;
-    el->only_first = FALSE;
-    el->show_old = FALSE;
     el->days = g_par.el_days;
+    el->only_first = g_par.el_only_first;
+    el->show_old = el->only_first;
     el->time_now[0] = 0;
     el->apptw_list = NULL;
     el->accel_group = gtk_accel_group_new();
diff --git a/src/ical-code.c b/src/ical-code.c
index 20ca979..575b1d2 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -3495,10 +3495,10 @@ static void mark_calendar(icalcomponent *c, icaltime_span *span , void *data)
     edate = icaltime_from_string(orage_tm_time_to_icaltime(&end_tm));
     edate = convert_to_zone(edate, cal_data->appt.end_tz_loc);
     edate = icaltime_convert_to_zone(edate, local_icaltimezone);
+    /*
     g_print(P_N "sdate(day, mon, year):%d %d %d edate:%d %d %d\n"
              , sdate.day , sdate.month , sdate.year
              , edate.day , edate.month , edate.year);
-    /*
              */
     xfical_mark_calendar_days(cal_data->cal, cal_data->year, cal_data->month
             , sdate.year, sdate.month, sdate.day
@@ -3529,6 +3529,7 @@ static void xfical_mark_calendar_from_component(GtkCalendar *gtkcal
         guint month;
         xfical_appt appt;
     } cal_data;
+    struct icaltimetype start;
 
 #ifdef ORAGE_DEBUG
     orage_message(-200, P_N);
@@ -3551,43 +3552,48 @@ static void xfical_mark_calendar_from_component(GtkCalendar *gtkcal
         */
         /* FIXME: we read the whole appointent just to get start and end 
          * timezones for mark_calendar. too heavy? */
-        /* removed due to bug 9507
-        cal_data.cal = gtkcal;
-        cal_data.year = year;
-        cal_data.month = month;
-        key_found = get_appt_from_icalcomponent(c, &cal_data.appt);
-        icalcomponent_foreach_recurrence(c, nsdate, nedate, mark_calendar
-                , (void *)&cal_data);
-        g_free(cal_data.appt.categories);
-    */
+        /* 1970 check due to bug 9507 */
+        p = icalcomponent_get_first_property(c, ICAL_DTSTART_PROPERTY);
+        start = icalproperty_get_dtstart(p);
+        if (start.year >= 1970) {
+            cal_data.cal = gtkcal;
+            cal_data.year = year;
+            cal_data.month = month;
+            key_found = get_appt_from_icalcomponent(c, &cal_data.appt);
+            icalcomponent_foreach_recurrence(c, nsdate, nedate, mark_calendar
+                    , (void *)&cal_data);
+            g_free(cal_data.appt.categories);
+        }
+        else {
         /*
     g_print(P_N "(mon, year):%d %d (%d %d %d - %d %d %d)\n"
              , month , year
              , nsdate.day , nsdate.month , nsdate.year
              , nedate.day , nedate.month , nedate.year);
     */
-        per = ic_get_period(c, TRUE);
-        xfical_mark_calendar_days(gtkcal, year, month
-                , per.stime.year, per.stime.month, per.stime.day
-                , per.etime.year, per.etime.month, per.etime.day);
-        if ((p = icalcomponent_get_first_property(c
-                , ICAL_RRULE_PROPERTY)) != 0) {
-            nsdate = icaltime_null_time();
-            rrule = icalproperty_get_rrule(p);
-            ri = icalrecur_iterator_new(rrule, per.stime);
-            for (nsdate = icalrecur_iterator_next(ri),
-                    nedate = icaltime_add(nsdate, per.duration);
-                 !icaltime_is_null_time(nsdate)
-                    && (nsdate.year*12+nsdate.month) <= (year*12+month);
-                 nsdate = icalrecur_iterator_next(ri),
-                    nedate = icaltime_add(nsdate, per.duration)) {
-                if (!icalproperty_recurrence_is_excluded(c, &per.stime
-                            , &nsdate))
-                    xfical_mark_calendar_days(gtkcal, year, month
-                            , nsdate.year, nsdate.month, nsdate.day
-                            , nedate.year, nedate.month, nedate.day);
-            }
-            icalrecur_iterator_free(ri);
+            per = ic_get_period(c, TRUE);
+            xfical_mark_calendar_days(gtkcal, year, month
+                    , per.stime.year, per.stime.month, per.stime.day
+                    , per.etime.year, per.etime.month, per.etime.day);
+            if ((p = icalcomponent_get_first_property(c
+                    , ICAL_RRULE_PROPERTY)) != 0) {
+                nsdate = icaltime_null_time();
+                rrule = icalproperty_get_rrule(p);
+                ri = icalrecur_iterator_new(rrule, per.stime);
+                for (nsdate = icalrecur_iterator_next(ri),
+                        nedate = icaltime_add(nsdate, per.duration);
+                     !icaltime_is_null_time(nsdate)
+                        && (nsdate.year*12+nsdate.month) <= (year*12+month);
+                     nsdate = icalrecur_iterator_next(ri),
+                        nedate = icaltime_add(nsdate, per.duration)) {
+                    if (!icalproperty_recurrence_is_excluded(c, &per.stime
+                                , &nsdate))
+                        xfical_mark_calendar_days(gtkcal, year, month
+                                , nsdate.year, nsdate.month, nsdate.day
+                                , nedate.year, nedate.month, nedate.day);
+                }
+                icalrecur_iterator_free(ri);
+            } 
         } 
     } /* ICAL_VEVENT_COMPONENT */
     else if (kind == ICAL_VTODO_COMPONENT) {
@@ -3828,7 +3834,7 @@ static void xfical_get_each_app_within_time_internal(char *a_day, gint days
             c2 = icalcomponent_new_clone(c);
             p = icalcomponent_get_first_property(c2, ICAL_DTSTART_PROPERTY);
             start = icalproperty_get_dtstart(p);
-            orage_message(40, P_N "Adjusting temporarily old DTSTART time %d"
+            orage_message(-10, P_N "Adjusting temporarily old DTSTART time %d"
                     , start.year);
             start.year = 1970;
             icalproperty_set_dtstart(p, start);
diff --git a/src/parameters.c b/src/parameters.c
index 088a4de..1f5cb56 100644
--- a/src/parameters.c
+++ b/src/parameters.c
@@ -444,6 +444,12 @@ static void el_extra_days_spin_changed(GtkSpinButton *sb, gpointer user_data)
     g_par.el_days = gtk_spin_button_get_value(sb);
 }
 
+static void el_only_first_checkbutton_clicked(GtkCheckButton *cb
+        , gpointer user_data)
+{
+    g_par.el_only_first = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cb));
+}
+
 /* start monitoring lost seconds due to hibernate or suspend */
 static void set_wakeup_timer()
 {
@@ -857,17 +863,18 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
     gtk_notebook_append_page(GTK_NOTEBOOK(dialog->notebook)
           , dialog->extra_tab, dialog->extra_tab_label);
 
-    /***** Eventlist window number of extra days to show *****/
+    /***** Eventlist window extra days and only first *****/
     vbox = gtk_vbox_new(FALSE, 0);
     dialog->el_extra_days_frame = orage_create_framebox_with_content(
-            _("Event list window extra days"), vbox);
+            _("Event list window"), vbox);
     gtk_box_pack_start(GTK_BOX(dialog->extra_vbox)
             , dialog->el_extra_days_frame, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
     label = gtk_label_new(_("Number of extra days to show in event list"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
-    dialog->el_extra_days_spin = gtk_spin_button_new_with_range(0, 999, 1);
+    dialog->el_extra_days_spin = gtk_spin_button_new_with_range(0, 99999, 1);
+    gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(dialog->el_extra_days_spin), TRUE);
     gtk_box_pack_start(GTK_BOX(hbox)
             , dialog->el_extra_days_spin, FALSE, FALSE, 5);
     gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->el_extra_days_spin)
@@ -879,6 +886,20 @@ static void create_parameter_dialog_extra_setup_tab(Itf *dialog)
     g_signal_connect(G_OBJECT(dialog->el_extra_days_spin), "value-changed"
             , G_CALLBACK(el_extra_days_spin_changed), dialog);
 
+    hbox = gtk_hbox_new(FALSE, 0);
+    dialog->el_only_first_checkbutton = gtk_check_button_new_with_label(
+            _("Show only first repeating event"));
+    gtk_box_pack_start(GTK_BOX(hbox), dialog->el_only_first_checkbutton
+            , FALSE, FALSE, 5);
+    gtk_toggle_button_set_active(
+            GTK_TOGGLE_BUTTON(dialog->el_only_first_checkbutton)
+                    , g_par.el_only_first);
+    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+    g_signal_connect(G_OBJECT(dialog->el_only_first_checkbutton), "clicked"
+            , G_CALLBACK(el_only_first_checkbutton_clicked), dialog);
+
+
     /***** Default start day in day view window *****/
     dialog->dw_week_mode_radiobutton_group = NULL;
     hbox = gtk_hbox_new(TRUE, 0);
@@ -1192,6 +1213,7 @@ void read_parameters(void)
     g_par.el_size_x = orage_rc_get_int(orc, "Eventlist window X", 500);
     g_par.el_size_y = orage_rc_get_int(orc, "Eventlist window Y", 350);
     g_par.el_days = orage_rc_get_int(orc, "Eventlist extra days", 0);
+    g_par.el_only_first = orage_rc_get_bool(orc, "Eventlist only first", FALSE);
     g_par.dw_pos_x = orage_rc_get_int(orc, "Dayview window pos X", 0);
     g_par.dw_pos_y = orage_rc_get_int(orc, "Dayview window pos Y", 0);
     g_par.dw_size_x = orage_rc_get_int(orc, "Dayview window X", 690);
@@ -1294,6 +1316,7 @@ void write_parameters(void)
     orage_rc_put_int(orc, "Eventlist window X", g_par.el_size_x);
     orage_rc_put_int(orc, "Eventlist window Y", g_par.el_size_y);
     orage_rc_put_int(orc, "Eventlist extra days", g_par.el_days);
+    orage_rc_put_bool(orc, "Eventlist only first", g_par.el_only_first);
     orage_rc_put_int(orc, "Dayview window pos X", g_par.dw_pos_x);
     orage_rc_put_int(orc, "Dayview window pos Y", g_par.dw_pos_y);
     orage_rc_put_int(orc, "Dayview window X", g_par.dw_size_x);
diff --git a/src/parameters.h b/src/parameters.h
index 66b0c50..7156817 100644
--- a/src/parameters.h
+++ b/src/parameters.h
@@ -114,6 +114,7 @@ typedef struct _parameters
     gint el_pos_x, el_pos_y;
     gint el_size_x, el_size_y;
     gint el_days;
+    gboolean el_only_first;
 
     /* day view window */
     gint dw_pos_x, dw_pos_y;
diff --git a/src/parameters_internal.h b/src/parameters_internal.h
index 86e5a34..f489c03 100644
--- a/src/parameters_internal.h
+++ b/src/parameters_internal.h
@@ -93,6 +93,7 @@ typedef struct _Itf
     /* number of extra days to show */
     GtkWidget *el_extra_days_frame;
     GtkWidget *el_extra_days_spin;
+    GtkWidget *el_only_first_checkbutton;
     /* day view week mode */
     GtkWidget *dw_week_mode_frame;
     GSList    *dw_week_mode_radiobutton_group;


More information about the Xfce4-commits mailing list