diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-12-17 19:59:47 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-12-17 19:59:47 +0800 |
commit | 350bdccc968a80bc7819d1bc7c302584c165b771 (patch) | |
tree | 1c67ad334ef3909fc3d62030f0fa6d3825277f1b | |
parent | ef5c4898659a7811fb442b5cf7b85ec346332381 (diff) | |
download | gsoc2013-evolution-350bdccc968a80bc7819d1bc7c302584c165b771.tar.gz gsoc2013-evolution-350bdccc968a80bc7819d1bc7c302584c165b771.tar.zst gsoc2013-evolution-350bdccc968a80bc7819d1bc7c302584c165b771.zip |
make sure we free the data stored in the hash table.
2003-12-17 Rodrigo Moya <rodrigo@ximian.com>
* gui/alarm-notify/alarm-notify.c (alarm_notify_remove_calendar):
make sure we free the data stored in the hash table.
(alarm_notify_add_calendar): call alarm_queue_add_client, or we wont
have alarms at all.
* gui/alarm-notify/alarm-queue.c: no need to hold a ref count.
(alarm_queue_add_client, alarm_queue_remove_client): don't use the
refcount private member.
(alarm_queue_add_client): don't connect to non-existing ECal signals.
(display_notification, free_client_alarms_cb): fixed warnings.
svn path=/trunk/; revision=23960
-rw-r--r-- | calendar/ChangeLog | 13 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 7 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 20 |
3 files changed, 18 insertions, 22 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 6c6a63d9bc..5e855d4206 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,16 @@ +2003-12-17 Rodrigo Moya <rodrigo@ximian.com> + + * gui/alarm-notify/alarm-notify.c (alarm_notify_remove_calendar): + make sure we free the data stored in the hash table. + (alarm_notify_add_calendar): call alarm_queue_add_client, or we wont + have alarms at all. + + * gui/alarm-notify/alarm-queue.c: no need to hold a ref count. + (alarm_queue_add_client, alarm_queue_remove_client): don't use the + refcount private member. + (alarm_queue_add_client): don't connect to non-existing ECal signals. + (display_notification, free_client_alarms_cb): fixed warnings. + 2003-12-16 Rodrigo Moya <rodrigo@ximian.com> Fixes part of #41237 diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 9e7f1335a8..37addc4d9a 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -179,6 +179,7 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a if (e_cal_open (client, FALSE, NULL)) { g_hash_table_insert (priv->uri_client_hash, g_strdup (str_uri), client); + alarm_queue_add_client (client); } } } @@ -188,13 +189,15 @@ alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri) { AlarmNotifyPrivate *priv; ECal *client; + gpointer orig_key, orig_value; priv = an->priv; - client = g_hash_table_lookup (priv->uri_client_hash, str_uri); - if (client) { + if (g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, &orig_key, &orig_value)) { alarm_queue_remove_client (client); g_hash_table_remove (priv->uri_client_hash, str_uri); + g_free (orig_key); + g_object_unref (orig_value); } } diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 2cf95f47b7..e97761fc89 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -69,9 +69,6 @@ typedef struct { /* Monitored client */ ECal *client; - /* Number of times this client has been registered */ - int refcount; - /* Hash table of component UID -> CompQueuedAlarms. If an element is * present here, then it means its cqa->queued_alarms contains at least * one queued alarm. When all the alarms for a component have been @@ -840,7 +837,6 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, { QueuedAlarm *qa; ECalComponent *comp; - ECal *client; ECalComponentVType vtype; const char *message; ECalComponentAlarm *alarm; @@ -1126,7 +1122,6 @@ alarm_queue_init (void) static void free_client_alarms_cb (gpointer key, gpointer value, gpointer user_data) { - ECal *client = key; ClientAlarms *ca = value; if (ca) { @@ -1186,7 +1181,6 @@ alarm_queue_add_client (ECal *client) ca = lookup_client (client); if (ca) { - ca->refcount++; return; } @@ -1195,7 +1189,6 @@ alarm_queue_add_client (ECal *client) ca->client = client; g_object_ref (ca->client); - ca->refcount = 1; g_hash_table_insert (client_alarms_hash, client, ca); ca->uid_alarms_hash = g_hash_table_new (g_str_hash, g_str_equal); @@ -1205,13 +1198,6 @@ alarm_queue_add_client (ECal *client) G_CALLBACK (cal_opened_cb), ca); - g_signal_connect (client, "obj_updated", - G_CALLBACK (obj_updated_cb), - ca); - g_signal_connect (client, "obj_removed", - G_CALLBACK (obj_removed_cb), - ca); - if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED) { load_alarms_for_today (ca); load_missed_alarms (ca); @@ -1276,12 +1262,6 @@ alarm_queue_remove_client (ECal *client) ca = lookup_client (client); g_return_if_fail (ca != NULL); - g_assert (ca->refcount > 0); - ca->refcount--; - - if (ca->refcount > 0) - return; - remove_client_alarms (ca); /* Clean up */ |