diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-11-15 06:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-11-15 06:04:21 +0800 |
commit | 9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch) | |
tree | 2e1e96f33404781354c422a7e9beaf458ebeb655 /calendar/gui/migration.c | |
parent | 7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff) | |
download | gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip |
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com>
** Remove trailing whitespace from source code.
svn path=/trunk/; revision=34537
Diffstat (limited to 'calendar/gui/migration.c')
-rw-r--r-- | calendar/gui/migration.c | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c index f6b977bbe9..3ed7d9fb5c 100644 --- a/calendar/gui/migration.c +++ b/calendar/gui/migration.c @@ -150,16 +150,16 @@ static void setup_progress_dialog (gboolean tasks) { GtkWidget *vbox, *hbox, *w; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title ((GtkWindow *) window, _("Migrating...")); gtk_window_set_modal ((GtkWindow *) window, TRUE); gtk_container_set_border_width ((GtkContainer *) window, 6); - + vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add ((GtkContainer *) window, vbox); - + if (tasks) w = gtk_label_new (_("The location and hierarchy of the Evolution task " "folders has changed since Evolution 1.x.\n\nPlease be " @@ -172,19 +172,19 @@ setup_progress_dialog (gboolean tasks) gtk_label_set_line_wrap ((GtkLabel *) w, TRUE); gtk_widget_show (w); gtk_box_pack_start_defaults ((GtkBox *) vbox, w); - + hbox = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox); gtk_box_pack_start_defaults ((GtkBox *) vbox, hbox); - + label = (GtkLabel *) gtk_label_new (""); gtk_widget_show ((GtkWidget *) label); gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) label); - + progress = (GtkProgressBar *) gtk_progress_bar_new (); gtk_widget_show ((GtkWidget *) progress); gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) progress); - + gtk_widget_show (window); } @@ -198,13 +198,13 @@ static void dialog_set_folder_name (const char *folder_name) { char *text; - + text = g_strdup_printf (_("Migrating `%s':"), folder_name); gtk_label_set_text (label, text); g_free (text); - + gtk_progress_bar_set_fraction (progress, 0.0); - + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -213,12 +213,12 @@ static void dialog_set_progress (double percent) { char text[5]; - + snprintf (text, sizeof (text), "%d%%", (int) (percent * 100.0f)); - + gtk_progress_bar_set_fraction (progress, percent); gtk_progress_bar_set_text (progress, text); - + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -290,7 +290,7 @@ migrate_ical (ECal *old_ecal, ECal *new_ecal) int num_added = 0; int num_objects; gboolean retval = TRUE; - + /* both ecals are loaded, start the actual migration */ if (!e_cal_get_object_list (old_ecal, "#t", &objects, NULL)) return FALSE; @@ -304,7 +304,7 @@ migrate_ical (ECal *old_ecal, ECal *new_ecal) g_warning ("Migration of object failed: %s", error->message); retval = FALSE; } - + g_clear_error (&error); num_added ++; @@ -326,7 +326,7 @@ migrate_ical_folder_to_source (char *old_path, ESource *new_source, ECalSourceTy char *old_uri = g_strdup_printf ("file://%s", old_path); GError *error = NULL; gboolean retval = FALSE; - + group = e_source_group_new ("", old_uri); old_source = e_source_new ("", ""); e_source_group_add_source (group, old_source, -1); @@ -364,7 +364,7 @@ finish: g_object_unref (new_ecal); g_free (old_uri); - return retval; + return retval; } static gboolean @@ -372,7 +372,7 @@ migrate_ical_folder (char *old_path, ESourceGroup *dest_group, char *source_name { ESource *new_source; gboolean retval; - + new_source = e_source_new (source_name, source_name); e_source_set_relative_uri (new_source, e_source_peek_uid (new_source)); e_source_group_add_source (dest_group, new_source, -1); @@ -397,7 +397,7 @@ create_calendar_contact_source (ESourceList *source_list) { ESourceGroup *group; ESource *source; - + /* Create the contacts group */ group = e_source_group_new (_("Contacts"), CONTACTS_BASE_URI); e_source_list_add_group (source_list, group, -1); @@ -490,7 +490,7 @@ create_calendar_sources (CalendarComponent *component, /* Create the default Person calendar */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (*on_this_computer, source, -1); - + if (!primary_calendar && !calendar_config_get_calendars_selected ()) { GSList selected; @@ -501,7 +501,7 @@ create_calendar_sources (CalendarComponent *component, calendar_config_set_calendars_selected (&selected); } - g_free (primary_calendar); + g_free (primary_calendar); e_source_set_color_spec (source, "#BECEDD"); *personal_source = source; } @@ -519,7 +519,7 @@ create_calendar_sources (CalendarComponent *component, *contacts = group; } - + g_free (base_uri_proto); g_free (base_uri); } @@ -538,7 +538,7 @@ create_task_sources (TasksComponent *component, *on_this_computer = NULL; *on_the_web = NULL; *personal_source = NULL; - + base_uri = g_build_filename (tasks_component_peek_base_directory (component), "tasks", "local", NULL); @@ -622,7 +622,7 @@ static void migrate_pilot_db_key (const char *key, gpointer user_data) { EXmlHash *xmlhash = user_data; - + e_xmlhash_add (xmlhash, key, ""); } @@ -634,16 +634,16 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_ const char *ext; char *filename; GDir *dir; - + if (!(dir = g_dir_open (old_path, 0, NULL))) return; - + map = g_alloca (12 + strlen (conduit)); sprintf (map, "pilot-map-%s-", conduit); - + changelog = g_alloca (24 + strlen (conduit)); sprintf (changelog, "pilot-sync-evolution-%s-", conduit); - + while ((dent = g_dir_read_name (dir))) { if (!strncmp (dent, map, strlen (map)) && ((ext = strrchr (dent, '.')) && !strcmp (ext, ".xml"))) { @@ -652,13 +652,13 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_ size_t nread, nwritten; int fd0, fd1; ssize_t n; - + filename = g_build_filename (old_path, dent, NULL); if ((fd0 = g_open (filename, O_RDONLY|O_BINARY, 0)) == -1) { g_free (filename); continue; } - + g_free (filename); filename = g_build_filename (new_path, dent, NULL); if ((fd1 = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)) == -1) { @@ -666,38 +666,38 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_ close (fd0); continue; } - + do { do { n = read (fd0, inbuf, sizeof (inbuf)); } while (n == -1 && errno == EINTR); - + if (n < 1) break; - + nread = n; nwritten = 0; do { do { n = write (fd1, inbuf + nwritten, nread - nwritten); } while (n == -1 && errno == EINTR); - + if (n > 0) nwritten += n; } while (nwritten < nread && n != -1); - + if (n == -1) break; } while (1); - + if (n != -1) n = fsync (fd1); - + if (n == -1) { g_warning ("Failed to migrate %s: %s", dent, strerror (errno)); g_unlink (filename); } - + close (fd0); close (fd1); g_free (filename); @@ -707,31 +707,31 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_ EXmlHash *xmlhash; EDbHash *dbhash; struct stat st; - + filename = g_build_filename (old_path, dent, NULL); if (g_stat (filename, &st) == -1) { g_free (filename); continue; } - + dbhash = e_dbhash_new (filename); g_free (filename); - + filename = g_strdup_printf ("%s/%s.ics-%s", new_path, component, dent); if (g_stat (filename, &st) != -1) g_unlink (filename); xmlhash = e_xmlhash_new (filename); g_free (filename); - + e_dbhash_foreach_key (dbhash, migrate_pilot_db_key, xmlhash); - + e_dbhash_destroy (dbhash); - + e_xmlhash_write (xmlhash); e_xmlhash_destroy (xmlhash); } } - + g_dir_close (dir); } @@ -758,21 +758,21 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis struct stat st; conf_file = g_build_filename (g_get_home_dir (), "evolution", "config.xmldb", NULL); - if (lstat (conf_file, &st) == 0 && S_ISREG (st.st_mode)) + if (lstat (conf_file, &st) == 0 && S_ISREG (st.st_mode)) config_doc = xmlParseFile (conf_file); g_free (conf_file); - + if (config_doc && minor <= 2) { - GConfClient *gconf; + GConfClient *gconf; int res = 0; - + /* move bonobo config to gconf */ gconf = gconf_client_get_default (); - + res = e_bconf_import (gconf, config_doc, calendar_remap_list); - + g_object_unref (gconf); - + xmlFreeDoc(config_doc); if (res != 0) { @@ -798,7 +798,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis for (l = migration_dirs; l; l = l->next) { char *source_name; - + if (personal_source && !strcmp ((char*)l->data, local_cal_folder)) continue; @@ -810,17 +810,17 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis g_free(source_name); goto fail; } - + g_free (source_name); } - + g_free (local_cal_folder); dialog_close (); } if (minor <= 4 || (minor == 5 && revision < 5)) { - GConfClient *gconf; + GConfClient *gconf; GConfValue *gconf_val; int i; const char *keys[] = { @@ -830,9 +830,9 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis CALENDAR_CONFIG_MONTH_VPANE_POS, NULL }; - + gconf = gconf_client_get_default (); - + for (i = 0; keys[i]; i++) { gconf_val = gconf_client_get (gconf, keys[i], NULL); if (gconf_val) { @@ -841,13 +841,13 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis gconf_value_free (gconf_val); } } - + g_object_unref (gconf); } - + if (minor < 5 || (minor == 5 && revision <= 10)) { char *old_path, *new_path; - + old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Calendar", NULL); new_path = g_build_filename (calendar_component_peek_base_directory (component), "calendar", "local", "system", NULL); @@ -883,7 +883,7 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis /** @Event: component.migration * @Title: Migration step in component initialization * @Target: ECalEventTargetComponent - * + * * component.migration is emitted during the calendar component * initialization process. This allows new calendar backend types * to be distributed as an e-d-s backend and a plugin without @@ -920,7 +920,7 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE creates the groups/sources or it finds the necessary groups/sources. */ create_task_sources (component, tasks_component_peek_source_list (component), &on_this_computer, &on_the_web, &personal_source); - + #ifndef G_OS_WIN32 if (major == 1) { xmlDocPtr config_doc = NULL; @@ -930,18 +930,18 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE if (g_file_test (conf_file, G_FILE_TEST_IS_REGULAR)) config_doc = e_xml_parse_file (conf_file); g_free (conf_file); - + if (config_doc && minor <= 2) { - GConfClient *gconf; + GConfClient *gconf; int res = 0; - + /* move bonobo config to gconf */ gconf = gconf_client_get_default (); - + res = e_bconf_import (gconf, config_doc, task_remap_list); - + g_object_unref (gconf); - + xmlFreeDoc(config_doc); if (res != 0) { @@ -953,9 +953,9 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE if (minor <= 4) { GSList *migration_dirs, *l; char *path, *local_task_folder; - + setup_progress_dialog (TRUE); - + path = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); migration_dirs = e_folder_map_local_folders (path, "tasks"); local_task_folder = g_build_filename (path, "Tasks", NULL); @@ -966,7 +966,7 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE for (l = migration_dirs; l; l = l->next) { char *source_name; - + if (personal_source && !strcmp ((char*)l->data, local_task_folder)) continue; @@ -978,18 +978,18 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision, GE g_free(source_name); goto fail; } - + g_free (source_name); } - + g_free (local_task_folder); dialog_close (); } - + if (minor < 5 || (minor == 5 && revision <= 10)) { char *old_path, *new_path; - + old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Tasks", NULL); new_path = g_build_filename (tasks_component_peek_base_directory (component), "tasks", "local", "system", NULL); @@ -1027,14 +1027,14 @@ fail: g_object_unref (on_the_web); if (personal_source) g_object_unref (personal_source); - + return retval; } /******************************************************************************************************** * * MEMOS - * + * ********************************************************************************************************/ static void @@ -1051,7 +1051,7 @@ create_memo_sources (MemosComponent *component, *on_this_computer = NULL; *on_the_web = NULL; *personal_source = NULL; - + base_uri = g_build_filename (memos_component_peek_base_directory (component), "memos", "local", NULL); @@ -1150,8 +1150,8 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s const char * use_ssl; const char *poa_address; const char *offline_sync; - - + + poa_address = url->host; if (!poa_address || strlen (poa_address) ==0) return; @@ -1167,7 +1167,7 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s if (!e_source_list_add_group (source_list, group, -1)) return; relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - + source = e_source_new (source_name, relative_uri); e_source_set_property (source, "auth", "1"); e_source_set_property (source, "username", url->user); @@ -1185,7 +1185,7 @@ add_gw_esource (ESourceList *source_list, const char *group_name, const char *s temp = ids; for (; temp != NULL; temp = g_slist_next (temp)) g_free (temp->data); - + g_slist_free (ids); g_object_unref (source); g_object_unref (group); @@ -1212,7 +1212,7 @@ migrate_memos (MemosComponent *component, int major, int minor, int revision, st if (major == 2 && minor < 8) { EAccountList *al; EAccount *a; - CamelURL *url; + CamelURL *url; EIterator *it; GConfClient *gconf_client = gconf_client_get_default (); al = e_account_list_new (gconf_client); @@ -1220,7 +1220,7 @@ migrate_memos (MemosComponent *component, int major, int minor, int revision, st e_iterator_is_valid(it); e_iterator_next(it)) { a = (EAccount *) e_iterator_get(it); - if (!a->enabled || !is_groupwise_account (a)) + if (!a->enabled || !is_groupwise_account (a)) continue; url = camel_url_new (a->source->url, NULL); add_gw_esource (source_list, a->name, _("Notes"), url, gconf_client); @@ -1239,6 +1239,6 @@ migrate_memos (MemosComponent *component, int major, int minor, int revision, st g_object_unref (on_the_web); if (personal_source) g_object_unref (personal_source); - + return retval; } |