diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-12-18 02:13:55 +0000 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-12-18 02:13:55 +0000 |
commit | 50ca1931e88e6a8a52485171b277e80a1bc4b9a5 (patch) | |
tree | 74b75f0f7ea89968107561ee14ccdd9e022ef8d3 | |
parent | bb9fc4315367838423f167d595d5699569596bec (diff) | |
download | evolution-data-server-50ca1931e88e6a8a52485171b277e80a1bc4b9a5.tar.gz |
Unref source. (fetch_corba_cal): Ref and keep source. (e_cal_get_source):
2003-12-17 Hans Petter Jansson <hpj@ximian.com>
* libecal/e-cal.c (e_cal_finalize): Unref source.
(fetch_corba_cal): Ref and keep source.
(e_cal_get_source): Implement.
-rw-r--r-- | calendar/libecal/e-cal.c | 30 | ||||
-rw-r--r-- | calendar/libecal/e-cal.h | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index 04233696b..fa9e30582 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -61,6 +61,7 @@ struct _ECalPrivate { /* URI of the calendar that is being loaded or is already loaded, or * NULL if we are not loaded. */ + ESource *source; char *uri; CalObjType type; @@ -1051,6 +1052,11 @@ e_cal_finalize (GObject *object) priv->load_state = E_CAL_LOAD_NOT_LOADED; + if (priv->source) { + g_object_unref (priv->source); + priv->source = NULL; + } + if (priv->uri) { g_free (priv->uri); priv->uri = NULL; @@ -1216,6 +1222,9 @@ fetch_corba_cal (ECal *ecal, ESource *source, CalObjType type) return FALSE; } + g_object_ref (source); + priv->source = source; + priv->uri = g_strdup (str_uri); priv->type = type; @@ -1584,6 +1593,27 @@ e_cal_get_load_state (ECal *ecal) } /** + * e_cal_get_source: + * @ecal: A calendar ecal. + * + * Queries the source that is open in a calendar ecal. + * + * Return value: The source of the calendar that is already loaded or is being + * loaded, or NULL if the ecal has not started a load request yet. + **/ +ESource * +e_cal_get_source (ECal *ecal) +{ + ECalPrivate *priv; + + g_return_val_if_fail (ecal != NULL, NULL); + g_return_val_if_fail (E_IS_CAL (ecal), NULL); + + priv = ecal->priv; + return priv->source; +} + +/** * e_cal_get_uri: * @ecal: A calendar ecal. * diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h index 17682b9f2..63010793e 100644 --- a/calendar/libecal/e-cal.h +++ b/calendar/libecal/e-cal.h @@ -107,6 +107,7 @@ GList *e_cal_uri_list (ECal *ecal, CalMode mode); ECalLoadState e_cal_get_load_state (ECal *ecal); +ESource *e_cal_get_source (ECal *ecal); const char *e_cal_get_uri (ECal *ecal); gboolean e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error); |