From dad4d7df9c3e301eb57a10b12d66fb9e2bb74950 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 28 Feb 2003 18:10:05 +0000 Subject: Don't need to use libalarm to set a timeout to change the date. We know * e-summary.c (e_summary_init): Don't need to use libalarm to set a timeout to change the date. We know how many seconds away it is, so we can just set a timeout for then. * Makefile.am (summary_libs): Remove libalarm.a svn path=/trunk/; revision=20106 --- my-evolution/ChangeLog | 8 ++++++++ my-evolution/Makefile.am | 1 - my-evolution/e-summary.c | 49 +++++++++++++++++++++++++----------------------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 88bffcd366..3480932408 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,11 @@ +2003-02-28 Dan Winship + + * e-summary.c (e_summary_init): Don't need to use libalarm to set + a timeout to change the date. We know how many seconds away it is, + so we can just set a timeout for then. + + * Makefile.am (summary_libs): Remove libalarm.a + 2003-02-21 Dan Winship * Makefile.am (summary_libs): clean up diff --git a/my-evolution/Makefile.am b/my-evolution/Makefile.am index db1a59f9c4..fcb3e124b4 100644 --- a/my-evolution/Makefile.am +++ b/my-evolution/Makefile.am @@ -65,7 +65,6 @@ summary_sources = \ weather.h summary_libs = \ - $(top_builddir)/calendar/gui/alarm-notify/libalarm.a \ $(top_builddir)/shell/libeshell.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/e-util/libeutil.la \ diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 3723d65c4c..c32bd5bb5b 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -59,7 +59,6 @@ #include -#include #include #include @@ -106,7 +105,7 @@ struct _ESummaryPrivate { guint pending_reload_tag; - gpointer alarm; + guint tomorrow_timeout_id; gboolean frozen; @@ -168,8 +167,7 @@ destroy (GtkObject *object) e_summary_tasks_free (summary); } - alarm_remove (priv->alarm); - alarm_done (); + g_source_remove (priv->tomorrow_timeout_id); if (priv->protocol_hash) { g_hash_table_foreach (priv->protocol_hash, free_protocol, NULL); @@ -466,20 +464,34 @@ e_summary_class_init (GtkObjectClass *object_class) e_summary_parent_class = g_type_class_ref(PARENT_TYPE); } +static gboolean tomorrow_timeout (gpointer data); + static void -alarm_fn (gpointer alarm_id, - time_t trigger, - gpointer data) +reset_tomorrow_timeout (ESummary *summary) { - ESummary *summary; - time_t t, day_end; + time_t now, day_end; + + now = time (NULL); + if (summary->tz) + day_end = time_day_end_with_zone (now, summary->tz); + else + day_end = time_day_end (now); + + /* (Yes, the number of milliseconds in a day is less than UINT_MAX) */ + summary->priv->tomorrow_timeout_id = + g_timeout_add ((day_end - now) * 1000, + tomorrow_timeout, summary); +} - summary = data; - t = time (NULL); - day_end = time_day_end_with_zone (t, summary->tz); - summary->priv->alarm = alarm_add (day_end, alarm_fn, summary, NULL); +static gboolean +tomorrow_timeout (gpointer data) +{ + ESummary *summary = data; + reset_tomorrow_timeout (summary); e_summary_reconfigure (summary); + + return FALSE; } #define DEFAULT_HTML "Summary%s" @@ -490,7 +502,6 @@ e_summary_init (ESummary *summary) GConfClient *gconf_client; ESummaryPrivate *priv; GdkColor bgcolor = {0, 0xffff, 0xffff, 0xffff}; - time_t t, day_end; char *def, *default_utf; summary->priv = g_new (ESummaryPrivate, 1); @@ -534,18 +545,10 @@ e_summary_init (ESummary *summary) summary->timezone = g_strdup ("UTC"); } summary->tz = icaltimezone_get_builtin_timezone (summary->timezone); + reset_tomorrow_timeout (summary); g_object_unref (gconf_client); - t = time (NULL); - if (summary->tz == NULL) { - day_end = time_day_end (t); - } else { - day_end = time_day_end_with_zone (t, summary->tz); - } - - priv->alarm = alarm_add (day_end, alarm_fn, summary, NULL); - priv->queued_draw_idle_id = 0; } -- cgit v1.2.3