After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 671177 - Port calendar-server to ECalClient
Port calendar-server to ECalClient
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: calendar
unspecified
Other Linux
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-02 01:01 UTC by Giovanni Campagna
Modified: 2012-03-10 16:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
calendar-server: update to ECalClient (15.50 KB, patch)
2012-03-02 01:01 UTC, Giovanni Campagna
reviewed Details | Review
calendar-server: update to ECalClient (15.08 KB, patch)
2012-03-05 20:35 UTC, Giovanni Campagna
none Details | Review
calendar-server: use g_warning instead of g_printerr (1.89 KB, patch)
2012-03-05 20:35 UTC, Giovanni Campagna
committed Details | Review
calendar-server: update to ECalClient (15.15 KB, patch)
2012-03-07 21:19 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-03-02 01:01:02 UTC
EClient is deprecated, and in our quest to perfection we should use the new shiny ECalClient API.

Well, it's not only that, actually. Using the old API, calendar backends are never opened (even though e_cal_open is called and succeeds), thus all operations on them fail with NotOpened (webcal) or return cached data only (caldav, weather). dbus-monitor tracking shows AuthenticationRequired signals that are never handled.

OTOH, with the new API, and the nice e_client_utils_authenticate_helper that implements everything auth related, calendars are correctly opened and show updated data, without ever opening evolution.
Comment 1 Giovanni Campagna 2012-03-02 01:01:28 UTC
Created attachment 208835 [details] [review]
calendar-server: update to ECalClient

ECal is deprecated and replaced by ECalClient. This has the
advantage of using e_utils to handle authentication, and should
fix NotOpened errors (that affect in particular webcal calendars
prior to evolution running)
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-03-05 14:45:23 UTC
Review of attachment 208835 [details] [review]:

::: src/calendar-server/gnome-shell-calendar-server.c
@@ +632,2 @@
         {
+          g_warning ("Error opening calendar %s: %s\n", 

Warning: Error opening calendar...

Don't do that. Is it an error or a warning? Even so, this isn't related to the ECalClient port, it doesn't belong here. Put it in a separate commit.
Comment 3 Giovanni Campagna 2012-03-05 16:58:10 UTC
(In reply to comment #2)
> Review of attachment 208835 [details] [review]:
> 
> ::: src/calendar-server/gnome-shell-calendar-server.c
> @@ +632,2 @@
>          {
> +          g_warning ("Error opening calendar %s: %s\n", 
> 
> Warning: Error opening calendar...
> 
> Don't do that. Is it an error or a warning? Even so, this isn't related to the
> ECalClient port, it doesn't belong here. Put it in a separate commit.

It's both. It's an error, in the sense that it's something that went wrong (a dbus error, most likely), and it's a warning, in the sense of something that starts with "(gnome-shell-calendar-server:<pid>)" (so it's picked up by abrt and the like) and it's not hidden by the default log handler. Ok for the separate commit, though.
Comment 4 Giovanni Campagna 2012-03-05 20:35:11 UTC
Created attachment 209031 [details] [review]
calendar-server: update to ECalClient

ECal is deprecated and replaced by ECalClient. This has the
advantage of using e_utils to handle authentication, and should
fix NotOpened errors (that affect in particular webcal calendars
prior to evolution running)
Comment 5 Giovanni Campagna 2012-03-05 20:35:33 UTC
Created attachment 209032 [details] [review]
calendar-server: use g_warning instead of g_printerr

This way error messages include the process name and PID, so they're
picked up by bug reporting tools that grep ~/.xsession-errors.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-03-05 20:38:37 UTC
Review of attachment 209032 [details] [review]:

If it's an error, we want g_critical, not g_warning, right?
Comment 7 Owen Taylor 2012-03-05 20:42:45 UTC
(In reply to comment #6)
> Review of attachment 209032 [details] [review]:
> 
> If it's an error, we want g_critical, not g_warning, right?

I wouldn't say so - g_critical() is fairly much only used for g_return_if_fail() - g_warning() is anything that shouldn't happen but isn't worth aborting for immediately.
Comment 8 Matthias Clasen 2012-03-05 21:54:18 UTC
I've asked the evolution guys to look this over, too.
Comment 9 Milan Crha 2012-03-06 12:33:25 UTC
ECalClientViewClass::objects_added/_modified/_removed uses GSList, not GList.

Of course, using async functions, especially if this is run in the main thread, is preferred.

Apart of that I do not see anything obvious - aka it looks good otherwise.

About the g_critical, I agree with Owen, you definitely do not want to abort gnome-shell's calendar server due to issues like user not writing correct password for three times, or if the remote server is temporarily unavailable, which may result in an error on any of those three changed places (it can get temporarily unavailable after user connected to it already too). Of course, these issues can happen, even pretty often, when you connect to your calendar hidden in VPN where you are not connected currently.
Comment 10 Giovanni Campagna 2012-03-07 21:19:05 UTC
Created attachment 209216 [details] [review]
calendar-server: update to ECalClient

ECal is deprecated and replaced by ECalClient. This has the
advantage of using e_utils to handle authentication, and should
fix NotOpened errors (that affect in particular webcal calendars
prior to evolution running)

Updated for GSList instead of GList
Comment 11 Giovanni Campagna 2012-03-07 21:21:53 UTC
One last note: I kept the existing sync functions, since technically they're called in the main thread, but really the helper acts like a worker thread for gnome-shell, and thus blocking it is fine.
Comment 12 Milan Crha 2012-03-08 09:35:36 UTC
The patch looks good from my side, just check compiler warnings, which I suppose you did already. This is mainly about "simple" replacements. I do not know the gnome-shell-calendar code, but I guess, with this change, you also do not want to include e-passwords.h anymore, as this is covered by the e-client-utils' authenticate function.
Comment 13 Giovanni Campagna 2012-03-10 16:34:46 UTC
Attachment 209032 [details] pushed as 0ea690a - calendar-server: use g_warning instead of g_printerr
Attachment 209216 [details] pushed as d68ff69 - calendar-server: update to ECalClient

Pushed including the e-passwords.h fix.