|
Lines 120-125
static void calendar_client_start_query
Link Here
|
| 120 |
static void calendar_client_source_finalize (CalendarClientSource *source); |
120 |
static void calendar_client_source_finalize (CalendarClientSource *source); |
| 121 |
static void calendar_client_query_finalize (CalendarClientQuery *query); |
121 |
static void calendar_client_query_finalize (CalendarClientQuery *query); |
| 122 |
|
122 |
|
|
|
123 |
static void |
| 124 |
calendar_client_update_appointments (CalendarClient *client); |
| 125 |
static void |
| 126 |
calendar_client_update_tasks (CalendarClient *client); |
| 127 |
|
| 123 |
enum |
128 |
enum |
| 124 |
{ |
129 |
{ |
| 125 |
PROP_O, |
130 |
PROP_O, |
|
Lines 269-277
calendar_client_set_timezone (CalendarCl
Link Here
|
| 269 |
for (l = esources; l; l = l->next) { |
274 |
for (l = esources; l; l = l->next) { |
| 270 |
ECal *source = l->data; |
275 |
ECal *source = l->data; |
| 271 |
|
276 |
|
| 272 |
if (e_cal_get_load_state (source) != E_CAL_LOAD_LOADED) |
|
|
| 273 |
continue; |
| 274 |
|
| 275 |
e_cal_set_default_timezone (source, client->priv->zone, NULL); |
277 |
e_cal_set_default_timezone (source, client->priv->zone, NULL); |
| 276 |
} |
278 |
} |
| 277 |
} |
279 |
} |
|
Lines 285-290
calendar_client_timezone_changed_cb (GCo
Link Here
|
| 285 |
calendar_client_set_timezone (client); |
287 |
calendar_client_set_timezone (client); |
| 286 |
} |
288 |
} |
| 287 |
|
289 |
|
|
|
290 |
static void |
| 291 |
cal_opened_cb (ECal *ecal, |
| 292 |
ECalendarStatus status, |
| 293 |
CalendarClientSource *cl_source) |
| 294 |
{ |
| 295 |
ECalSourceType s_type; |
| 296 |
CalendarClient *client = cl_source->client; |
| 297 |
|
| 298 |
s_type = e_cal_get_source_type (ecal); |
| 299 |
|
| 300 |
if (status == E_CALENDAR_STATUS_BUSY && |
| 301 |
e_cal_get_load_state (ecal) == E_CAL_LOAD_NOT_LOADED) |
| 302 |
{ |
| 303 |
e_cal_open_async (ecal, FALSE); |
| 304 |
return; |
| 305 |
} |
| 306 |
|
| 307 |
g_signal_handlers_disconnect_by_func (ecal, cal_opened_cb, cl_source); |
| 308 |
|
| 309 |
if (status != E_CALENDAR_STATUS_OK) |
| 310 |
{ |
| 311 |
if (s_type == E_CAL_SOURCE_TYPE_EVENT) |
| 312 |
client->priv->appointment_sources = g_slist_remove (client->priv->appointment_sources, |
| 313 |
cl_source); |
| 314 |
else |
| 315 |
client->priv->task_sources = g_slist_remove (client->priv->task_sources, |
| 316 |
cl_source); |
| 317 |
|
| 318 |
calendar_client_source_finalize (cl_source); |
| 319 |
g_free (cl_source); |
| 320 |
|
| 321 |
return; |
| 322 |
} |
| 323 |
|
| 324 |
if (s_type == E_CAL_SOURCE_TYPE_EVENT) |
| 325 |
calendar_client_update_appointments (client); |
| 326 |
else |
| 327 |
calendar_client_update_tasks (client); |
| 328 |
} |
| 329 |
|
| 330 |
static void |
| 331 |
load_calendars (CalendarClient *client, |
| 332 |
CalendarEventType type) |
| 333 |
{ |
| 334 |
GSList *l, *clients; |
| 335 |
|
| 336 |
switch (type) |
| 337 |
{ |
| 338 |
case CALENDAR_EVENT_APPOINTMENT: |
| 339 |
clients = client->priv->appointment_sources; |
| 340 |
break; |
| 341 |
case CALENDAR_EVENT_TASK: |
| 342 |
clients = client->priv->task_sources; |
| 343 |
break; |
| 344 |
default: |
| 345 |
g_assert_not_reached (); |
| 346 |
} |
| 347 |
|
| 348 |
for (l = clients; l != NULL; l = l->next) |
| 349 |
{ |
| 350 |
ECal *ecal; |
| 351 |
CalendarClientSource *cl_source = l->data; |
| 352 |
|
| 353 |
ecal = cl_source->source; |
| 354 |
|
| 355 |
if (e_cal_get_load_state (ecal) == E_CAL_LOAD_LOADED) |
| 356 |
continue; |
| 357 |
|
| 358 |
g_signal_connect (G_OBJECT (ecal), "cal_opened", |
| 359 |
G_CALLBACK (cal_opened_cb), cl_source); |
| 360 |
e_cal_open_async (ecal, TRUE); |
| 361 |
} |
| 362 |
} |
| 288 |
|
363 |
|
| 289 |
static void |
364 |
static void |
| 290 |
calendar_client_init (CalendarClient *client) |
365 |
calendar_client_init (CalendarClient *client) |
|
Lines 294-299
calendar_client_init (CalendarClient *cl
Link Here
|
| 294 |
client->priv = CALENDAR_CLIENT_GET_PRIVATE (client); |
369 |
client->priv = CALENDAR_CLIENT_GET_PRIVATE (client); |
| 295 |
|
370 |
|
| 296 |
client->priv->calendar_sources = calendar_sources_get (); |
371 |
client->priv->calendar_sources = calendar_sources_get (); |
|
|
372 |
client->priv->gconf_client = gconf_client_get_default (); |
| 297 |
|
373 |
|
| 298 |
esources = calendar_sources_get_appointment_sources (client->priv->calendar_sources); |
374 |
esources = calendar_sources_get_appointment_sources (client->priv->calendar_sources); |
| 299 |
client->priv->appointment_sources = |
375 |
client->priv->appointment_sources = |
|
Lines 302-307
calendar_client_init (CalendarClient *cl
Link Here
|
| 302 |
esources = calendar_sources_get_task_sources (client->priv->calendar_sources); |
378 |
esources = calendar_sources_get_task_sources (client->priv->calendar_sources); |
| 303 |
client->priv->task_sources = |
379 |
client->priv->task_sources = |
| 304 |
calendar_client_update_sources_list (client, NULL, esources, signals [TASKS_CHANGED]); |
380 |
calendar_client_update_sources_list (client, NULL, esources, signals [TASKS_CHANGED]); |
|
|
381 |
|
| 382 |
/* set the timezone before loading the clients */ |
| 383 |
calendar_client_set_timezone (client); |
| 384 |
load_calendars (client, CALENDAR_EVENT_APPOINTMENT); |
| 385 |
load_calendars (client, CALENDAR_EVENT_TASK); |
| 305 |
|
386 |
|
| 306 |
g_signal_connect_swapped (client->priv->calendar_sources, |
387 |
g_signal_connect_swapped (client->priv->calendar_sources, |
| 307 |
"appointment-sources-changed", |
388 |
"appointment-sources-changed", |
|
Lines 312-325
calendar_client_init (CalendarClient *cl
Link Here
|
| 312 |
G_CALLBACK (calendar_client_task_sources_changed), |
393 |
G_CALLBACK (calendar_client_task_sources_changed), |
| 313 |
client); |
394 |
client); |
| 314 |
|
395 |
|
| 315 |
client->priv->gconf_client = gconf_client_get_default (); |
|
|
| 316 |
|
| 317 |
gconf_client_add_dir (client->priv->gconf_client, |
396 |
gconf_client_add_dir (client->priv->gconf_client, |
| 318 |
CALENDAR_CONFIG_PREFIX, |
397 |
CALENDAR_CONFIG_PREFIX, |
| 319 |
GCONF_CLIENT_PRELOAD_NONE, |
398 |
GCONF_CLIENT_PRELOAD_NONE, |
| 320 |
NULL); |
399 |
NULL); |
| 321 |
|
400 |
|
| 322 |
calendar_client_set_timezone (client); |
|
|
| 323 |
client->priv->zone_listener = gconf_client_notify_add (client->priv->gconf_client, |
401 |
client->priv->zone_listener = gconf_client_notify_add (client->priv->gconf_client, |
| 324 |
CALENDAR_CONFIG_TIMEZONE, |
402 |
CALENDAR_CONFIG_TIMEZONE, |
| 325 |
(GConfClientNotifyFunc) calendar_client_timezone_changed_cb, |
403 |
(GConfClientNotifyFunc) calendar_client_timezone_changed_cb, |
|
Lines 1497-1503
calendar_client_update_appointments (Cal
Link Here
|
| 1497 |
month_begin, month_end); |
1575 |
month_begin, month_end); |
| 1498 |
|
1576 |
|
| 1499 |
for (l = client->priv->appointment_sources; l; l = l->next) |
1577 |
for (l = client->priv->appointment_sources; l; l = l->next) |
| 1500 |
calendar_client_start_query (client, l->data, query); |
1578 |
{ |
|
|
1579 |
CalendarClientSource *cs = l->data; |
| 1580 |
|
| 1581 |
if (e_cal_get_load_state (cs->source) != E_CAL_LOAD_LOADED) |
| 1582 |
continue; |
| 1583 |
|
| 1584 |
calendar_client_start_query (client, cs, query); |
| 1585 |
} |
| 1501 |
|
1586 |
|
| 1502 |
g_free (month_begin); |
1587 |
g_free (month_begin); |
| 1503 |
g_free (month_end); |
1588 |
g_free (month_end); |
|
Lines 1557-1563
calendar_client_update_tasks (CalendarCl
Link Here
|
| 1557 |
#endif /* FIX_BROKEN_TASKS_QUERY */ |
1642 |
#endif /* FIX_BROKEN_TASKS_QUERY */ |
| 1558 |
|
1643 |
|
| 1559 |
for (l = client->priv->task_sources; l; l = l->next) |
1644 |
for (l = client->priv->task_sources; l; l = l->next) |
| 1560 |
calendar_client_start_query (client, l->data, query); |
1645 |
{ |
|
|
1646 |
CalendarClientSource *cs = l->data; |
| 1647 |
|
| 1648 |
if (e_cal_get_load_state (cs->source) != E_CAL_LOAD_LOADED) |
| 1649 |
continue; |
| 1650 |
|
| 1651 |
calendar_client_start_query (client, cs, query); |
| 1652 |
} |
| 1561 |
|
1653 |
|
| 1562 |
#ifdef FIX_BROKEN_TASKS_QUERY |
1654 |
#ifdef FIX_BROKEN_TASKS_QUERY |
| 1563 |
g_free (day_begin); |
1655 |
g_free (day_begin); |
|
Lines 1571-1578
calendar_client_source_finalize (Calenda
Link Here
|
| 1571 |
{ |
1663 |
{ |
| 1572 |
source->client = NULL; |
1664 |
source->client = NULL; |
| 1573 |
|
1665 |
|
| 1574 |
if (source->source) |
1666 |
if (source->source) { |
|
|
1667 |
g_signal_handlers_disconnect_by_func (source->source, |
| 1668 |
cal_opened_cb, source); |
| 1575 |
g_object_unref (source->source); |
1669 |
g_object_unref (source->source); |
|
|
1670 |
} |
| 1576 |
source->source = NULL; |
1671 |
source->source = NULL; |
| 1577 |
|
1672 |
|
| 1578 |
calendar_client_query_finalize (&source->completed_query); |
1673 |
calendar_client_query_finalize (&source->completed_query); |
|
Lines 1661-1666
calendar_client_appointment_sources_chan
Link Here
|
| 1661 |
esources, |
1756 |
esources, |
| 1662 |
signals [APPOINTMENTS_CHANGED]); |
1757 |
signals [APPOINTMENTS_CHANGED]); |
| 1663 |
|
1758 |
|
|
|
1759 |
load_calendars (client, CALENDAR_EVENT_APPOINTMENT); |
| 1664 |
calendar_client_update_appointments (client); |
1760 |
calendar_client_update_appointments (client); |
| 1665 |
} |
1761 |
} |
| 1666 |
|
1762 |
|
|
Lines 1679-1684
calendar_client_task_sources_changed (Ca
Link Here
|
| 1679 |
esources, |
1775 |
esources, |
| 1680 |
signals [TASKS_CHANGED]); |
1776 |
signals [TASKS_CHANGED]); |
| 1681 |
|
1777 |
|
|
|
1778 |
load_calendars (client, CALENDAR_EVENT_TASK); |
| 1682 |
calendar_client_update_tasks (client); |
1779 |
calendar_client_update_tasks (client); |
| 1683 |
} |
1780 |
} |
| 1684 |
|
1781 |
|