[california] Monitor and update calendar titles
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california] Monitor and update calendar titles
- Date: Fri, 4 Apr 2014 23:33:47 +0000 (UTC)
commit 4c65a56bc818fdf6cf4959ee09df8dd1a1657348
Author: Jim Nelson <jim yorba org>
Date: Fri Apr 4 15:35:26 2014 -0700
Monitor and update calendar titles
src/backing/backing-source.vala | 2 +-
src/backing/eds/backing-eds-calendar-source.vala | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/backing/backing-source.vala b/src/backing/backing-source.vala
index d985b93..80c9498 100644
--- a/src/backing/backing-source.vala
+++ b/src/backing/backing-source.vala
@@ -36,7 +36,7 @@ public abstract class Source : BaseObject {
/**
* A user-visible name for the { link Source}.
*/
- public string title { get; private set; }
+ public string title { get; set; }
/**
* Whether the { link Source} should be visible to the user.
diff --git a/src/backing/eds/backing-eds-calendar-source.vala
b/src/backing/eds/backing-eds-calendar-source.vala
index 0c9f9bb..a772325 100644
--- a/src/backing/eds/backing-eds-calendar-source.vala
+++ b/src/backing/eds/backing-eds-calendar-source.vala
@@ -27,10 +27,12 @@ internal class EdsCalendarSource : CalendarSource {
// use unidirectional bindings so source updates (writing) only occurs when changed from
// within the app
+ eds_source.bind_property("display-name", this, PROP_TITLE, BindingFlags.SYNC_CREATE);
eds_calendar.bind_property("selected", this, PROP_VISIBLE, BindingFlags.SYNC_CREATE);
eds_calendar.bind_property("color", this, PROP_COLOR, BindingFlags.SYNC_CREATE);
// 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);
}
@@ -39,6 +41,15 @@ internal class EdsCalendarSource : CalendarSource {
cancel_source_write();
}
+ private void on_title_changed() {
+ // on schedule write if something changed
+ if (eds_source.display_name == title)
+ return;
+
+ eds_source.display_name = title;
+ schedule_source_write("title=%s".printf(title));
+ }
+
private void on_visible_changed() {
// only schedule source writes if something actually changed
if (eds_calendar.selected == visible)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]