1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-upgrade.c - upgrade previous config versions
*
* Copyright (C) 2003 Ximian, Inc.
*
* Authors: Michael Zucchi <notzed@ximian.com>
* Jeffery Stedfast <fejj@ximian.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <ctype.h>
#include <glib.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#include "e-util/e-bconf-map.h"
#include "e-config-upgrade.h"
/* ********************************************************************** */
/* Tables for bonobo conf -> gconf conversion */
/* ********************************************************************** */
/* ********************************************************************** */
static e_gconf_map_t importer_elm_map[] = {
/* /Importer/Elm */
{ "mail", "importer/elm/mail", E_GCONF_MAP_BOOL },
{ "mail-imported", "importer/elm/mail-imported", E_GCONF_MAP_BOOL },
{ 0 },
};
static e_gconf_map_t importer_pine_map[] = {
/* /Importer/Pine */
{ "mail", "importer/elm/mail", E_GCONF_MAP_BOOL },
{ "address", "importer/elm/address", E_GCONF_MAP_BOOL },
{ 0 },
};
static e_gconf_map_t importer_netscape_map[] = {
/* /Importer/Netscape */
{ "mail", "importer/netscape/mail", E_GCONF_MAP_BOOL },
{ "settings", "importer/netscape/settings", E_GCONF_MAP_BOOL },
{ "filters", "importer/netscape/filters", E_GCONF_MAP_BOOL },
{ 0 },
};
/* ********************************************************************** */
/* This grabs the defaults from the first view ... (?) */
static e_gconf_map_t shell_views_map[] = {
/* /Shell/Views/0 */
{ "Width", "shell/view_defaults/width", E_GCONF_MAP_INT },
{ "Height", "shell/view_defaults/height", E_GCONF_MAP_INT },
{ "CurrentShortcutsGroupNum", "shell/view_defaults/selected_shortcut_group", E_GCONF_MAP_INT },
{ "FolderBarShown", "shell/view_defaults/show_folder_bar", E_GCONF_MAP_BOOL },
{ "ShortcutBarShown", "shell/view_defaults/show_shortcut_bar", E_GCONF_MAP_BOOL },
{ "HPanedPosition", "shell/view_defaults/shortcut_bar/width", E_GCONF_MAP_INT },
{ "ViewPanedPosition", "shell/view_defaults/folder_bar/width", E_GCONF_MAP_INT },
{ "DisplayedURI", "shell/view_defaults/folder_path", E_GCONF_MAP_STRING },
{ 0 },
};
static e_gconf_map_t offlinefolders_map[] = {
/* /OfflineFolders */
{ "paths", "shell/offline/folder_paths", E_GCONF_MAP_ANYLIST },
{ 0 },
};
static e_gconf_map_t defaultfolders_map[] = {
/* /DefaultFolders */
{ "mail_path", "shell/default_folders/mail_path", E_GCONF_MAP_STRING },
{ "mail_uri", "shell/default_folders/mail_uri", E_GCONF_MAP_STRING },
{ "contacts_path", "shell/default_folders/contacts_path", E_GCONF_MAP_STRING },
{ "contacts_uri", "shell/default_folders/contacts_uri", E_GCONF_MAP_STRING },
{ "calendar_path", "shell/default_folders/calendar_path", E_GCONF_MAP_STRING },
{ "calendar_uri", "shell/default_folders/calendar_uri", E_GCONF_MAP_STRING },
{ "tasks_path", "shell/default_folders/tasks_path", E_GCONF_MAP_STRING },
{ "tasks_uri", "shell/default_folders/tasks_uri", E_GCONF_MAP_STRING },
{ 0 },
};
static e_gconf_map_t shell_map[] = {
/* /Shell */
{ "StartOffline", "shell/start_offline", E_GCONF_MAP_BOOL },
{ 0 },
};
/* ********************************************************************** */
static e_gconf_map_t addressbook_map[] = {
/* /Addressbook */
{ "select_names_uri", "addressbook/select_names/last_used_uri", E_GCONF_MAP_STRING },
{ 0 },
};
static e_gconf_map_t addressbook_completion_map[] = {
/* /Addressbook/Completion */
{ "uris", "addressbook/completion/uris", E_GCONF_MAP_STRING },
{ 0 },
};
/* ********************************************************************** */
static e_gconf_map_t calendar_display_map[] = {
/* /Calendar/Display */
{ "Timezone", "calendar/display/timezone", E_GCONF_MAP_STRING },
{ "Use24HourFormat", "calendar/display/use_24hour_format", E_GCONF_MAP_BOOL },
{ "WeekStartDay", "calendar/display/week_start_day", E_GCONF_MAP_INT },
{ "DayStartHour", "calendar/display/day_start_hour", E_GCONF_MAP_INT },
{ "DayStartMinute", "calendar/display/day_start_minute", E_GCONF_MAP_INT },
{ "DayEndHour", "calendar/display/day_end_hour", E_GCONF_MAP_INT },
{ "DayEndMinute", "calendar/display/day_end_minute", E_GCONF_MAP_INT },
{ "TimeDivisions", "calendar/display/time_divisions", E_GCONF_MAP_INT },
{ "View", "calendar/display/default_view", E_GCONF_MAP_INT },
{ "HPanePosition", "calendar/display/hpane_position", E_GCONF_MAP_FLOAT },
{ "VPanePosition", "calendar/display/vpane_position", E_GCONF_MAP_FLOAT },
{ "MonthHPanePosition", "calendar/display/month_hpane_position", E_GCONF_MAP_FLOAT },
{ "MonthVPanePosition", "calendar/display/month_vpane_position", E_GCONF_MAP_FLOAT },
{ "CompressWeekend", "calendar/display/compress_weekend", E_GCONF_MAP_BOOL },
{ "ShowEventEndTime", "calendar/display/show_event_end", E_GCONF_MAP_BOOL },
{ "WorkingDays", "calendar/display/working_days", E_GCONF_MAP_INT },
{ 0 },
};
static e_gconf_map_t calendar_tasks_map[] = {
/* /Calendar/Tasks */
{ "HideCompletedTasks", "calendar/tasks/hide_completed", E_GCONF_MAP_BOOL },
{ "HideCompletedTasksUnits", "calendar/tasks/hide_completed_units", E_GCONF_MAP_STRING },
{ "HideCompletedTasksValue", "calendar/tasks/hide_completed_value", E_GCONF_MAP_INT },
{ 0 },
};
static e_gconf_map_t calendar_tasks_colours_map[] = {
/* /Calendar/Tasks/Colors */
{ "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
{ "TasksOverDue", "calendar/tasks/colors/overdue", E_GCONF_MAP_STRING },
{ "TasksDueToday", "calendar/tasks/colors/due_today", E_GCONF_MAP_STRING },
{ 0 },
};
static e_gconf_map_t calendar_other_map[] = {
/* /Calendar/Other */
{ "ConfirmDelete", "calendar/prompts/confirm_delete", E_GCONF_MAP_BOOL },
{ "ConfirmExpunge", "calendar/prompts/confirm_expunge", E_GCONF_MAP_BOOL },
{ "UseDefaultReminder", "calendar/other/use_default_reminder", E_GCONF_MAP_BOOL },
{ "DefaultReminderInterval", "calendar/other/default_reminder_interval", E_GCONF_MAP_INT },
{ "DefaultReminderUnits", "calendar/other/default_reminder_units", E_GCONF_MAP_STRING },
{ 0 },
};
static e_gconf_map_t calendar_datenavigator_map[] = {
/* /Calendar/DateNavigator */
{ "ShowWeekNumbers", "calendar/date_navigator/show_week_numbers", E_GCONF_MAP_BOOL },
{ 0 },
};
static e_gconf_map_t calendar_alarmnotify_map[] = {
/* /Calendar/AlarmNotify */
{ "LastNotificationTime", "calendar/notify/last_notification_time", E_GCONF_MAP_INT },
{ "CalendarToLoad%i", "calendar/notify/calendars", E_GCONF_MAP_STRING|E_GCONF_MAP_LIST },
{ "BlessedProgram%i", "calendar/notify/programs", E_GCONF_MAP_STRING|E_GCONF_MAP_LIST },
{ 0 },
};
static e_gconf_map_t general_map[] = {
/* /General */
{ "CategoryMasterList", "general/category_master_list", E_GCONF_MAP_STRING }
};
/* ********************************************************************** */
e_gconf_map_list_t remap_list[] = {
{ "/Importer/Elm", importer_elm_map },
{ "/Importer/Pine", importer_pine_map },
{ "/Importer/Netscape", importer_netscape_map },
{ "/Shell", shell_map },
{ "/Shell/Views/0", shell_views_map },
{ "/OfflineFolders", offlinefolders_map },
{ "/DefaultFolders", defaultfolders_map },
{ "/Addressbook", addressbook_map },
{ "/Addressbook/Completion", addressbook_completion_map },
{ "/Calendar/Display", calendar_display_map },
{ "/Calendar/Tasks", calendar_tasks_map },
{ "/Calendar/Tasks/Colors", calendar_tasks_colours_map },
{ "/Calendar/Other/Map", calendar_other_map },
{ "/Calendar/DateNavigator", calendar_datenavigator_map },
{ "/Calendar/AlarmNotify", calendar_alarmnotify_map },
{ "/General", general_map },
{ 0 },
};
int
e_config_upgrade(int major, int minor, int revision)
{
xmlDocPtr config_doc = NULL;
char *conf_file;
struct stat st;
int res = 0;
conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL);
if (lstat (conf_file, &st) == 0 && S_ISREG (st.st_mode))
config_doc = xmlParseFile (conf_file);
g_free (conf_file);
if (config_doc && major <=1 && minor < 3) {
GConfClient *gconf;
/* move bonobo config to gconf */
gconf = gconf_client_get_default ();
res = e_bconf_import (gconf, config_doc, remap_list);
if (res != 0)
g_warning("Could not move config from bonobo-conf to gconf");
g_object_unref (gconf);
xmlFreeDoc(config_doc);
}
return res;
}
|