Merge lp:~gero-bare/maya/maya-exclude-nonwritable-calendars-in-enventdialog into lp:~elementary-apps/maya/trunk

Proposed by Gero.Bare
Status: Merged
Approved by: Corentin Noël
Approved revision: 686
Merged at revision: 693
Proposed branch: lp:~gero-bare/maya/maya-exclude-nonwritable-calendars-in-enventdialog
Merge into: lp:~elementary-apps/maya/trunk
Diff against target: 55 lines (+19/-4)
2 files modified
core/Model/CalendarModel.vala (+15/-1)
src/Widgets/CalendarButton.vala (+4/-3)
To merge this branch: bzr merge lp:~gero-bare/maya/maya-exclude-nonwritable-calendars-in-enventdialog
Reviewer Review Type Date Requested Status
Corentin Noël code Approve
Review via email: mp+241876@code.launchpad.net

This proposal supersedes a proposal from 2014-11-15.

Commit message

Exclude read-only calendars from the eventdialog.

Description of the change

Introduced a new check. If the calendar is not writable is excluded from being added in the EventDialog.

This in the case of for example Birthday and Anniversaries calendar which is not writable thus doesn't make sense add to EventDialog.

see the comment bellow over this check if (src.writable == true && src.enabled == true && calmodel.calclient_is_readonly(src))

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote : Posted in a previous version of this proposal

Here are some comments and required fixes about this merge (see inline comments)

review: Needs Fixing (code)
Revision history for this message
Corentin Noël (tintou) wrote :

Working fine now.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core/Model/CalendarModel.vala'
2--- core/Model/CalendarModel.vala 2014-11-04 22:32:52 +0000
3+++ core/Model/CalendarModel.vala 2014-11-15 16:36:49 +0000
4@@ -135,6 +135,20 @@
5 add_event_async.begin (source, event);
6 }
7
8+ public bool calclient_is_readonly (E.Source source) {
9+ E.CalClient client;
10+ lock (source_client) {
11+ client = source_client.get (source.dup_uid ());
12+ }
13+ if (client != null) {
14+ return client.is_readonly ();
15+ } else {
16+ critical ("No calendar client was found");
17+ }
18+
19+ return true;
20+ }
21+
22 private async void add_event_async (E.Source source, E.CalComponent event) {
23 SourceFunc callback = add_event_async.callback;
24 Threads.add (() => {
25@@ -451,4 +465,4 @@
26
27 events_removed (source, removed_events.read_only_view);
28 }
29-}
30\ No newline at end of file
31+}
32
33=== modified file 'src/Widgets/CalendarButton.vala'
34--- src/Widgets/CalendarButton.vala 2014-11-04 22:05:58 +0000
35+++ src/Widgets/CalendarButton.vala 2014-11-15 16:36:49 +0000
36@@ -40,9 +40,10 @@
37 public CalendarButton () {
38 set_alignment (0, 0.5f);
39 sources = new GLib.List<E.Source> ();
40- var registry = Maya.Model.CalendarModel.get_default ().registry;
41+ var calmodel = Model.CalendarModel.get_default ();
42+ var registry = calmodel.registry;
43 foreach (var src in registry.list_sources (E.SOURCE_EXTENSION_CALENDAR)) {
44- if (src.writable == true && src.enabled == true) {
45+ if (src.writable == true && src.enabled == true && calmodel.calclient_is_readonly (src) == false) {
46 sources.append (src);
47 }
48 }
49@@ -184,4 +185,4 @@
50 calendar_color_label.override_background_color (Gtk.StateFlags.NORMAL, color);
51 }
52 }
53-}
54\ No newline at end of file
55+}

Subscribers

People subscribed via source and target branches