aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-09 08:57:40 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-09 08:57:40 +0800
commit71efb0fede5176ff7970903621a66f518020843b (patch)
tree4f32e95f9143361ac887b72889d8748bf3d5c292
parent47ff8cbbb25a28197c38d2ae6272e404d45a577d (diff)
downloadgsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar.gz
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar.bz2
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar.lz
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar.xz
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.tar.zst
gsoc2013-epiphany-71efb0fede5176ff7970903621a66f518020843b.zip
Simplified the code a bit.
2004-11-09 Christian Persch <chpe@cvs.gnome.org> * src/ephy-history-window.c: (add_by_date_filter): Simplified the code a bit.
-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,