Merge lp:~jjardon/indicator-datetime/ECalClient_port into lp:indicator-datetime/0.4

Proposed by Javier Jardón on 2012-03-12
Status: Rejected
Rejected by: Charles Kerr on 2013-05-03
Proposed branch: lp:~jjardon/indicator-datetime/ECalClient_port
Merge into: lp:indicator-datetime/0.4
Diff against target: 130 lines (+32/-34)
2 files modified
configure.ac (+2/-2)
src/datetime-service.c (+30/-32)
To merge this branch: bzr merge lp:~jjardon/indicator-datetime/ECalClient_port
Reviewer Review Type Date Requested Status
Indicator Applet Developers 2012-03-12 Pending
Review via email: mp+96952@code.launchpad.net

Description of the change

Port to new ECalClient api

To post a comment you must log in.
Charles Kerr (charlesk) wrote :

The API's changed again in 3.5, and cyphermox has patched it, so although this patch is fine, it's also moot

Unmerged revisions

163. By Javier Jardón on 2012-03-12

configure.ac: Bump libecal and libedataserverui minimum required version to 3.2

162. By Javier Jardón on 2012-03-12

src/datetime-service: update to ECalClient

ECal is deprecated and replaced by ECalClient.
This has the advantage of using e_utils to handle authentication.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-03-08 22:42:33 +0000
3+++ configure.ac 2012-03-12 01:41:17 +0000
4@@ -62,8 +62,8 @@
5 GIO_REQUIRED_VERSION=2.25.11
6 INDICATOR_DISPLAY_OBJECTS=0.2.2
7 GEOCLUE_REQUIRED_VERSION=0.12.0
8-ECAL_REQUIRED_VERSION=2.30
9-EDS_REQUIRED_VERSION=2.30
10+ECAL_REQUIRED_VERSION=3.2
11+EDS_REQUIRED_VERSION=3.2
12 ICAL_REQUIRED_VERSION=0.44
13 CAIRO_REQUIRED_VERSION=1.10
14 GDK_REQUIRED_VERSION=2.22
15
16=== modified file 'src/datetime-service.c'
17--- src/datetime-service.c 2012-03-07 20:36:07 +0000
18+++ src/datetime-service.c 2012-03-12 01:41:17 +0000
19@@ -40,11 +40,11 @@
20 #include <geoclue/geoclue-master-client.h>
21
22 #include <time.h>
23-#include <libecal/e-cal.h>
24+#include <libecal/e-cal-client.h>
25 #include <libical/ical.h>
26 #include <libecal/e-cal-time-util.h>
27 #include <libedataserver/e-source.h>
28-#include <libedataserverui/e-passwords.h>
29+#include <libedataserverui/e-client-utils.h>
30 // Other users of ecal seem to also include these, not sure why they should be included by the above
31 #include <libical/icaltime.h>
32 #include <cairo/cairo.h>
33@@ -591,27 +591,6 @@
34 return FALSE;
35 }
36
37-// Authentication function
38-static gchar *
39-auth_func (ECal *ecal,
40- const gchar *prompt,
41- const gchar *key,
42- gpointer user_data)
43-{
44- ESource *source = e_cal_get_source (ecal);
45- gchar *auth_domain = e_source_get_duped_property (source, "auth-domain");
46-
47- const gchar *component_name;
48- if (auth_domain) component_name = auth_domain;
49- else component_name = "Calendar";
50-
51- gchar *password = e_passwords_get_password (component_name, key);
52-
53- g_free (auth_domain);
54-
55- return password;
56-}
57-
58 static gint
59 compare_comp_instances (gconstpointer a,
60 gconstpointer b)
61@@ -717,7 +696,7 @@
62 highlightdays = highlightdays + 7; // Minimum of 7 days ahead
63 t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
64
65- if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
66+ if (!e_client_get_sources (&sources, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &gerror)) {
67 g_debug("Failed to get ecal sources\n");
68 return FALSE;
69 }
70@@ -747,25 +726,39 @@
71 GSList *s;
72
73 for (s = e_source_group_peek_sources (group); s; s = s->next) {
74- ESource *source = E_SOURCE (s->data);
75+ ESource *source;
76+ ECalClient *ecal;
77+ GError *error = NULL;
78+
79+ source = E_SOURCE (s->data);
80 g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
81- ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT);
82- e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL);
83-
84+
85+ ecal = e_cal_client_new (source, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, &gerror);
86+ if (!ecal){
87+ g_debug ("Could not load source '%s' from '%s': %s",
88+ e_source_peek_name (source),
89+ e_source_peek_relative_uri (source),
90+ gerror->message);
91+ g_clear_error(&error);
92+ continue;
93+ }
94+ g_signal_connect (retval, "authenticate",
95+ G_CALLBACK (e_client_utils_authenticate_handler), NULL);
96+
97 icaltimezone* current_zone = icaltimezone_get_builtin_timezone(current_timezone);
98 if (!current_zone) {
99 // current_timezone may be a TZID?
100 current_zone = icaltimezone_get_builtin_timezone_from_tzid(current_timezone);
101 }
102- if (current_zone && !e_cal_set_default_timezone(ecal, current_zone, &gerror)) {
103+ if (current_zone && !e_cal_client_set_default_timezone (ecal, current_zone)) {
104 g_debug("Failed to set ecal default timezone %s", gerror->message);
105 g_error_free(gerror);
106 gerror = NULL;
107 g_object_unref(ecal);
108 continue;
109 }
110-
111- if (!e_cal_open(ecal, FALSE, &gerror)) {
112+
113+ if (!e_client_open_sync (E_CLIENT (ecal), FALSE, NULL, &gerror)) {
114 g_debug("Failed to get ecal sources %s", gerror->message);
115 g_error_free(gerror);
116 gerror = NULL;
117@@ -788,7 +781,12 @@
118 }
119 g_debug("ecal_uid is enabled, generating instances");
120
121- e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
122+ e_cal_client_generate_instances (ecal,
123+ t1, t2,
124+ NULL,
125+ (ECalRecurInstanceFn) populate_appointment_instances,
126+ (gpointer) source,
127+ NULL);
128 g_object_unref(ecal);
129 }
130 }

Subscribers

People subscribed via source and target branches