manager: Remove gcal_manager_enable/disable_source()

This is now managed by GcalCalendar itself.
This commit is contained in:
Georges Basile Stavracas Neto
2019-05-04 12:05:39 -03:00
parent 560419ed8a
commit e800bb2476
4 changed files with 24 additions and 112 deletions
-85
View File
@@ -1087,91 +1087,6 @@ gcal_manager_add_source (GcalManager *self,
GCAL_RETURN (e_source_dup_uid (source));
}
/**
* gcal_manager_enable_source:
* @self: a #GcalManager
* @source: the target ESource
*
* Enable the given ESource.
*/
void
gcal_manager_enable_source (GcalManager *self,
ESource *source)
{
ESourceSelectable *selectable;
GcalCalendar *calendar;
ECalClient *client;
GCAL_ENTRY;
g_return_if_fail (GCAL_IS_MANAGER (self));
g_return_if_fail (E_IS_SOURCE (source));
calendar = g_hash_table_lookup (self->clients, source);
selectable = e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR);
if (is_source_enabled (source))
{
g_debug ("Source '%s' already enabled", e_source_get_uid (source));
GCAL_EXIT;
return;
}
client = gcal_calendar_get_client (calendar);
e_cal_data_model_add_client (self->e_data_model, client);
if (self->shell_search_data_model)
e_cal_data_model_add_client (self->shell_search_data_model, client);
/* Save the source */
e_source_selectable_set_selected (selectable, TRUE);
gcal_manager_save_source (self, source);
GCAL_EXIT;
}
/**
* gcal_manager_disable_source:
* @self: a #GcalManager
* @source: the target ESource
*
* Disable the given ESource.
*/
void
gcal_manager_disable_source (GcalManager *self,
ESource *source)
{
ESourceSelectable *selectable;
const gchar *source_uid;
GCAL_ENTRY;
g_return_if_fail (GCAL_IS_MANAGER (self));
g_return_if_fail (E_IS_SOURCE (source));
selectable = e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR);
if (!is_source_enabled (source))
{
g_debug ("Source '%s' already disabled", e_source_get_uid (source));
GCAL_EXIT;
return;
}
source_uid = e_source_get_uid (source);
e_cal_data_model_remove_client (self->e_data_model, source_uid);
if (self->shell_search_data_model != NULL)
e_cal_data_model_remove_client (self->shell_search_data_model, source_uid);
/* Save the source */
e_source_selectable_set_selected (selectable, FALSE);
gcal_manager_save_source (self, source);
GCAL_EXIT;
}
/**
* gcal_manager_save_source:
* @self: a #GcalManager