[gnome-calendar] manager: Keep references of the clients internally
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] manager: Keep references of the clients internally
- Date: Mon, 15 Dec 2014 18:44:20 +0000 (UTC)
commit 9e429225433d752afa21a2edefc89f1134a22c7a
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Mon Dec 15 13:33:10 2014 -0500
manager: Keep references of the clients internally
In order to remove clients from the ECalDataModel without destroying we
need to keep a reference to it.
src/gcal-manager.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 97e53aa..12cf9b5 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -68,6 +68,8 @@ typedef struct _MoveEventData MoveEventData;
static void free_async_ops_data (AsyncOpsData *data);
+static void free_unit_data (GcalManagerUnit *data);
+
static void load_source (GcalManager *manager,
ESource *source);
@@ -189,6 +191,13 @@ free_async_ops_data (AsyncOpsData *data)
g_free (data);
}
+static void
+free_unit_data (GcalManagerUnit *data)
+{
+ g_object_unref (data->client);
+ g_free (data);
+}
+
/**
* load_source:
* @manager: Manager instance
@@ -244,7 +253,7 @@ on_client_connected (GObject *source_object,
{
unit = g_new0 (GcalManagerUnit, 1);
unit->connected = TRUE;
- unit->client = client;
+ unit->client = g_object_ref (client);
/* FIXME: user should be able to disable sources */
unit->enabled = TRUE;
@@ -419,7 +428,7 @@ gcal_manager_init (GcalManager *self)
priv->clients = g_hash_table_new_full ((GHashFunc) e_source_hash,
(GEqualFunc) e_source_equal,
g_object_unref,
- g_free);
+ (GDestroyNotify) free_unit_data);
/* reading sources and schedule its connecting */
error = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]