aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-backend.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-04-26 09:08:06 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-04-26 09:08:06 +0800
commit555668c928408f0b27cb22a8225b9d3b55a5b57d (patch)
treef32db539856c6c0737da03e124b39f365b5dcb7f /calendar/pcs/cal-backend.c
parent23bcb0bbd8fefb952d751951b2bf3b19717e707d (diff)
downloadgsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar.gz
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar.bz2
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar.lz
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar.xz
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.tar.zst
gsoc2013-evolution-555668c928408f0b27cb22a8225b9d3b55a5b57d.zip
Renamed from backend_destroy_cb. Now we use it for the "last_client_gone"
2000-04-25 Federico Mena Quintero <federico@helixcode.com> * pcs/cal-factory.c (backend_last_client_gone_cb): Renamed from backend_destroy_cb. Now we use it for the "last_client_gone" signal from the backend. Also, unref the backend to destroy it. (add_backend): Connect to the "last_client_gone" signal of the backend. (cal_factory_get_n_backends): New function to query the number of running backends. * pcs/cal-backend.c (cal_backend_class_init): Register the new "last_client_gone" signal. It is emitted when the last Cal client goes away. It is used to notify the factory when a backend may be safely destroyed. (cal_destroy_cb): Emit the "last_client_gone" signal when the last client disconnects from the backend. svn path=/trunk/; revision=2619
Diffstat (limited to 'calendar/pcs/cal-backend.c')
-rw-r--r--calendar/pcs/cal-backend.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 4d0e659037..364a4670c6 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -61,12 +61,20 @@ typedef struct {
+/* Signal IDs */
+enum {
+ LAST_CLIENT_GONE,
+ LAST_SIGNAL
+};
+
static void cal_backend_class_init (CalBackendClass *class);
static void cal_backend_init (CalBackend *backend);
static void cal_backend_destroy (GtkObject *object);
static GtkObjectClass *parent_class;
+static guint cal_backend_signals[LAST_SIGNAL];
+
/**
@@ -112,6 +120,16 @@ cal_backend_class_init (CalBackendClass *class)
parent_class = gtk_type_class (GTK_TYPE_OBJECT);
+ cal_backend_signals[LAST_CLIENT_GONE] =
+ gtk_signal_new ("last_client_gone",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalBackendClass, last_client_gone),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, cal_backend_signals, LAST_SIGNAL);
+
object_class->destroy = cal_backend_destroy;
}
@@ -128,7 +146,8 @@ cal_backend_init (CalBackend *backend)
priv->format = CAL_VCAL;
}
-static void save_to_vcal (CalBackend *backend, char *fname)
+static void
+save_to_vcal (CalBackend *backend, char *fname)
{
FILE *fp;
CalBackendPrivate *priv = backend->priv;
@@ -174,7 +193,6 @@ static void save_to_vcal (CalBackend *backend, char *fname)
cleanStrTbl ();
}
-
/* Saves a calendar */
static void
save (CalBackend *backend)
@@ -547,12 +565,11 @@ cal_destroy_cb (GtkObject *object, gpointer data)
priv->clients = g_list_remove_link (priv->clients, l);
g_list_free_1 (l);
- /* When all clients go away, the backend can go away, too. Commit
- * suicide here.
+ /* When all clients go away, notify the parent factory about it so that
+ * it may decide whether to kill the backend or not.
*/
-
if (!priv->clients)
- gtk_object_unref (GTK_OBJECT (backend));
+ gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[LAST_CLIENT_GONE]);
}
/**