From 1fff2516257a785bb4597c7ad4917405bbcb8cbc Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 20 Oct 2000 21:25:47 +0000 Subject: Pulling up stuff from the 0.6 branch 2000-10-20 JP Rosevear * pcs/cal-backend.c (cal_backend_destroy): New destroy handler to properly stop the timer, sync the log and unref the URI. (cal_backend_last_client_gone): Just emit the signal, clean up work is done in cal_backend_destroy now. * pcs/cal-backend-file.c (cal_backend_file_load): Unref the uri we are replacing NOT the new uri. 2000-10-20 JP Rosevear * conduits/todo/Makefile.am: Fix build * conduits/calendar/Makefile.am: Fix build 2000-10-20 JP Rosevear * conduits/calendar/calendar-conduit.c (delete_archive_record): Don't throw an error * conduits/todo/todo-conduit.c (delete_archive_record): ditto 2000-10-20 JP Rosevear * conduits/todo/todo-conduit-control-applet.c: Add defines * conduits/todo/todo-conduit-config.h: put #ifdefs around functions can't make this a public interface in the usual way as then the symbols would be exported * conduits/todo/todo-conduit.c: Kill warnings. clahey will be happy! Add some defines to include only the necessary config functions. (conduit_get_gpilot_conduit): Hook up archive signals * conduits/calendar/calendar-conduit.c: Same as above * conduits/calendar/calendar-conduit-control-applet.c: ditto * conduits/calendar/calendar-conduit-config.h: ditto svn path=/trunk/; revision=6086 --- calendar/pcs/cal-backend.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'calendar/pcs/cal-backend.c') diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index beca760be1..b2b16b2c9e 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -3,7 +3,8 @@ * * Copyright (C) 2000 Helix Code, Inc. * - * Author: Federico Mena-Quintero + * Authors: Federico Mena-Quintero + * JP Rosevear * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +40,7 @@ enum { static void cal_backend_class_init (CalBackendClass *class); static void cal_backend_init (CalBackend *backend); +static void cal_backend_destroy (GtkObject *object); static gboolean cal_backend_log_sync (CalBackend *backend); static GHashTable *cal_backend_get_log_entries (CalBackend *backend, CalObjType type, @@ -95,6 +97,8 @@ cal_backend_class_init (CalBackendClass *class) parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class->destroy = cal_backend_destroy; + cal_backend_signals[LAST_CLIENT_GONE] = gtk_signal_new ("last_client_gone", GTK_RUN_FIRST, @@ -112,6 +116,31 @@ cal_backend_init (CalBackend *backend) { backend->uri = NULL; backend->entries = NULL; + backend->timer = -1; +} + +static void +cal_backend_destroy (GtkObject *object) +{ + CalBackend *backend; + + g_return_if_fail (object != NULL); + g_return_if_fail (IS_CAL_BACKEND (object)); + + backend = CAL_BACKEND (object); + + if (backend->timer != -1) { + gtk_timeout_remove (backend->timer); + backend->timer = -1; + } + + if (backend->uri) { + cal_backend_log_sync (backend); + gnome_vfs_uri_unref (backend->uri); + } + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -141,7 +170,7 @@ cal_backend_set_uri (CalBackend *backend, GnomeVFSURI *uri) if (backend->uri) gnome_vfs_uri_unref (backend->uri); - if (backend->timer) + if (backend->timer != -1) gtk_timeout_remove (backend->timer); @@ -733,11 +762,6 @@ cal_backend_last_client_gone (CalBackend *backend) g_return_if_fail (backend != NULL); g_return_if_fail (IS_CAL_BACKEND (backend)); - cal_backend_log_sync (backend); - gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[LAST_CLIENT_GONE]); } - - - -- cgit v1.2.3