static void calendar_sources_registry_source_changed_cb (ESourceRegistry *registry, ESource *source, CalendarSources *sources) { if (e_source_has_extension (source, E_SOURCE_EXTENSION_CALENDAR)) { CalendarSourceData *source_data; ESourceSelectable *extension; gboolean have_client; gboolean show_source; source_data = &sources->priv->appointment_sources; extension = e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR); have_client = (g_hash_table_lookup (source_data->clients, source) != NULL); show_source = e_source_get_enabled (source) && e_source_selectable_get_selected (extension); if (!show_source && have_client) { g_hash_table_remove (source_data->clients, source); g_signal_emit (sources, source_data->changed_signal, 0); } if (show_source && !have_client) { create_client_for_source (source, source_data->source_type, source_data); g_signal_emit (sources, source_data->changed_signal, 0); } } if (e_source_has_extension (source, E_SOURCE_EXTENSION_TASK_LIST)) { CalendarSourceData *source_data; ESourceSelectable *extension; gboolean have_client; gboolean show_source; source_data = &sources->priv->task_sources; extension = e_source_get_extension (source, E_SOURCE_EXTENSION_TASK_LIST); have_client = (g_hash_table_lookup (source_data->clients, source) != NULL); show_source = e_source_get_enabled (source) && e_source_selectable_get_selected (extension); if (!show_source && have_client) { g_hash_table_remove (source_data->clients, source); g_signal_emit (sources, source_data->changed_signal, 0); } if (show_source && !have_client) { create_client_for_source (source, source_data->source_type, source_data); g_signal_emit (sources, source_data->changed_signal, 0); } } }
static void calendar_sources_load_esource_list (ESourceRegistry *registry, CalendarSourceData *source_data) { GList *list, *link; const gchar *extension_name; switch (source_data->source_type) { case E_CAL_SOURCE_TYPE_EVENT: extension_name = E_SOURCE_EXTENSION_CALENDAR; break; case E_CAL_SOURCE_TYPE_TODO: extension_name = E_SOURCE_EXTENSION_TASK_LIST; break; case E_CAL_SOURCE_TYPE_JOURNAL: case E_CAL_SOURCE_TYPE_LAST: default: g_return_if_reached (); } list = e_source_registry_list_sources (registry, extension_name); for (link = list; link != NULL; link = g_list_next (link)) { ESource *source = E_SOURCE (link->data); ESourceSelectable *extension; gboolean show_source; extension = e_source_get_extension (source, extension_name); show_source = e_source_get_enabled (source) && e_source_selectable_get_selected (extension); if (show_source) create_client_for_source (source, source_data->source_type, source_data); } debug_dump_ecal_list (source_data->clients); g_list_free_full (list, g_object_unref); }