[gnome-calendar] quick-add-popover: only show writable calendars
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] quick-add-popover: only show writable calendars
- Date: Wed, 28 Sep 2016 00:31:21 +0000 (UTC)
commit a76d40d2900085ac97baf0f100c3bd535bcc4f84
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Sep 27 21:30:43 2016 -0300
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
src/gcal-quick-add-popover.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-quick-add-popover.c b/src/gcal-quick-add-popover.c
index 7855330..162a5df 100644
--- a/src/gcal-quick-add-popover.c
+++ b/src/gcal-quick-add-popover.c
@@ -270,6 +270,10 @@ on_source_added (GcalManager *manager,
ESource *default_source;
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);
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;
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");
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);
+ if (!row)
+ return;
+
gtk_container_remove (GTK_CONTAINER (self->calendars_listbox), row);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]