aboutsummaryrefslogtreecommitdiffstats
path: root/my-evolution/e-summary-calendar.c
diff options
context:
space:
mode:
Diffstat (limited to 'my-evolution/e-summary-calendar.c')
-rw-r--r--my-evolution/e-summary-calendar.c59
1 files changed, 48 insertions, 11 deletions
diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c
index 8d874cc015..7903c3642d 100644
--- a/my-evolution/e-summary-calendar.c
+++ b/my-evolution/e-summary-calendar.c
@@ -44,6 +44,8 @@
#include <ical.h>
+#define MAX_RELOAD_TRIES 10
+
struct _ESummaryCalendar {
CalClient *client;
@@ -53,6 +55,9 @@ struct _ESummaryCalendar {
char *default_uri;
EConfigListener *config_listener;
+
+ int cal_open_reload_timeout_id;
+ int reload_count;
};
const char *
@@ -89,10 +94,10 @@ cal_component_compare_tzid (const char *tzid1, const char *tzid2)
return retval;
}
-gboolean
-e_cal_comp_util_compare_event_timezones (CalComponent *comp,
- CalClient *client,
- icaltimezone *zone)
+static gboolean
+compare_event_timezones (CalComponent *comp,
+ CalClient *client,
+ icaltimezone *zone)
{
CalClientGetStatus status;
CalComponentDateTime start_datetime, end_datetime;
@@ -335,6 +340,9 @@ generate_html (gpointer data)
char *tmp;
time_t t, begin, end, f;
+ if (cal_client_get_load_state (calendar->client) != CAL_CLIENT_LOAD_LOADED)
+ return FALSE;
+
/* Set the default timezone on the server. */
if (summary->tz) {
cal_client_set_default_timezone (calendar->client,
@@ -379,7 +387,7 @@ generate_html (gpointer data)
g_free (s1);
g_free (s2);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
return FALSE;
} else {
GPtrArray *uidarray;
@@ -414,9 +422,9 @@ generate_html (gpointer data)
if (cal_component_has_alarms (event->comp)) {
img = "es-appointments.png";
- } else if (e_cal_comp_util_compare_event_timezones (event->comp,
- calendar->client,
- summary->tz) == FALSE) {
+ } else if (compare_event_timezones (event->comp,
+ calendar->client,
+ summary->tz) == FALSE) {
img = "timezone-16.xpm";
} else {
img = "new_appointment.xpm";
@@ -444,7 +452,23 @@ generate_html (gpointer data)
calendar->html = string->str;
g_string_free (string, FALSE);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
+ return FALSE;
+}
+
+static gboolean
+cal_open_reload_timeout (void *data)
+{
+ ESummary *summary = (ESummary *) data;
+
+ summary->calendar->cal_open_reload_timeout_id = 0;
+
+ if (++ summary->calendar->reload_count >= MAX_RELOAD_TRIES) {
+ summary->calendar->reload_count = 0;
+ return FALSE;
+ }
+
+ cal_client_open_default_calendar (summary->calendar->client, FALSE);
return FALSE;
}
@@ -456,9 +480,12 @@ cal_opened_cb (CalClient *client,
if (status == CAL_CLIENT_OPEN_SUCCESS) {
g_idle_add (generate_html, summary);
} else {
- /* Need to work out what to do if there's an error */
+ summary->calendar->cal_open_reload_timeout_id = g_timeout_add (1000,
+ cal_open_reload_timeout,
+ summary);
}
}
+
static void
obj_changed_cb (CalClient *client,
const char *uid,
@@ -520,6 +547,12 @@ setup_calendar (ESummary *summary)
calendar = summary->calendar;
g_assert (calendar != NULL);
+ if (calendar->cal_open_reload_timeout_id != 0) {
+ g_source_remove (calendar->cal_open_reload_timeout_id);
+ calendar->cal_open_reload_timeout_id = 0;
+ calendar->reload_count = 0;
+ }
+
if (calendar->client != NULL)
gtk_object_unref (GTK_OBJECT (calendar->client));
@@ -549,7 +582,6 @@ config_listener_key_changed_cb (EConfigListener *listener,
void *user_data)
{
setup_calendar (E_SUMMARY (user_data));
-
generate_html (user_data);
}
@@ -589,6 +621,7 @@ e_summary_calendar_init (ESummary *summary)
void
e_summary_calendar_reconfigure (ESummary *summary)
{
+ setup_calendar (summary);
generate_html (summary);
}
@@ -601,6 +634,10 @@ e_summary_calendar_free (ESummary *summary)
g_return_if_fail (IS_E_SUMMARY (summary));
calendar = summary->calendar;
+
+ if (calendar->cal_open_reload_timeout_id != 0)
+ g_source_remove (calendar->cal_open_reload_timeout_id);
+
gtk_object_unref (GTK_OBJECT (calendar->client));
g_free (calendar->html);
g_free (calendar->default_uri);
an class='insertions'>+6 * Change the meaning of NO_WRKSUBDIR to force a WRKDIR != WRKSRC.mat2015-11-051-0/+17 * - Add shebangfix documentation bitsamdmi32015-10-221-0/+15 * Readd PORTSDIR for now we will only start removing them after 2016Q1 is branchedbapt2015-10-151-14/+0 * Drop the necessity to add ${PORTSDIR} to dependency linebapt2015-10-151-0/+14 * Rewording missed from previous commitamdmi32015-09-291-2/+2 * Implemented complete support for test target.amdmi32015-09-291-0/+20 * Extend @sample to accept argumentsbapt2015-09-261-1/+10 * Document @{pre,post}[un]exec in CHANGESbapt2015-09-261-0/+12 * Make it so that the default Perl is always called perl5.mat2015-09-141-0/+6 * Add generic opt_VARS/opt_VARS_OFF.mat2015-08-281-0/+11 * Document r394572 in CHANGES.rakuco2015-08-181-0/+6 * Introduce <opt>_IMPLIES and <opt>_PREVENTS to register dependencies, ormat2015-08-181-0/+14 * Remove UNIQUENAME and LATEST_LINK.mat2015-08-171-0/+8 * Convert code in bsd.port.mk for USE_GHOSTSCRIPT* to USES=ghostscript.kwm2015-07-171-0/+7 * Introduce target option helpers.mat2015-07-011-0/+32 * Document the removal of USE_RCORDERbapt2015-06-231-0/+6 * Introduce USE_GITHUB=nodefault to allow fetching additional distfilesmat2015-05-291-0/+7 * USE_GITHUB can now fetch multiple distfiles. It uses a grouping featuremat2015-05-291-0/+29 * Switch PYTHON_REL from a 3 digits number to a 4 digits number to handleantoine2015-05-271-0/+8 * Remove GH_COMMIT support.mat2015-05-211-0/+5 * Mark USE_AUTOTOOLS deprecated and remove support for libtoolize.tijl2015-04-201-0/+9 * Convert bsd.gnustep.mk to USES=gnustepbapt2015-04-091-0/+11 * Document the new USES=waf into CHANGESbapt2015-04-081-0/+20 * USE_BZIP2 and USE_XZ are not used anymore in the ports tree mark them asbapt2015-04-071-0/+6 * - track subversion http module activation change in the correct fileohauer2015-04-071-7/+0 * Document recent changesbapt2015-04-011-0/+16 * - document new subversion httpd module fileohauer2015-04-011-0/+7 * Document removal of PTHREAD_LIBS/PTHREAD_CFLAGSbdrewery2015-03-271-0/+6 * Undocument BSDMAKE from r381977 as I have thought of a better way and willbdrewery2015-03-231-7/+0 * Introduce a BSDMAKE?= /usr/bin/make and use it as the default MAKE_CMD.bdrewery2015-03-231-0/+7 * Remove GITHUB_RELEASE MASTER_SITE from r375010 as it is now redundant with GI...bdrewery2015-03-201-0/+8 * Note that GH_TAGNAME can be any length of the git hash.bdrewery2015-03-201-0/+3 * Update USE_GITHUB so it does not require GH_COMMIT.bdrewery2015-03-201-0/+14 * The FreeBSD Xfce team proudly presents Xfce 4.12.olivierd2015-03-061-0/+6 * Introduce new USE_QT4 component linguisttools for lrelease/lupdate toolsmakc2015-02-251-0/+9 * Make Perl link all .so it builds with libperl.so.mat2014-12-171-0/+9 * Split devel/gettext in devel/gettext-runtime and devel/gettext-tools. Thetijl2014-11-301-0/+13 * Change the way Perl modules are installed, update the default Perl to 5.18.mat2014-11-261-0/+29 * Finally retire USE_PGSQLcrees2014-11-231-0/+10 * Introduce the SITE_ARCH variable containing SITE_PERL/PERL_ARCH.mat2014-11-181-0/+6 * - Enable SSP by default.bdrewery2014-11-031-0/+8 * Add an example with @exec too.mat2014-10-081-0/+3 * Note @cwd being deprecated.mat2014-10-071-0/+15 * Add BUNDLE_LIBS knob to prevent pkg(8) from automatically add provided shlibsbapt2014-10-021-0/+7 * Remove support for old autoconf and automake versions from USE_AUTOTOOLS:tijl2014-10-011-0/+6 * If either of OSVERSION or UNAME_r is improperly set when building in abdrewery2014-10-011-0/+30 * Add hint as to where @stopdaemon has gone.mandree2014-09-251-21/+20 * Proofread the 20140922 CHANGES entry.rakuco2014-09-241-4/+4 * Document recent changes in plist handlingbapt2014-09-221-0/+19 * - Remove last uses of USE_AUTOTOOLS=libtool from bsd.gnome.mktijl2014-09-171-0/+10