[california/wip/740706-server-invites: 1/2] Support "server sends invitations" from EDS
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/740706-server-invites: 1/2] Support "server sends invitations" from EDS
- Date: Wed, 26 Nov 2014 00:37:41 +0000 (UTC)
commit c20a62a331de8b75dba9062a222b5ca14a02d832
Author: Jim Nelson <jim yorba org>
Date: Tue Nov 25 16:29:56 2014 -0800
Support "server sends invitations" from EDS
src/backing/backing-calendar-source.vala | 9 +++++
src/backing/eds/backing-eds-calendar-source.vala | 24 ++++++++++++-
src/manager/manager-calendar-list-item.vala | 26 ++++++++++++++
src/rc/manager-calendar-list-item.ui | 40 +++++++++++++--------
4 files changed, 82 insertions(+), 17 deletions(-)
---
diff --git a/src/backing/backing-calendar-source.vala b/src/backing/backing-calendar-source.vala
index bc27ed0..42adcbf 100644
--- a/src/backing/backing-calendar-source.vala
+++ b/src/backing/backing-calendar-source.vala
@@ -19,6 +19,7 @@ namespace California.Backing {
public abstract class CalendarSource : Source {
public const string PROP_IS_DEFAULT = "is-default";
+ public const string PROP_SERVER_SENDS_INVITES = "server-sends-invites";
/**
* The affected range of a removal operation.
@@ -49,6 +50,14 @@ public abstract class CalendarSource : Source {
*/
public bool is_default { get; private set; default = false; }
+ /**
+ * Indicates this { link CalendarSource}'s server will send invites (and all ITIP notifications)
+ * itself.
+ *
+ * If turned off, group event notifications must be performed by the client.
+ */
+ public bool server_sends_invites { get; set; default = false; }
+
protected CalendarSource(Store store, string id, string title) {
base (store, id, title);
diff --git a/src/backing/eds/backing-eds-calendar-source.vala
b/src/backing/eds/backing-eds-calendar-source.vala
index 9e30a2d..ee6a572 100644
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@ -16,6 +16,7 @@ internal class EdsCalendarSource : CalendarSource {
internal E.Source eds_source;
internal E.SourceCalendar eds_calendar;
+ private E.SourceWebdav? webdav;
private E.CalClient? client = null;
private Scheduled? scheduled_source_write = null;
private Scheduled? scheduled_source_read = null;
@@ -27,6 +28,7 @@ internal class EdsCalendarSource : CalendarSource {
this.eds_source = eds_source;
this.eds_calendar = eds_calendar;
+ webdav = eds_source.get_extension(E.SOURCE_EXTENSION_WEBDAV_BACKEND) as E.SourceWebdav;
// read-only until opened, when state can be determined from client
read_only = true;
@@ -37,6 +39,8 @@ internal class EdsCalendarSource : CalendarSource {
eds_source.notify["display-name"].connect(on_schedule_source_property_read);
eds_calendar.notify["selected"].connect(on_schedule_source_property_read);
eds_calendar.notify["color"].connect(on_schedule_source_property_read);
+ if (webdav != null)
+ webdav.notify["calendar-auto-schedule"].connect(on_schedule_source_property_read);
// ...and initialize
title = eds_source.display_name;
@@ -44,11 +48,14 @@ internal class EdsCalendarSource : CalendarSource {
color = eds_calendar.color;
is_local = eds_calendar.backend_name == "local";
is_removable = eds_source.removable;
+ if (webdav != null)
+ server_sends_invites = webdav.calendar_auto_schedule;
// when changed within the app, need to write it back out
notify[PROP_TITLE].connect(on_title_changed);
notify[PROP_VISIBLE].connect(on_visible_changed);
notify[PROP_COLOR].connect(on_color_changed);
+ notify[PROP_SERVER_SENDS_INVITES].connect(on_server_sends_invites_changed);
// see note in open_async() about setting the "mailbox" property
}
@@ -64,6 +71,8 @@ internal class EdsCalendarSource : CalendarSource {
eds_source.notify["display-name"].disconnect(on_schedule_source_property_read);
eds_calendar.notify["selected"].disconnect(on_schedule_source_property_read);
eds_calendar.notify["color"].disconnect(on_schedule_source_property_read);
+ if (webdav != null)
+ webdav.notify["calendar-auto-schedule"].disconnect(on_schedule_source_property_read);
// although disconnected, for safety cancel under lock
lock (dirty_read_properties) {
@@ -105,6 +114,11 @@ internal class EdsCalendarSource : CalendarSource {
case "color":
color = eds_calendar.color;
break;
+
+ case "calendar-auto-schedule":
+ if (webdav != null)
+ server_sends_invites = webdav.calendar_auto_schedule;
+ break;
}
}
}
@@ -136,6 +150,14 @@ internal class EdsCalendarSource : CalendarSource {
schedule_source_write("color=%s".printf(color));
}
+ private void on_server_sends_invites_changed() {
+ if (webdav == null || webdav.calendar_auto_schedule == server_sends_invites)
+ return;
+
+ webdav.calendar_auto_schedule = server_sends_invites;
+ schedule_source_write("server_sends_invites=%s".printf(server_sends_invites.to_string()));
+ }
+
private void schedule_source_write(string reason) {
debug("Scheduling update of %s due to %s...", to_string(), reason);
@@ -165,8 +187,6 @@ internal class EdsCalendarSource : CalendarSource {
}
private string? get_webdav_email() {
- E.SourceWebdav? webdav = eds_source.get_extension(E.SOURCE_EXTENSION_WEBDAV_BACKEND)
- as E.SourceWebdav;
if (webdav == null)
return null;
diff --git a/src/manager/manager-calendar-list-item.vala b/src/manager/manager-calendar-list-item.vala
index e4a8ffa..a34f580 100644
--- a/src/manager/manager-calendar-list-item.vala
+++ b/src/manager/manager-calendar-list-item.vala
@@ -22,6 +22,9 @@ internal class CalendarListItem : Gtk.Grid, Toolkit.MutableWidget {
public bool is_selected { get; set; default = false; }
[GtkChild]
+ private Gtk.Image server_sends_invites_icon;
+
+ [GtkChild]
private Gtk.Image readonly_icon;
[GtkChild]
@@ -62,6 +65,10 @@ internal class CalendarListItem : Gtk.Grid, Toolkit.MutableWidget {
BindingFlags.SYNC_CREATE, xform_default_to_icon_name);
source.bind_property(Backing.CalendarSource.PROP_IS_DEFAULT, default_icon, "tooltip-text",
BindingFlags.SYNC_CREATE, xform_default_to_tooltip_text);
+ source.bind_property(Backing.CalendarSource.PROP_SERVER_SENDS_INVITES, server_sends_invites_icon,
+ "icon-name", BindingFlags.SYNC_CREATE, xform_sends_invites_to_icon_name);
+ source.bind_property(Backing.CalendarSource.PROP_SERVER_SENDS_INVITES, server_sends_invites_icon,
+ "tooltip-text", BindingFlags.SYNC_CREATE, xform_sends_invites_to_tooltip_text);
title_eventbox.button_release_event.connect(on_title_button_release);
}
@@ -99,6 +106,20 @@ internal class CalendarListItem : Gtk.Grid, Toolkit.MutableWidget {
return true;
}
+ private bool xform_sends_invites_to_icon_name(Binding binding, Value source_value, ref Value
target_value) {
+ target_value = source.server_sends_invites ? "mail-unread-symbolic" : "";
+
+ return true;
+ }
+
+ private bool xform_sends_invites_to_tooltip_text(Binding binding, Value source_value, ref Value
target_value) {
+ target_value = source.server_sends_invites
+ ? _("Server sends event invitations")
+ : _("Server does not send event invitations");
+
+ return true;
+ }
+
public override bool query_tooltip(int x, int y, bool keyboard_mode, Gtk.Tooltip tooltip) {
// no tooltip if text is entirely shown
if (!title_label.get_layout().is_ellipsized())
@@ -178,6 +199,11 @@ internal class CalendarListItem : Gtk.Grid, Toolkit.MutableWidget {
message("Unable to set default calendar to %s: %s", source.title, err.message);
}
}
+
+ [GtkCallback]
+ private void on_server_sends_invites_button_clicked() {
+ source.server_sends_invites = !source.server_sends_invites;
+ }
}
}
diff --git a/src/rc/manager-calendar-list-item.ui b/src/rc/manager-calendar-list-item.ui
index 2bd3215..6fe18f1 100644
--- a/src/rc/manager-calendar-list-item.ui
+++ b/src/rc/manager-calendar-list-item.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<template class="CaliforniaManagerCalendarListItem" parent="GtkGrid">
@@ -28,10 +28,8 @@
</child>
</object>
<packing>
- <property name="left_attach">4</property>
+ <property name="left_attach">5</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -45,10 +43,8 @@
<property name="title" translatable="yes">Calendar color</property>
</object>
<packing>
- <property name="left_attach">3</property>
+ <property name="left_attach">4</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -66,10 +62,8 @@
</child>
</object>
<packing>
- <property name="left_attach">2</property>
+ <property name="left_attach">3</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -83,10 +77,8 @@
<property name="icon_size">1</property>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">2</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -107,8 +99,26 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="server_sends_invites_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <signal name="clicked" handler="on_server_sends_invites_button_clicked"
object="CaliforniaManagerCalendarListItem" swapped="no"/>
+ <child>
+ <object class="GtkImage" id="server_sends_invites_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pixel_size">16</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
</template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]