[california/wip/731543-attendees] Remove some dead-weight and built-up gunk
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/731543-attendees] Remove some dead-weight and built-up gunk
- Date: Thu, 6 Nov 2014 00:48:06 +0000 (UTC)
commit 5cda7fd4030a91718332b59cd799c1b28bdad349
Author: Jim Nelson <jim yorba org>
Date: Wed Nov 5 16:47:52 2014 -0800
Remove some dead-weight and built-up gunk
src/backing/backing-source.vala | 8 +----
src/backing/eds/backing-eds-calendar-source.vala | 14 -------
src/component/component.vala | 2 +
src/host/host-show-event.vala | 42 +++-------------------
src/host/host.vala | 5 ---
5 files changed, 8 insertions(+), 63 deletions(-)
---
diff --git a/src/backing/backing-source.vala b/src/backing/backing-source.vala
index 9269e0e..26a889f 100644
--- a/src/backing/backing-source.vala
+++ b/src/backing/backing-source.vala
@@ -22,7 +22,6 @@ public abstract class Source : BaseObject, Gee.Comparable<Source> {
public const string PROP_VISIBLE = "visible";
public const string PROP_READONLY = "read-only";
public const string PROP_COLOR = "color";
- public const string PROP_OWNER_MAILBOX = "owner-mailbox";
/**
* A unique identifier for the { link Source}.
@@ -53,11 +52,6 @@ public abstract class Source : BaseObject, Gee.Comparable<Source> {
public string title { get; set; }
/**
- * The owner of this calendar's mailbox (email address), i.e. "bob example com".
- */
- public string? owner_mailbox { get; protected set; default = null; }
-
- /**
* Whether the { link Source} should be visible to the user.
*
* The caller should monitor this setting to decide whether or not to display the Source's
@@ -157,7 +151,7 @@ public abstract class Source : BaseObject, Gee.Comparable<Source> {
}
public override string to_string() {
- return !String.is_empty(owner_mailbox) ? "%s (%s)".printf(title, owner_mailbox) : title;
+ return title;
}
}
diff --git a/src/backing/eds/backing-eds-calendar-source.vala
b/src/backing/eds/backing-eds-calendar-source.vala
index 9f6407f..d3219fb 100644
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@ -171,20 +171,6 @@ internal class EdsCalendarSource : CalendarSource {
client.notify["readonly"].connect(() => {
debug("%s readonly: %s", to_string(), client.readonly.to_string());
});
-
- // TODO: This does not work for some reason, although it appears to work in Evolution ...
- // this will be important for determining if the ORGANIZER is the calendar owner, i.e. user
- try {
- string prop_value;
- if (yield client.get_backend_property("cal-email-address", cancellable, out prop_value))
- owner_mailbox = !String.is_empty(prop_value) ? prop_value : null;
- else
- debug("Unable to fetch %s email address", to_string());
- } catch (Error err) {
- client = null;
-
- throw err;
- }
}
// Invoked by EdsStore when closing and dropping all its refs
diff --git a/src/component/component.vala b/src/component/component.vala
index 7327f2d..09a601b 100644
--- a/src/component/component.vala
+++ b/src/component/component.vala
@@ -63,6 +63,7 @@ public void init() throws Error {
// external unit init
Collection.init();
Calendar.init();
+ Util.init();
ICAL_PRODID = "-//Yorba Foundation//NONSGML California Calendar %s//EN".printf(Application.VERSION);
@@ -208,6 +209,7 @@ public void terminate() {
ICAL_PRODID = null;
+ Util.terminate();
Calendar.terminate();
Collection.terminate();
}
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index d19931a..2c76355 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -17,8 +17,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
private const string FAMILY_NORMAL = "normal";
private const string FAMILY_REMOVING = "removing";
- private const string DATA_TEXT = "california.text";
-
public string card_id { get { return ID; } }
public string? title { get { return null; } }
@@ -133,14 +131,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
rotating_button_box.vexpand = true;
rotating_button_box.valign = Gtk.Align.END;
rotating_button_box_container.add(rotating_button_box);
-
- // use this to setup tooltips for text labels that have been ellipsized ... this only works
- // for GtkLabel's initialized with set_label(), so beware
- summary_text.draw.connect(on_label_drawn);
- when_text.draw.connect(on_label_drawn);
- where_text.draw.connect(on_label_drawn);
- attendees_text.draw.connect(on_label_drawn);
- organizers_text.draw.connect(on_label_drawn);
}
~ShowEvent() {
@@ -177,22 +167,17 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
set_label(when_label, when_text, event.get_event_time_pretty_string(Calendar.Date.PrettyFlag.NONE,
Calendar.ExactTimeSpan.PrettyFlag.NONE, Calendar.Timezone.local));
- // organizers and attendees
- // remove organizers from attendee list
- Gee.Set<Component.Person> attendee_list = traverse<Component.Person>(event.attendees)
- .filter(person => !event.organizers.contains(person))
- .to_hash_set();
-
- // convert to sorted LF-delimited strings
+ // organizers as a sorted LF-delimited string
string organizers = traverse<Component.Person>(event.organizers)
.sort()
.to_string(stringify_person) ?? "";
+ set_label(organizers_label, organizers_text, organizers);
- string attendees = traverse<Component.Person>(attendee_list)
+ // attendees as a sort LF-delimited string w/ organizers removed
+ string attendees = traverse<Component.Person>(event.attendees)
+ .filter(person => !event.organizers.contains(person))
.sort()
.to_string(stringify_person) ?? "";
-
- set_label(organizers_label, organizers_text, organizers);
set_label(attendees_label, attendees_text, attendees);
// calendar
@@ -245,15 +230,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
private void set_label(Gtk.Label? label, Gtk.Label text, string? str) {
if (!String.is_empty(str)) {
text.label = str;
-
- // build tooltip, each email address on a separate line, used if ellipsized (see
- // on_label_drawn)
- string tooltip = from_array<string>(str.split(EMAIL_SEPARATOR))
- .transform(token => token.strip())
- .filter(token => !String.is_empty(token))
- .to_string((token, is_first, is_last) => { return is_last ? token : token + "\n"; });
-
- text.set_data(DATA_TEXT, tooltip);
} else {
text.visible = false;
text.no_show_all = true;
@@ -266,14 +242,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
}
}
- private bool on_label_drawn(Gtk.Widget widget, Cairo.Context ctx) {
- // if ellipsized, add a tooltip, otherwise remove it
- Gtk.Label label = (Gtk.Label) widget;
- label.set_tooltip_text(label.get_layout().is_ellipsized() ? label.get_data<string>(DATA_TEXT) : "");
-
- return false;
- }
-
private void on_remove_button_clicked() {
// If recurring (and so this is a generated instance of the VEVENT, not the VEVENT itself),
// reveal additional remove buttons
diff --git a/src/host/host.vala b/src/host/host.vala
index 56cdcc2..0e5d330 100644
--- a/src/host/host.vala
+++ b/src/host/host.vala
@@ -14,9 +14,6 @@ namespace California.Host {
private int init_count = 0;
-// A common separator for email addresses, i.e. "alice example com, bob example com"
-private const string EMAIL_SEPARATOR = _(", ");
-
public void init() throws Error {
if (!Unit.do_init(ref init_count))
return;
@@ -27,14 +24,12 @@ public void init() throws Error {
Calendar.init();
Toolkit.init();
Component.init();
- Util.init();
}
public void terminate() {
if (!Unit.do_terminate(ref init_count))
return;
- Util.terminate();
Component.terminate();
View.terminate();
Backing.terminate();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]