Removed. Wheee!

2000-08-10  Federico Mena Quintero  <federico@helixcode.com>

	* gui/calendar-commands.c (calendar_iterate): Removed.  Wheee!

svn path=/trunk/; revision=4703
This commit is contained in:
Federico Mena Quintero
2000-08-10 20:44:29 +00:00
committed by Federico Mena Quintero
parent 44b1cb734d
commit b0dbbe72ac
4 changed files with 23 additions and 84 deletions

View File

@ -1,3 +1,7 @@
2000-08-10 Federico Mena Quintero <federico@helixcode.com>
* gui/calendar-commands.c (calendar_iterate): Removed. Wheee!
2000-08-10 Federico Mena Quintero <federico@helixcode.com>
* cal-client/cal-client.c (cal_client_generate_instances): There.

View File

@ -92,10 +92,6 @@ CalendarAlarm alarm_defaults[4] = {
};
#endif
static void calendar_iterate_free_cache_entry (gpointer key,
gpointer value,
gpointer user_data);
static void
init_username (void)
{
@ -187,17 +183,28 @@ static void
display_objedit (BonoboUIHandler *uih, void *user_data, const char *path)
{
GnomeCalendar *gcal;
iCalObject *ico;
CalComponent *comp;
time_t dtstart, dtend;
CalComponentDateTime dt;
struct icaltimetype itt;
gcal = GNOME_CALENDAR (user_data);
ico = ical_new ("", user_name, "");
ico->new = TRUE;
gnome_calendar_get_current_time_range (gcal, &ico->dtstart,
&ico->dtend);
gnome_calendar_get_current_time_range (gcal, dtstart, dtend);
dt.value = &itt;
dt.tzid = NULL;
gnome_calendar_edit_object (gcal, ico);
ical_object_unref (ico);
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
itt = icaltimetype_from_timet (dtstart);
cal_component_set_dtstart (comp, &dt);
itt = icaltimetype_from_timet (dtend);
cal_component_set_dtend (comp, &dt);
gnome_calendar_edit_object (gcal, comp);
gtk_object_unref (GTK_OBJECT (comp));
}
static void
@ -885,70 +892,3 @@ init_calendar (void)
gnome_config_pop_prefix ();
}
/* FIXME -- where should this go? */
void
calendar_iterate (GnomeCalendar *cal,
time_t start, time_t end,
calendarfn cb, void *closure)
{
GList *l, *cois;
GHashTable *cache;
CalClientGetStatus status;
CalObjInstance *coi;
char *uid;
iCalObject *ico;
cois = cal_client_get_events_in_range (cal->client, start, end);
/* We use a hash table to keep a cache of uid->iCalObject, so for
recurring events we only load and parse the objects once. */
cache = g_hash_table_new (g_str_hash, g_str_equal);
for (l = cois; l; l = l->next) {
coi = l->data;
uid = coi->uid;
ico = g_hash_table_lookup (cache, uid);
if (!ico) {
status = cal_client_get_object (cal->client, uid, &ico);
switch (status) {
case CAL_CLIENT_GET_SUCCESS:
g_hash_table_insert (cache, ico->uid, ico);
break;
case CAL_CLIENT_GET_SYNTAX_ERROR:
printf ("calendar_iterate: syntax error uid=%s\n", uid);
break;
case CAL_CLIENT_GET_NOT_FOUND:
printf ("calendar_iterate: obj not found uid=%s\n", uid);
break;
}
}
if (ico)
(*cb) (ico, coi->start, coi->end, closure);
g_free (uid);
g_free (coi);
}
g_list_free (cois);
/* We need to unref all the iCalObjects in the cache now. The callback
function should have ref'd any of them it wants to keep. */
g_hash_table_foreach (cache, calendar_iterate_free_cache_entry, NULL);
g_hash_table_destroy (cache);
}
static void
calendar_iterate_free_cache_entry (gpointer key,
gpointer value,
gpointer user_data)
{
ical_object_unref ((iCalObject*) value);
}

View File

@ -107,11 +107,6 @@ void calendar_set_uri (GnomeCalendar *gcal, char *calendar_file);
/* FIXME -- where should this stuff go? */
/*----------------------------------------------------------------------*/
void
calendar_iterate (GnomeCalendar *cal,
time_t start, time_t end,
calendarfn cb, void *closure);
void init_calendar (void);
void calendar_control_activate (BonoboControl *control,

View File

@ -1382,7 +1382,7 @@ gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
e_week_view_get_selected_time_range (E_WEEK_VIEW (page),
start_time, end_time);
else {
g_warning ("My penguin is gone!");
g_message ("My penguin is gone!");
g_assert_not_reached ();
}
}