Merge lp://staging/~tintou/maya/calendar-model-static into lp://staging/~elementary-apps/maya/trunk

Proposed by Corentin Noël
Status: Merged
Merged at revision: 540
Proposed branch: lp://staging/~tintou/maya/calendar-model-static
Merge into: lp://staging/~elementary-apps/maya/trunk
Diff against target: 610 lines (+96/-118)
12 files modified
plugins/CalDAV/CalDAVBackend.vala (+1/-1)
plugins/Google/GoogleBackend.vala (+1/-1)
src/Application.vala (+12/-71)
src/Model/CalendarModel.vala (+47/-4)
src/Utils.vala (+1/-1)
src/View/Grid/CalendarView.vala (+9/-12)
src/View/Grid/WeekLabels.vala (+3/-3)
src/View/MayaToolbar.vala (+8/-5)
src/View/Sidebar/AgendaView.vala (+6/-5)
src/View/Sidebar/Sidebar.vala (+2/-3)
src/View/SourceItem.vala (+3/-4)
src/View/SourceSelector.vala (+3/-8)
To merge this branch: bzr merge lp://staging/~tintou/maya/calendar-model-static
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+211171@code.staging.launchpad.net

Description of the change

CalendarModel is now using a static accessor:
 * Removed it from some class creation methods
 * Found some useless functions to remove (that simplify the code)

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

This also fixed a bug making an event appearing twice…

Revision history for this message
Victor Martinez (victored) wrote :

This branch looks good.

I've noticed this was already merged into your "snapshot" branch, which is great by the way!

Every programmer has their on opinion on this topic, but singletons can be considered evil as they hide the actual dependencies of each class. They are good because they enforce a single instance, but that's usually not needed because creating additional instances would be pointless in most situations.

When a constructor looks like:
> public MyClassName (TypeA dependency_a, TypeB dependency_b)
it's explicitly declaring which external objects the class depends on (dependency_a and dependency_b).

Defining constructors this way also helps ensure objects are instantiated in the correct order, because their dependencies need to be instantiated before they can be constructed. Singletons usually eliminate this restriction and may lead to obscure class-instantiation bugs.

Of course this branch is not subject to that kind of bugs yet, and there are more good things on this branch besides Singletons.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches