quick-add-popover: only show writable calendars
There is no reason to display read-only calendars, since the user can't add any events on it. Fix that by only showing writable calendars. https://bugzilla.gnome.org/show_bug.cgi?id=768324
This commit is contained in:
@@ -270,6 +270,10 @@ on_source_added (GcalManager *manager,
|
|||||||
ESource *default_source;
|
ESource *default_source;
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
|
|
||||||
|
/* Since we can't add on read-only calendars, lets not show them at all */
|
||||||
|
if (!gcal_manager_is_client_writable (manager, source))
|
||||||
|
return;
|
||||||
|
|
||||||
default_source = gcal_manager_get_default_source (manager);
|
default_source = gcal_manager_get_default_source (manager);
|
||||||
row = create_row_for_source (manager, source, gcal_manager_is_client_writable (manager, source));
|
row = create_row_for_source (manager, source, gcal_manager_is_client_writable (manager, source));
|
||||||
|
|
||||||
@@ -292,6 +296,23 @@ on_source_changed (GcalManager *manager,
|
|||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
|
||||||
row = get_row_for_source (self, source);
|
row = get_row_for_source (self, source);
|
||||||
|
|
||||||
|
/* If the calendar changed from/to read-only, we add or remove it here */
|
||||||
|
if (!gcal_manager_is_client_writable (self->manager, source))
|
||||||
|
{
|
||||||
|
gtk_container_remove (GTK_CONTAINER (self->calendars_listbox), row);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!row)
|
||||||
|
{
|
||||||
|
on_source_added (self->manager,
|
||||||
|
source,
|
||||||
|
gcal_manager_source_enabled (self->manager, source),
|
||||||
|
self);
|
||||||
|
|
||||||
|
row = get_row_for_source (self, source);
|
||||||
|
}
|
||||||
|
|
||||||
color_icon = g_object_get_data (G_OBJECT (row), "color-icon");
|
color_icon = g_object_get_data (G_OBJECT (row), "color-icon");
|
||||||
name_label = g_object_get_data (G_OBJECT (row), "name-label");
|
name_label = g_object_get_data (G_OBJECT (row), "name-label");
|
||||||
|
|
||||||
@@ -327,6 +348,9 @@ on_source_removed (GcalManager *manager,
|
|||||||
|
|
||||||
row = get_row_for_source (self, source);
|
row = get_row_for_source (self, source);
|
||||||
|
|
||||||
|
if (!row)
|
||||||
|
return;
|
||||||
|
|
||||||
gtk_container_remove (GTK_CONTAINER (self->calendars_listbox), row);
|
gtk_container_remove (GTK_CONTAINER (self->calendars_listbox), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user