1
Index: gnome-shell-3.4.1/src/calendar-server/calendar-sources.c
2
===================================================================
3
--- gnome-shell-3.4.1.orig/src/calendar-server/calendar-sources.c 2012-04-16 12:41:48.000000000 -0400
4
+++ gnome-shell-3.4.1/src/calendar-server/calendar-sources.c 2012-04-17 19:21:27.524564190 -0400
7
#define CALENDAR_SOURCES_EVO_DIR "/apps/evolution"
8
#define CALENDAR_SOURCES_APPOINTMENT_SOURCES_KEY CALENDAR_SOURCES_EVO_DIR "/calendar/sources"
9
+#define CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_DIR CALENDAR_SOURCES_EVO_DIR "/calendar/display"
10
+#define CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_KEY CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_DIR "/selected_calendars"
11
#define CALENDAR_SOURCES_TASK_SOURCES_KEY CALENDAR_SOURCES_EVO_DIR "/tasks/sources"
13
-#define CALENDAR_SELECTED_SOURCES_SCHEMA "org.gnome.evolution.calendar"
14
-#define CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_KEY "selected-calendars"
15
-#define CALENDAR_SOURCES_SELECTED_TASK_SOURCES_KEY "selected-tasks"
16
+#define CALENDAR_SOURCES_SELECTED_TASK_SOURCES_DIR CALENDAR_SOURCES_EVO_DIR "/calendar/tasks"
17
+#define CALENDAR_SOURCES_SELECTED_TASK_SOURCES_KEY CALENDAR_SOURCES_SELECTED_TASK_SOURCES_DIR "/selected_tasks"
19
typedef struct _CalendarSourceData CalendarSourceData;
25
- char **selected_sources;
26
+ GSList *selected_sources;
27
ESourceList *esource_list;
29
- guint selected_sources_handler_id;
30
+ guint selected_sources_listener;
31
+ char *selected_sources_dir;
36
CalendarSourceData task_sources;
38
GConfClient *gconf_client;
39
- GSettings *settings;
42
static void calendar_sources_class_init (CalendarSourcesClass *klass);
44
sources->priv->task_sources.timeout_id = 0;
46
sources->priv->gconf_client = gconf_client_get_default ();
47
- sources->priv->settings = g_settings_new (CALENDAR_SELECTED_SOURCES_SCHEMA);
55
- if (source_data->selected_sources_handler_id)
56
+ if (source_data->selected_sources_dir)
58
+ gconf_client_remove_dir (sources->priv->gconf_client,
59
+ source_data->selected_sources_dir,
62
+ g_free (source_data->selected_sources_dir);
63
+ source_data->selected_sources_dir = NULL;
66
+ if (source_data->selected_sources_listener)
68
- g_signal_handler_disconnect (sources->priv->settings,
69
- source_data->selected_sources_handler_id);
70
- source_data->selected_sources_handler_id = 0;
71
+ gconf_client_notify_remove (sources->priv->gconf_client,
72
+ source_data->selected_sources_listener);
73
+ source_data->selected_sources_listener = 0;
76
for (l = source_data->clients; l; l = l->next)
79
source_data->esource_list = NULL;
81
- g_strfreev (source_data->selected_sources);
82
+ for (l = source_data->selected_sources; l; l = l->next)
84
+ g_slist_free (source_data->selected_sources);
85
source_data->selected_sources = NULL;
87
if (source_data->timeout_id != 0)
89
g_object_unref (sources->priv->gconf_client);
90
sources->priv->gconf_client = NULL;
92
- if (sources->priv->settings)
93
- g_object_unref (sources->priv->settings);
94
- sources->priv->settings = NULL;
96
if (G_OBJECT_CLASS (parent_class)->finalize)
97
G_OBJECT_CLASS (parent_class)->finalize (object);
102
is_source_selected (ESource *esource,
103
- char **selected_sources)
104
+ GSList *selected_sources)
110
uid = e_source_peek_uid (esource);
112
- for (source = selected_sources; *source; source++)
113
+ for (l = selected_sources; l; l = l->next)
115
- if (!strcmp (*source, uid))
116
+ const char *source = l->data;
118
+ if (!strcmp (source, uid))
122
@@ -352,15 +361,17 @@
126
-debug_dump_selected_sources (char **selected_sources)
127
+debug_dump_selected_sources (GSList *selected_sources)
129
#ifdef CALENDAR_ENABLE_DEBUG
133
dprintf ("Selected sources:\n");
134
- for (source = selected_sources; *source; source++)
135
+ for (l = selected_sources; l; l = l->next)
137
- dprintf (" %s\n", *source);
138
+ char *source = l->data;
140
+ dprintf (" %s\n", source);
144
@@ -511,14 +522,34 @@
148
-calendar_sources_selected_sources_notify (GSettings *settings,
150
+calendar_sources_selected_sources_notify (GConfClient *client,
153
CalendarSourceData *source_data)
155
- dprintf ("Selected sources key (%s) changed, reloading\n", key);
158
- g_strfreev (source_data->selected_sources);
159
- source_data->selected_sources = g_settings_get_strv (settings, key);
160
+ if (!entry->value ||
161
+ entry->value->type != GCONF_VALUE_LIST ||
162
+ gconf_value_get_list_type (entry->value) != GCONF_VALUE_STRING)
165
+ dprintf ("Selected sources key (%s) changed, reloading\n", entry->key);
167
+ for (l = source_data->selected_sources; l; l = l->next)
169
+ source_data->selected_sources = NULL;
171
+ for (l = gconf_value_get_list (entry->value); l; l = l->next)
173
+ const char *source = gconf_value_get_string (l->data);
175
+ source_data->selected_sources =
176
+ g_slist_prepend (source_data->selected_sources,
177
+ g_strdup (source));
179
+ source_data->selected_sources =
180
+ g_slist_reverse (source_data->selected_sources);
182
calendar_sources_load_esource_list (source_data);
184
@@ -527,27 +558,45 @@
185
calendar_sources_load_sources (CalendarSources *sources,
186
CalendarSourceData *source_data,
187
const char *sources_key,
188
- const char *selected_sources_key)
189
+ const char *selected_sources_key,
190
+ const char *selected_sources_dir)
192
GConfClient *gconf_client;
193
- GSettings *settings;
197
dprintf ("---------------------------\n");
198
dprintf ("Loading sources:\n");
199
dprintf (" sources_key: %s\n", sources_key);
200
dprintf (" selected_sources_key: %s\n", selected_sources_key);
201
+ dprintf (" selected_sources_dir: %s\n", selected_sources_dir);
203
gconf_client = sources->priv->gconf_client;
204
- settings = sources->priv->settings;
206
- source_data->selected_sources = g_settings_get_strv (settings, selected_sources_key);
208
+ source_data->selected_sources = gconf_client_get_list (gconf_client,
209
+ selected_sources_key,
210
+ GCONF_VALUE_STRING,
214
+ g_warning ("Failed to get selected sources from '%s': %s\n",
215
+ selected_sources_key,
217
+ g_error_free (error);
221
- signal_name = g_strconcat ("changed::", selected_sources_key, NULL);
222
- source_data->selected_sources_handler_id =
223
- g_signal_connect (settings, signal_name,
224
- G_CALLBACK (calendar_sources_selected_sources_notify), source_data);
225
- g_free (signal_name);
226
+ gconf_client_add_dir (gconf_client,
227
+ selected_sources_dir,
228
+ GCONF_CLIENT_PRELOAD_NONE,
230
+ source_data->selected_sources_dir = g_strdup (selected_sources_dir);
232
+ source_data->selected_sources_listener =
233
+ gconf_client_notify_add (gconf_client,
234
+ selected_sources_dir,
235
+ (GConfClientNotifyFunc) calendar_sources_selected_sources_notify,
236
+ source_data, NULL, NULL);
238
source_data->esource_list = e_source_list_new_for_gconf (gconf_client, sources_key);
239
g_signal_connect (source_data->esource_list, "changed",
241
calendar_sources_load_sources (sources,
242
&sources->priv->appointment_sources,
243
CALENDAR_SOURCES_APPOINTMENT_SOURCES_KEY,
244
- CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_KEY);
245
+ CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_KEY,
246
+ CALENDAR_SOURCES_SELECTED_APPOINTMENT_SOURCES_DIR);
249
return sources->priv->appointment_sources.clients;
251
calendar_sources_load_sources (sources,
252
&sources->priv->task_sources,
253
CALENDAR_SOURCES_TASK_SOURCES_KEY,
254
- CALENDAR_SOURCES_SELECTED_TASK_SOURCES_KEY);
255
+ CALENDAR_SOURCES_SELECTED_TASK_SOURCES_KEY,
256
+ CALENDAR_SOURCES_SELECTED_TASK_SOURCES_DIR);
259
return sources->priv->task_sources.clients;