aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-10-21 05:25:47 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-10-21 05:25:47 +0800
commit1fff2516257a785bb4597c7ad4917405bbcb8cbc (patch)
tree5f04a3c3f2e079e42fb4bacde631b340d84f6973 /calendar/pcs
parent88cbebbb3d5c27eccf5935208a90389fe608fa7f (diff)
downloadgsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar.gz
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar.bz2
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar.lz
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar.xz
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.tar.zst
gsoc2013-evolution-1fff2516257a785bb4597c7ad4917405bbcb8cbc.zip
Pulling up stuff from the 0.6 branch
2000-10-20 JP Rosevear <jpr@helixcode.com> * 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 <jpr@helixcode.com> * conduits/todo/Makefile.am: Fix build * conduits/calendar/Makefile.am: Fix build 2000-10-20 JP Rosevear <jpr@helixcode.com> * 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 <jpr@helixcode.com> * 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
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend-file.c39
-rw-r--r--calendar/pcs/cal-backend.c38
2 files changed, 45 insertions, 32 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 97e96d3d44..715e1e70bc 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -183,29 +183,21 @@ save (CalBackendFile *cbfile)
g_assert (priv->icalcomp != NULL);
/* Make a backup copy of the file if it exists */
- if (gnome_vfs_uri_exists (priv->uri)) {
- tmp = gnome_vfs_uri_to_string (priv->uri, GNOME_VFS_URI_HIDE_NONE);
- if (tmp) {
- GnomeVFSURI *backup_uri;
- gchar *backup_uristr;
-
- backup_uristr = g_strconcat (tmp, "~", NULL);
- backup_uri = gnome_vfs_uri_new (backup_uristr);
-
- result = gnome_vfs_move_uri (priv->uri, backup_uri, TRUE);
- gnome_vfs_uri_unref (backup_uri);
-
- g_free (tmp);
- g_free (backup_uristr);
- }
- } else {
- result = GNOME_VFS_OK;
+ tmp = gnome_vfs_uri_to_string (priv->uri, GNOME_VFS_URI_HIDE_NONE);
+ if (tmp) {
+ GnomeVFSURI *backup_uri;
+ gchar *backup_uristr;
+
+ backup_uristr = g_strconcat (tmp, "~", NULL);
+ backup_uri = gnome_vfs_uri_new (backup_uristr);
+
+ result = gnome_vfs_move_uri (priv->uri, backup_uri, TRUE);
+ gnome_vfs_uri_unref (backup_uri);
+
+ g_free (tmp);
+ g_free (backup_uristr);
}
-
- if (result != GNOME_VFS_OK)
- goto error;
-
/* Now write the new file out */
result = gnome_vfs_create_uri (&handle, priv->uri,
GNOME_VFS_OPEN_WRITE,
@@ -616,9 +608,6 @@ cal_backend_file_load (CalBackend *backend, GnomeVFSURI *uri)
if (!gnome_vfs_uri_is_local (uri))
return CAL_BACKEND_LOAD_ERROR;
- if (!gnome_vfs_uri_exists (uri))
- return CAL_BACKEND_LOAD_ERROR;;
-
str_uri = gnome_vfs_uri_to_string (uri,
(GNOME_VFS_URI_HIDE_USER_NAME
| GNOME_VFS_URI_HIDE_PASSWORD
@@ -659,7 +648,7 @@ cal_backend_file_load (CalBackend *backend, GnomeVFSURI *uri)
/* Clean up */
if (priv->uri)
- gnome_vfs_uri_unref (uri);
+ gnome_vfs_uri_unref (priv->uri);
gnome_vfs_uri_ref (uri);
priv->uri = uri;
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 <federico@helixcode.com>
+ * Authors: Federico Mena-Quintero <federico@helixcode.com>
+ * JP Rosevear <jpr@helixcode.com>
*
* 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]);
}
-
-
-