aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/ephy-history-window.c29
2 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 87237c092..528886f4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
* src/ephy-history-window.c: (add_by_date_filter):
+ Simplified the code a bit.
+
+2004-11-09 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-history-window.c: (add_by_date_filter):
+
Make it also correct on DST changes.
2004-11-09 Christian Persch <chpe@cvs.gnome.org>
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index ac56df46f..a3f53a064 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -832,7 +832,7 @@ add_by_date_filter (EphyHistoryWindow *editor,
{
time_t now, midnight, cmp_time = 0;
struct tm btime;
- int time_range;
+ int time_range, days = 0;
time_range = gtk_combo_box_get_active
(GTK_COMBO_BOX (editor->priv->time_combo));
@@ -855,22 +855,10 @@ add_by_date_filter (EphyHistoryWindow *editor,
cmp_time = now - 30 * 60;
break;
case TIME_LAST_THREE_DAYS:
- /* subtract 1 day */
- midnight -= 43200;
- localtime_r (&midnight, &btime);
- btime.tm_sec = 0;
- btime.tm_min = 0;
- btime.tm_hour = 0;
- midnight = mktime (&btime);
+ days++;
/* fall-through */
case TIME_LAST_TWO_DAYS:
- /* subtract 1 day */
- midnight -= 43200;
- localtime_r (&midnight, &btime);
- btime.tm_sec = 0;
- btime.tm_min = 0;
- btime.tm_hour = 0;
- midnight = mktime (&btime);
+ days++;
/* fall-through */
case TIME_TODAY:
cmp_time = midnight;
@@ -880,6 +868,17 @@ add_by_date_filter (EphyHistoryWindow *editor,
break;
}
+ while (--days >= 0)
+ {
+ /* subtract 1 day */
+ cmp_time -= 43200;
+ localtime_r (&cmp_time, &btime);
+ btime.tm_sec = 0;
+ btime.tm_min = 0;
+ btime.tm_hour = 0;
+ cmp_time = mktime (&btime);
+ }
+
ephy_node_filter_add_expression
(filter, ephy_node_filter_expression_new
(EPHY_NODE_FILTER_EXPRESSION_INT_PROP_BIGGER_THAN,