~ubuntu-branches/debian/jessie/gnome-shell/jessie

« back to all changes in this revision

Viewing changes to debian/patches/21_revert_evolution_gsettings.patch

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-05-30 13:19:38 UTC
  • mfrom: (18.1.24 experimental)
  • Revision ID: package-import@ubuntu.com-20120530131938-i3trc1g1p3is2u6x
Tags: 3.4.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
@@ -50,11 +50,11 @@
 
6
 
 
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"
 
12
-
 
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"
 
18
 
 
19
 typedef struct _CalendarSourceData CalendarSourceData;
 
20
 
 
21
@@ -65,10 +65,11 @@
 
22
   guint            changed_signal;
 
23
 
 
24
   GSList          *clients;
 
25
-  char           **selected_sources;
 
26
+  GSList          *selected_sources;
 
27
   ESourceList     *esource_list;
 
28
 
 
29
-  guint            selected_sources_handler_id;
 
30
+  guint            selected_sources_listener;
 
31
+  char            *selected_sources_dir;
 
32
 
 
33
   guint            timeout_id;
 
34
 
 
35
@@ -81,7 +82,6 @@
 
36
   CalendarSourceData  task_sources;
 
37
 
 
38
   GConfClient        *gconf_client;
 
39
-  GSettings          *settings;
 
40
 };
 
41
 
 
42
 static void calendar_sources_class_init (CalendarSourcesClass *klass);
 
43
@@ -183,7 +183,6 @@
 
44
   sources->priv->task_sources.timeout_id     = 0;
 
45
 
 
46
   sources->priv->gconf_client = gconf_client_get_default ();
 
47
-  sources->priv->settings = g_settings_new (CALENDAR_SELECTED_SOURCES_SCHEMA);
 
48
 }
 
49
 
 
50
 static void
 
51
@@ -194,11 +193,21 @@
 
52
     {
 
53
       GSList *l;
 
54
 
 
55
-      if (source_data->selected_sources_handler_id)
 
56
+      if (source_data->selected_sources_dir)
 
57
+       {
 
58
+         gconf_client_remove_dir (sources->priv->gconf_client,
 
59
+                                  source_data->selected_sources_dir,
 
60
+                                  NULL);
 
61
+
 
62
+         g_free (source_data->selected_sources_dir);
 
63
+         source_data->selected_sources_dir = NULL;
 
64
+       }
 
65
+
 
66
+      if (source_data->selected_sources_listener)
 
67
        {
 
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;
 
74
        }
 
75
 
 
76
       for (l = source_data->clients; l; l = l->next)
 
77
@@ -220,7 +229,9 @@
 
78
        }
 
79
       source_data->esource_list = NULL;
 
80
 
 
81
-      g_strfreev (source_data->selected_sources);
 
82
+      for (l = source_data->selected_sources; l; l = l->next)
 
83
+       g_free (l->data);
 
84
+      g_slist_free (source_data->selected_sources);
 
85
       source_data->selected_sources = NULL;
 
86
 
 
87
       if (source_data->timeout_id != 0)
 
88
@@ -245,10 +256,6 @@
 
89
     g_object_unref (sources->priv->gconf_client);
 
90
   sources->priv->gconf_client = NULL;
 
91
 
 
92
-  if (sources->priv->settings)
 
93
-    g_object_unref (sources->priv->settings);
 
94
-  sources->priv->settings = NULL;
 
95
-
 
96
   if (G_OBJECT_CLASS (parent_class)->finalize)
 
97
     G_OBJECT_CLASS (parent_class)->finalize (object);
 
98
 }
 
99
@@ -270,16 +277,18 @@
 
100
 
 
101
 static gboolean
 
102
 is_source_selected (ESource *esource,
 
103
-                    char  **selected_sources)
 
104
+                   GSList  *selected_sources)
 
105
 {
 
106
   const char *uid;
 
107
-  char      **source;
 
108
+  GSList     *l;
 
109
 
 
110
   uid = e_source_peek_uid (esource);
 
111
 
 
112
-  for (source = selected_sources; *source; source++)
 
113
+  for (l = selected_sources; l; l = l->next)
 
114
     {
 
115
-      if (!strcmp (*source, uid))
 
116
+      const char *source = l->data;
 
117
+
 
118
+      if (!strcmp (source, uid))
 
119
        return TRUE;
 
120
     }
 
121
 
 
122
@@ -352,15 +361,17 @@
 
123
 }
 
124
 
 
125
 static inline void
 
126
-debug_dump_selected_sources (char **selected_sources)
 
127
+debug_dump_selected_sources (GSList *selected_sources)
 
128
 {
 
129
 #ifdef CALENDAR_ENABLE_DEBUG
 
130
-  char **source;
 
131
+  GSList *l;
 
132
 
 
133
   dprintf ("Selected sources:\n");
 
134
-  for (source = selected_sources; *source; source++)
 
135
+  for (l = selected_sources; l; l = l->next)
 
136
     {
 
137
-      dprintf ("  %s\n", *source);
 
138
+      char *source = l->data;
 
139
+
 
140
+      dprintf ("  %s\n", source);
 
141
     }
 
142
   dprintf ("\n");
 
143
 #endif
 
144
@@ -511,14 +522,34 @@
 
145
 }
 
146
 
 
147
 static void
 
148
-calendar_sources_selected_sources_notify (GSettings          *settings,
 
149
-                                          const gchar        *key,
 
150
+calendar_sources_selected_sources_notify (GConfClient        *client,
 
151
+                                         guint               cnx_id,
 
152
+                                         GConfEntry         *entry,
 
153
                                          CalendarSourceData *source_data)
 
154
 {
 
155
-  dprintf ("Selected sources key (%s) changed, reloading\n", key);
 
156
+  GSList *l;
 
157
 
 
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)
 
163
+    return;
 
164
+
 
165
+  dprintf ("Selected sources key (%s) changed, reloading\n", entry->key);
 
166
+
 
167
+  for (l = source_data->selected_sources; l; l = l->next)
 
168
+    g_free (l->data);
 
169
+  source_data->selected_sources = NULL;
 
170
+
 
171
+  for (l = gconf_value_get_list (entry->value); l; l = l->next)
 
172
+    {
 
173
+      const char *source = gconf_value_get_string (l->data);
 
174
+
 
175
+      source_data->selected_sources = 
 
176
+       g_slist_prepend (source_data->selected_sources,
 
177
+                        g_strdup (source));
 
178
+    }
 
179
+  source_data->selected_sources =
 
180
+    g_slist_reverse (source_data->selected_sources);
 
181
 
 
182
   calendar_sources_load_esource_list (source_data);
 
183
 }
 
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)
 
191
 {
 
192
   GConfClient *gconf_client;
 
193
-  GSettings   *settings;
 
194
-  char        *signal_name;
 
195
+  GError      *error;
 
196
 
 
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);
 
202
 
 
203
   gconf_client = sources->priv->gconf_client;
 
204
-  settings = sources->priv->settings;
 
205
 
 
206
-  source_data->selected_sources = g_settings_get_strv (settings, selected_sources_key);
 
207
+  error = NULL;
 
208
+  source_data->selected_sources = gconf_client_get_list (gconf_client,
 
209
+                                                        selected_sources_key,
 
210
+                                                        GCONF_VALUE_STRING,
 
211
+                                                        &error);
 
212
+  if (error)
 
213
+    {
 
214
+      g_warning ("Failed to get selected sources from '%s': %s\n",
 
215
+                selected_sources_key,
 
216
+                error->message);
 
217
+      g_error_free (error);
 
218
+      return;
 
219
+    }
 
220
 
 
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,
 
229
+                       NULL);
 
230
+  source_data->selected_sources_dir = g_strdup (selected_sources_dir);
 
231
+
 
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);
 
237
 
 
238
   source_data->esource_list = e_source_list_new_for_gconf (gconf_client, sources_key);
 
239
   g_signal_connect (source_data->esource_list, "changed",
 
240
@@ -571,7 +620,8 @@
 
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);
 
247
     }
 
248
   
 
249
   return sources->priv->appointment_sources.clients;
 
250
@@ -587,7 +637,8 @@
 
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);
 
257
     }
 
258
 
 
259
   return sources->priv->task_sources.clients;