[california/wip/740088-invite] Send/don't send invite to guests
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/740088-invite] Send/don't send invite to guests
- Date: Thu, 20 Nov 2014 03:31:55 +0000 (UTC)
commit 2ecb55ae648b1bcb79260913a1b008aea0f953d1
Author: Jim Nelson <jim yorba org>
Date: Wed Nov 19 17:43:08 2014 -0800
Send/don't send invite to guests
src/component/component-person.vala | 15 ++++++++++++-
src/host/host-attendees-editor.vala | 40 +++++++++++++++++++++++++++++++---
2 files changed, 50 insertions(+), 5 deletions(-)
---
diff --git a/src/component/component-person.vala b/src/component/component-person.vala
index 5c92f68..6e56279 100644
--- a/src/component/component-person.vala
+++ b/src/component/component-person.vala
@@ -7,11 +7,15 @@
namespace California.Component {
/**
- * An immutable representation of an iCalendar CAL-ADDRESS (ATTENDEE, ORGANIZER, etc.)
+ * A (mostly) immutable representation of an iCalendar CAL-ADDRESS (ATTENDEE, ORGANIZER, etc.)
*
* Person is not guaranteed to represent an individual per se, but it always represents an RFC822
* mailbox (i.e. email address), which may be a group list address, multiuser mailbox, etc.
*
+ * Person is mostly immutable in the sense that the { link send_invite} property is mutable, but
+ * this parameter is application-specific and not represented in the iCalendar component. Notably,
+ * this property is not used for any comparison operations.
+ *
* For equality purposes, only the { link mailto} is used. All other parameters are ignored when
* comparing Persons for equality.
*
@@ -22,6 +26,8 @@ namespace California.Component {
*/
public class Person : BaseObject, Gee.Hashable<Person>, Gee.Comparable<Person> {
+ public const string PROP_SEND_INVITE = "send-invite";
+
/**
* The relationship of this { link Person} to the { link Instance}.
*/
@@ -82,6 +88,13 @@ public class Person : BaseObject, Gee.Hashable<Person>, Gee.Comparable<Person> {
*/
public string full_mailbox { get; private set; }
+ /**
+ * A mutable property indicating an invitation should be sent to the { link Person}.
+ *
+ * In general, invites are not sent to organizers.
+ */
+ public bool send_invite { get; set; default = true; }
+
private Gee.HashSet<string> parameters = new Gee.HashSet<string>(String.ci_hash, String.ci_equal);
/**
diff --git a/src/host/host-attendees-editor.vala b/src/host/host-attendees-editor.vala
index f52e827..3db3fe6 100644
--- a/src/host/host-attendees-editor.vala
+++ b/src/host/host-attendees-editor.vala
@@ -10,6 +10,41 @@ namespace California.Host {
public class AttendeesEditor : Gtk.Box, Toolkit.Card {
public const string ID = "CaliforniaHostAttendeesEditor";
+ private class AttendeePresentation : Gtk.Box {
+ public Component.Person attendee { get; private set; }
+
+ private Gtk.Button invite_button = new Gtk.Button();
+
+ public AttendeePresentation(Component.Person attendee) {
+ Object (orientation: Gtk.Orientation.HORIZONTAL, spacing: 4);
+
+ this.attendee = attendee;
+
+ invite_button.relief = Gtk.ReliefStyle.NONE;
+ invite_button.clicked.connect(on_invite_clicked);
+ update_invite_button();
+
+ Gtk.Label email_label = new Gtk.Label(attendee.full_mailbox);
+ email_label.xalign = 0.0f;
+
+ add(invite_button);
+ add(email_label);
+ }
+
+ private void on_invite_clicked() {
+ attendee.send_invite = !attendee.send_invite;
+ update_invite_button();
+ }
+
+ private void update_invite_button() {
+ invite_button.image = new Gtk.Image.from_icon_name(
+ attendee.rsvp ? "mail-unread-symbolic" : "mail-read-symbolic",
+ Gtk.IconSize.BUTTON);
+
+ invite_button.tooltip_text = attendee.send_invite ? _("Send invite") : _("Don't send invite");
+ }
+ }
+
public string card_id { get { return ID; } }
public string? title { get { return null; } }
@@ -169,10 +204,7 @@ public class AttendeesEditor : Gtk.Box, Toolkit.Card {
}
private Gtk.Widget model_presentation(Component.Person person) {
- Gtk.Label label = new Gtk.Label(person.full_mailbox);
- label.xalign = 0.0f;
-
- return label;
+ return new AttendeePresentation(person);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]