manager: Toggle data model sources when changed
Instead of other classes needing to manually set and unset whether a source is registered in the data model, we can now simply call GcalCalendar.set_visible() and have the model be updated for us.
This commit is contained in:
+21
-2
@@ -182,8 +182,27 @@ source_changed (GcalManager *self,
|
|||||||
|
|
||||||
calendar = g_hash_table_lookup (self->clients, source);
|
calendar = g_hash_table_lookup (self->clients, source);
|
||||||
|
|
||||||
if (calendar)
|
if (!calendar)
|
||||||
g_signal_emit (self, signals[CALENDAR_CHANGED], 0, calendar);
|
GCAL_RETURN ();
|
||||||
|
|
||||||
|
if (gcal_calendar_get_visible (calendar))
|
||||||
|
{
|
||||||
|
ECalClient *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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const gchar *id = gcal_calendar_get_id (calendar);
|
||||||
|
|
||||||
|
e_cal_data_model_remove_client (self->e_data_model, id);
|
||||||
|
if (self->shell_search_data_model)
|
||||||
|
e_cal_data_model_remove_client (self->shell_search_data_model, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_emit (self, signals[CALENDAR_CHANGED], 0, calendar);
|
||||||
|
|
||||||
GCAL_EXIT;
|
GCAL_EXIT;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user