diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-09-12 02:56:28 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-09-13 20:28:58 +0800 |
commit | cd53ba990035bdb4861d9660917d457533d4ecb2 (patch) | |
tree | d9c9da2208f4a921c514497ea92d27e3d88481d1 /addressbook/importers | |
parent | b2b27cfa1bfcd6efdac30d2745a6e8cd4e6de134 (diff) | |
download | gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.gz gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.tar.zst gsoc2013-evolution-cd53ba990035bdb4861d9660917d457533d4ecb2.zip |
Coding style cleanups.
Diffstat (limited to 'addressbook/importers')
-rw-r--r-- | addressbook/importers/evolution-addressbook-importers.h | 10 | ||||
-rw-r--r-- | addressbook/importers/evolution-csv-importer.c | 192 | ||||
-rw-r--r-- | addressbook/importers/evolution-ldif-importer.c | 102 | ||||
-rw-r--r-- | addressbook/importers/evolution-vcard-importer.c | 58 |
4 files changed, 181 insertions, 181 deletions
diff --git a/addressbook/importers/evolution-addressbook-importers.h b/addressbook/importers/evolution-addressbook-importers.h index adaa62931a..8278e67b12 100644 --- a/addressbook/importers/evolution-addressbook-importers.h +++ b/addressbook/importers/evolution-addressbook-importers.h @@ -18,11 +18,11 @@ * */ -struct _EImportImporter *evolution_ldif_importer_peek(void); -struct _EImportImporter *evolution_vcard_importer_peek(void); -struct _EImportImporter *evolution_csv_outlook_importer_peek(void); -struct _EImportImporter *evolution_csv_mozilla_importer_peek(void); -struct _EImportImporter *evolution_csv_evolution_importer_peek(void); +struct _EImportImporter *evolution_ldif_importer_peek (void); +struct _EImportImporter *evolution_vcard_importer_peek (void); +struct _EImportImporter *evolution_csv_outlook_importer_peek (void); +struct _EImportImporter *evolution_csv_mozilla_importer_peek (void); +struct _EImportImporter *evolution_csv_evolution_importer_peek (void); /* private utility function for importers only */ struct _GtkWidget *evolution_contact_importer_get_preview_widget (const GList *contacts); diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index 20025c81ec..3e86679c96 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -69,7 +69,7 @@ typedef struct { static gint importer; static gchar delimiter; -static void csv_import_done(CSVImporter *gci); +static void csv_import_done (CSVImporter *gci); typedef struct { const gchar *csv_attribute; @@ -266,7 +266,7 @@ static import_fields csv_fields_evolution[] = { }; static void -add_to_notes(EContact *contact, const gchar *field_text, gchar *val) +add_to_notes (EContact *contact, const gchar *field_text, gchar *val) { GString *new_text; @@ -274,14 +274,14 @@ add_to_notes(EContact *contact, const gchar *field_text, gchar *val) return; new_text = g_string_new (e_contact_get_const (contact, E_CONTACT_NOTE)); - if (strlen(new_text->str) != 0) - new_text = g_string_append_c(new_text, '\n'); - new_text = g_string_append(new_text, field_text); - new_text = g_string_append_c(new_text, ':'); - new_text = g_string_append(new_text, val); - - e_contact_set(contact, E_CONTACT_NOTE, new_text->str); - g_string_free(new_text, TRUE); + if (strlen (new_text->str) != 0) + new_text = g_string_append_c (new_text, '\n'); + new_text = g_string_append (new_text, field_text); + new_text = g_string_append_c (new_text, ':'); + new_text = g_string_append (new_text, val); + + e_contact_set (contact, E_CONTACT_NOTE, new_text->str); + g_string_free (new_text, TRUE); } /* @str: a date string in the format MM-DD-YYYY or MMDDYYYY */ @@ -293,7 +293,7 @@ date_from_string (const gchar *str) g_return_val_if_fail (str != NULL, NULL); - date = e_contact_date_new(); + date = e_contact_date_new (); if (g_ascii_isdigit (str[i]) && g_ascii_isdigit (str[i+1])) { date->month = str[i] * 10 + str[i+1] - '0' * 11; @@ -424,10 +424,10 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) { home_street = g_string_new(""); work_street = g_string_new(""); other_street = g_string_new(""); - home_address = g_new0(EContactAddress, 1); - work_address = g_new0(EContactAddress, 1); - other_address = g_new0(EContactAddress, 1); - bday = g_new0(EContactDate, 1); + home_address = g_new0 (EContactAddress, 1); + work_address = g_new0 (EContactAddress, 1); + other_address = g_new0 (EContactAddress, 1); + bday = g_new0 (EContactDate, 1); if (!g_utf8_validate (pptr, -1, NULL)) { do_free = g_convert (pptr, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); @@ -492,87 +492,87 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) { switch (flags) { case FLAG_HOME_ADDRESS|FLAG_STREET: - if (strlen(home_street->str) != 0) { + if (strlen (home_street->str) != 0) { home_street = g_string_append(home_street, ",\n"); } - home_street = g_string_append(home_street, value->str); + home_street = g_string_append (home_street, value->str); break; case FLAG_HOME_ADDRESS|FLAG_CITY: - home_address->locality = g_strdup(value->str); + home_address->locality = g_strdup (value->str); break; case FLAG_HOME_ADDRESS|FLAG_STATE: - home_address->region = g_strdup(value->str); + home_address->region = g_strdup (value->str); break; case FLAG_HOME_ADDRESS|FLAG_POSTAL_CODE: - home_address->code = g_strdup(value->str); + home_address->code = g_strdup (value->str); break; case FLAG_HOME_ADDRESS|FLAG_POBOX: - home_address->po = g_strdup(value->str); + home_address->po = g_strdup (value->str); break; case FLAG_HOME_ADDRESS|FLAG_COUNTRY: - home_address->country = g_strdup(value->str); + home_address->country = g_strdup (value->str); break; case FLAG_WORK_ADDRESS|FLAG_STREET: - if (strlen(work_street->str) != 0) { + if (strlen (work_street->str) != 0) { work_street = g_string_append(work_street, ",\n"); } - work_street = g_string_append(work_street, value->str); + work_street = g_string_append (work_street, value->str); break; case FLAG_WORK_ADDRESS|FLAG_CITY: - work_address->locality = g_strdup(value->str); + work_address->locality = g_strdup (value->str); break; case FLAG_WORK_ADDRESS|FLAG_STATE: - work_address->region = g_strdup(value->str); + work_address->region = g_strdup (value->str); break; case FLAG_WORK_ADDRESS|FLAG_POSTAL_CODE: - work_address->code = g_strdup(value->str); + work_address->code = g_strdup (value->str); break; case FLAG_WORK_ADDRESS|FLAG_POBOX: - work_address->po = g_strdup(value->str); + work_address->po = g_strdup (value->str); break; case FLAG_WORK_ADDRESS|FLAG_COUNTRY: - work_address->country = g_strdup(value->str); + work_address->country = g_strdup (value->str); break; case FLAG_OTHER_ADDRESS|FLAG_STREET: - if (strlen(other_street->str) != 0) { + if (strlen (other_street->str) != 0) { other_street = g_string_append(other_street, ",\n"); } - other_street = g_string_append(other_street, value->str); + other_street = g_string_append (other_street, value->str); break; case FLAG_OTHER_ADDRESS|FLAG_CITY: - other_address->locality = g_strdup(value->str); + other_address->locality = g_strdup (value->str); break; case FLAG_OTHER_ADDRESS|FLAG_STATE: - other_address->region = g_strdup(value->str); + other_address->region = g_strdup (value->str); break; case FLAG_OTHER_ADDRESS|FLAG_POSTAL_CODE: - other_address->code = g_strdup(value->str); + other_address->code = g_strdup (value->str); break; case FLAG_OTHER_ADDRESS|FLAG_POBOX: - other_address->po = g_strdup(value->str); + other_address->po = g_strdup (value->str); break; case FLAG_OTHER_ADDRESS|FLAG_COUNTRY: - other_address->country = g_strdup(value->str); + other_address->country = g_strdup (value->str); break; case FLAG_DATE_BDAY: - e_contact_set(contact, E_CONTACT_BIRTH_DATE, date_from_string(value->str)); + e_contact_set (contact, E_CONTACT_BIRTH_DATE, date_from_string (value->str)); break; case FLAG_DATE_ANNIVERSARY: - e_contact_set(contact, E_CONTACT_ANNIVERSARY, date_from_string(value->str)); + e_contact_set (contact, E_CONTACT_ANNIVERSARY, date_from_string (value->str)); break; case FLAG_BIRTH_DAY: - bday->day = atoi(value->str); + bday->day = atoi (value->str); break; case FLAG_BIRTH_YEAR: - bday->year = atoi(value->str); + bday->year = atoi (value->str); break; case FLAG_BIRTH_MONTH: - bday->month = atoi(value->str); + bday->month = atoi (value->str); break; case FLAG_INVALID: @@ -585,17 +585,17 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) { } } ii++; - g_string_free(value, TRUE); + g_string_free (value, TRUE); } - if (strlen(home_street->str) != 0) - home_address->street = g_strdup(home_street->str); - if (strlen(work_street->str) != 0) - work_address->street = g_strdup(work_street->str); - if (strlen(other_street->str) != 0) - other_address->street = g_strdup(other_street->str); - g_string_free(home_street, TRUE); - g_string_free(work_street, TRUE); - g_string_free(other_street, TRUE); + if (strlen (home_street->str) != 0) + home_address->street = g_strdup (home_street->str); + if (strlen (work_street->str) != 0) + work_address->street = g_strdup (work_street->str); + if (strlen (other_street->str) != 0) + other_address->street = g_strdup (other_street->str); + g_string_free (home_street, TRUE); + g_string_free (work_street, TRUE); + g_string_free (other_street, TRUE); if (home_address->locality || home_address->country || home_address->code || home_address->region || home_address->street) @@ -609,7 +609,7 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) { if (importer != OUTLOOK_IMPORTER) { if (bday->day || bday->year || bday->month) - e_contact_set(contact, E_CONTACT_BIRTH_DATE, bday); + e_contact_set (contact, E_CONTACT_BIRTH_DATE, bday); } g_free (do_free); @@ -618,7 +618,7 @@ parseLine (CSVImporter *gci, EContact *contact, gchar *buf) { } static EContact * -getNextCSVEntry(CSVImporter *gci, FILE *f) { +getNextCSVEntry (CSVImporter *gci, FILE *f) { EContact *contact = NULL; GString *line; GString *str; @@ -679,40 +679,40 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) { g_string_free (line, TRUE); - if (strlen(str->str) == 0) { - g_string_free(str, TRUE); + if (strlen (str->str) == 0) { + g_string_free (str, TRUE); return NULL; } - contact = e_contact_new(); + contact = e_contact_new (); buf = str->str; if (!parseLine (gci, contact, buf)) { - g_object_unref(contact); + g_object_unref (contact); return NULL; } gci->count++; - g_string_free(str, TRUE); + g_string_free (str, TRUE); return contact; } static gboolean -csv_import_contacts(gpointer d) { +csv_import_contacts (gpointer d) { CSVImporter *gci = d; EContact *contact = NULL; - while ((contact = getNextCSVEntry(gci, gci->file))) { - e_book_add_contact(gci->book, contact, NULL); - gci->contacts = g_slist_prepend(gci->contacts, contact); + while ((contact = getNextCSVEntry (gci, gci->file))) { + e_book_add_contact (gci->book, contact, NULL); + gci->contacts = g_slist_prepend (gci->contacts, contact); } if (contact == NULL) { gci->state = 1; } if (gci->state == 1) { - csv_import_done(gci); + csv_import_done (gci); return FALSE; } else { @@ -727,12 +727,12 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { g_datalist_set_data_full(&target->data, "csv-source", - g_object_ref(e_source_selector_peek_primary_selection(selector)), + g_object_ref (e_source_selector_peek_primary_selection (selector)), g_object_unref); } static GtkWidget * -csv_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +csv_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *vbox, *selector; ESource *primary; @@ -751,7 +751,7 @@ csv_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) primary = g_datalist_get_data(&target->data, "csv-source"); if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); - g_object_ref(primary); + g_object_ref (primary); g_datalist_set_data_full(&target->data, "csv-source", primary, g_object_unref); } e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); @@ -771,7 +771,7 @@ static const gchar *supported_extensions[4] = { }; static gboolean -csv_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +csv_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { gchar *ext; gint i; @@ -787,12 +787,12 @@ csv_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (strncmp(s->uri_src, "file:///", 8) != 0) return FALSE; - ext = strrchr(s->uri_src, '.'); + ext = strrchr (s->uri_src, '.'); if (ext == NULL) return FALSE; for (i = 0; supported_extensions[i] != NULL; i++) { - if (g_ascii_strcasecmp(supported_extensions[i], ext) == 0) { + if (g_ascii_strcasecmp (supported_extensions[i], ext) == 0) { if (i == 0) { delimiter = CSV_FILE_DELIMITER; } @@ -807,21 +807,21 @@ csv_supported(EImport *ei, EImportTarget *target, EImportImporter *im) } static void -csv_import_done(CSVImporter *gci) +csv_import_done (CSVImporter *gci) { if (gci->idle_id) - g_source_remove(gci->idle_id); + g_source_remove (gci->idle_id); fclose (gci->file); - g_object_unref(gci->book); - g_slist_foreach(gci->contacts, (GFunc) g_object_unref, NULL); - g_slist_free(gci->contacts); + g_object_unref (gci->book); + g_slist_foreach (gci->contacts, (GFunc) g_object_unref, NULL); + g_slist_free (gci->contacts); if (gci->fields_map) g_hash_table_destroy (gci->fields_map); - e_import_complete(gci->import, gci->target); - g_object_unref(gci->import); + e_import_complete (gci->import, gci->target); + g_object_unref (gci->import); g_free (gci); } @@ -844,7 +844,7 @@ csv_import (EImport *ei, EImportTarget *target, EImportImporter *im) book = e_book_new(g_datalist_get_data(&target->data, "csv-source"), NULL); if (book == NULL) { g_message("Couldn't Create EBook"); - e_import_complete(ei, target); + e_import_complete (ei, target); g_free (filename); return; } @@ -853,51 +853,51 @@ csv_import (EImport *ei, EImportTarget *target, EImportImporter *im) g_free (filename); if (file == NULL) { g_message("Can't open .csv file"); - e_import_complete(ei, target); - g_object_unref(book); + e_import_complete (ei, target); + g_object_unref (book); return; } - gci = g_malloc0(sizeof(*gci)); + gci = g_malloc0 (sizeof (*gci)); g_datalist_set_data(&target->data, "csv-data", gci); - gci->import = g_object_ref(ei); + gci->import = g_object_ref (ei); gci->target = target; gci->book = book; gci->file = file; gci->fields_map = NULL; gci->count = 0; - fseek(file, 0, SEEK_END); - gci->size = ftell(file); - fseek(file, 0, SEEK_SET); + fseek (file, 0, SEEK_END); + gci->size = ftell (file); + fseek (file, 0, SEEK_SET); - e_book_open(gci->book, FALSE, NULL); + e_book_open (gci->book, FALSE, NULL); gci->idle_id = g_idle_add (csv_import_contacts, gci); } static void -outlook_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im) +outlook_csv_import (EImport *ei, EImportTarget *target, EImportImporter *im) { importer = OUTLOOK_IMPORTER; - csv_import(ei, target, im); + csv_import (ei, target, im); } static void -mozilla_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im) +mozilla_csv_import (EImport *ei, EImportTarget *target, EImportImporter *im) { importer = MOZILLA_IMPORTER; - csv_import(ei, target, im); + csv_import (ei, target, im); } static void -evolution_csv_import(EImport *ei, EImportTarget *target, EImportImporter *im) +evolution_csv_import (EImport *ei, EImportTarget *target, EImportImporter *im) { importer = EVOLUTION_IMPORTER; - csv_import(ei, target, im); + csv_import (ei, target, im); } static void -csv_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) { +csv_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { CSVImporter *gci = g_datalist_get_data(&target->data, "csv-data"); if (gci) @@ -932,7 +932,7 @@ csv_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) gci->file = file; gci->fields_map = NULL; gci->count = 0; - fseek(file, 0, SEEK_END); + fseek (file, 0, SEEK_END); gci->size = ftell (file); fseek (file, 0, SEEK_SET); @@ -1003,7 +1003,7 @@ static EImportImporter csv_evolution_importer = { }; EImportImporter * -evolution_csv_outlook_importer_peek(void) +evolution_csv_outlook_importer_peek (void) { csv_outlook_importer.name = _("Outlook CSV or Tab (.csv, .tab)"); csv_outlook_importer.description = _("Outlook CSV and Tab Importer"); @@ -1012,7 +1012,7 @@ evolution_csv_outlook_importer_peek(void) } EImportImporter * -evolution_csv_mozilla_importer_peek(void) +evolution_csv_mozilla_importer_peek (void) { csv_mozilla_importer.name = _("Mozilla CSV or Tab (.csv, .tab)"); csv_mozilla_importer.description = _("Mozilla CSV and Tab Importer"); @@ -1021,7 +1021,7 @@ evolution_csv_mozilla_importer_peek(void) } EImportImporter * -evolution_csv_evolution_importer_peek(void) +evolution_csv_evolution_importer_peek (void) { csv_evolution_importer.name = _("Evolution CSV or Tab (.csv, .tab)"); csv_evolution_importer.description = _("Evolution CSV and Tab Importer"); diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 9eb9ca5bb6..5d42ff7a00 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -69,7 +69,7 @@ typedef struct { GSList *list_iterator; } LDIFImporter; -static void ldif_import_done(LDIFImporter *gci); +static void ldif_import_done (LDIFImporter *gci); static struct { const gchar *ldif_attribute; @@ -129,7 +129,7 @@ ldif_fields[] = { }; static GString * -getValue( gchar **src ) +getValue ( gchar **src ) { GString *dest = g_string_new(""); gchar *s = *src; @@ -254,16 +254,16 @@ parseLine (GHashTable *dn_contact_hash, EContact *contact, return FALSE; } - colon = (gchar *)strchr( ptr, ':' ); + colon = (gchar *)strchr ( ptr, ':' ); if (colon) { gint i; *colon = 0; value = colon + 1; - while (isspace(*value)) + while (isspace (*value)) value++; - ldif_value = getValue(&value ); + ldif_value = getValue (&value ); field_handled = FALSE; for (i = 0; i < G_N_ELEMENTS (ldif_fields); i++) { @@ -342,7 +342,7 @@ parseLine (GHashTable *dn_contact_hash, EContact *contact, } static EContact * -getNextLDIFEntry(GHashTable *dn_contact_hash, FILE *f ) +getNextLDIFEntry (GHashTable *dn_contact_hash, FILE *f ) { EContact *contact; EContactAddress *work_address, *home_address; @@ -353,7 +353,7 @@ getNextLDIFEntry(GHashTable *dn_contact_hash, FILE *f ) str = g_string_new (""); /* read from the file until we get to a blank line (or eof) */ while (!feof (f)) { - if (!fgets (line, sizeof(line), f)) + if (!fgets (line, sizeof (line), f)) break; if (line[0] == '\n' || (line[0] == '\r' && line[1] == '\n')) break; @@ -469,7 +469,7 @@ add_to_notes (EContact *contact, EContactField field) } static gboolean -ldif_import_contacts(gpointer d) +ldif_import_contacts (gpointer d) { LDIFImporter *gci = d; EContact *contact; @@ -480,15 +480,15 @@ ldif_import_contacts(gpointer d) ones till the end */ if (gci->state == 0) { - while (count < 50 && (contact = getNextLDIFEntry(gci->dn_contact_hash, gci->file))) { + while (count < 50 && (contact = getNextLDIFEntry (gci->dn_contact_hash, gci->file))) { if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - gci->list_contacts = g_slist_prepend(gci->list_contacts, contact); + gci->list_contacts = g_slist_prepend (gci->list_contacts, contact); } else { - add_to_notes(contact, E_CONTACT_OFFICE); - add_to_notes(contact, E_CONTACT_SPOUSE); - add_to_notes(contact, E_CONTACT_BLOG_URL); - e_book_add_contact(gci->book, contact, NULL); - gci->contacts = g_slist_prepend(gci->contacts, contact); + add_to_notes (contact, E_CONTACT_OFFICE); + add_to_notes (contact, E_CONTACT_SPOUSE); + add_to_notes (contact, E_CONTACT_BLOG_URL); + e_book_add_contact (gci->book, contact, NULL); + gci->contacts = g_slist_prepend (gci->contacts, contact); } count++; } @@ -500,8 +500,8 @@ ldif_import_contacts(gpointer d) if (gci->state == 1) { for (iter = gci->list_iterator;count < 50 && iter;iter=iter->next) { contact = iter->data; - resolve_list_card(gci, contact); - e_book_add_contact(gci->book, contact, NULL); + resolve_list_card (gci, contact); + e_book_add_contact (gci->book, contact, NULL); count++; } gci->list_iterator = iter; @@ -509,7 +509,7 @@ ldif_import_contacts(gpointer d) gci->state = 2; } if (gci->state == 2) { - ldif_import_done(gci); + ldif_import_done (gci); return FALSE; } else { e_import_status ( @@ -523,12 +523,12 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { g_datalist_set_data_full(&target->data, "ldif-source", - g_object_ref(e_source_selector_peek_primary_selection(selector)), + g_object_ref (e_source_selector_peek_primary_selection (selector)), g_object_unref); } static GtkWidget * -ldif_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +ldif_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *vbox, *selector; ESource *primary; @@ -547,7 +547,7 @@ ldif_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) primary = g_datalist_get_data(&target->data, "ldif-source"); if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); - g_object_ref(primary); + g_object_ref (primary); g_datalist_set_data_full ( &target->data, "ldif-source", primary, (GDestroyNotify) g_object_unref); @@ -570,7 +570,7 @@ static const gchar *supported_extensions[3] = { }; static gboolean -ldif_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +ldif_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { gchar *ext; gint i; @@ -586,12 +586,12 @@ ldif_supported(EImport *ei, EImportTarget *target, EImportImporter *im) if (strncmp(s->uri_src, "file:///", 8) != 0) return FALSE; - ext = strrchr(s->uri_src, '.'); + ext = strrchr (s->uri_src, '.'); if (ext == NULL) return FALSE; for (i = 0; supported_extensions[i] != NULL; i++) { - if (g_ascii_strcasecmp(supported_extensions[i], ext) == 0) + if (g_ascii_strcasecmp (supported_extensions[i], ext) == 0) return TRUE; } @@ -599,27 +599,27 @@ ldif_supported(EImport *ei, EImportTarget *target, EImportImporter *im) } static void -ldif_import_done(LDIFImporter *gci) +ldif_import_done (LDIFImporter *gci) { if (gci->idle_id) - g_source_remove(gci->idle_id); + g_source_remove (gci->idle_id); fclose (gci->file); - g_object_unref(gci->book); - g_slist_foreach(gci->contacts, (GFunc) g_object_unref, NULL); - g_slist_foreach(gci->list_contacts, (GFunc) g_object_unref, NULL); - g_slist_free(gci->contacts); - g_slist_free(gci->list_contacts); - g_hash_table_destroy(gci->dn_contact_hash); + g_object_unref (gci->book); + g_slist_foreach (gci->contacts, (GFunc) g_object_unref, NULL); + g_slist_foreach (gci->list_contacts, (GFunc) g_object_unref, NULL); + g_slist_free (gci->contacts); + g_slist_free (gci->list_contacts); + g_hash_table_destroy (gci->dn_contact_hash); - e_import_complete(gci->import, gci->target); - g_object_unref(gci->import); + e_import_complete (gci->import, gci->target); + g_object_unref (gci->import); g_free (gci); } static void -ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im) +ldif_import (EImport *ei, EImportTarget *target, EImportImporter *im) { LDIFImporter *gci; EBook *book; @@ -630,43 +630,43 @@ ldif_import(EImport *ei, EImportTarget *target, EImportImporter *im) book = e_book_new(g_datalist_get_data(&target->data, "ldif-source"), NULL); if (book == NULL) { g_message(G_STRLOC ":Couldn't create EBook."); - e_import_complete(ei, target); + e_import_complete (ei, target); return; } - filename = g_filename_from_uri(s->uri_src, NULL, NULL); + filename = g_filename_from_uri (s->uri_src, NULL, NULL); if (filename != NULL) { file = g_fopen(filename, "r"); g_free (filename); } if (file == NULL) { g_message(G_STRLOC ":Can't open .ldif file"); - e_import_complete(ei, target); - g_object_unref(book); + e_import_complete (ei, target); + g_object_unref (book); return; } - gci = g_malloc0(sizeof(*gci)); + gci = g_malloc0 (sizeof (*gci)); g_datalist_set_data(&target->data, "ldif-data", gci); - gci->import = g_object_ref(ei); + gci->import = g_object_ref (ei); gci->target = target; gci->book = book; gci->file = file; - fseek(file, 0, SEEK_END); - gci->size = ftell(file); - fseek(file, 0, SEEK_SET); + fseek (file, 0, SEEK_END); + gci->size = ftell (file); + fseek (file, 0, SEEK_SET); gci->dn_contact_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) NULL); - e_book_open(gci->book, FALSE, NULL); + e_book_open (gci->book, FALSE, NULL); - gci->idle_id = g_idle_add(ldif_import_contacts, gci); + gci->idle_id = g_idle_add (ldif_import_contacts, gci); } static void -ldif_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) +ldif_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { LDIFImporter *gci = g_datalist_get_data(&target->data, "ldif-data"); @@ -706,9 +706,9 @@ ldif_get_preview (EImport *ei, EImportTarget *target, EImportImporter *im) while (contact = getNextLDIFEntry (dn_contact_hash, file), contact != NULL) { if (!e_contact_get (contact, E_CONTACT_IS_LIST)) { - add_to_notes(contact, E_CONTACT_OFFICE); - add_to_notes(contact, E_CONTACT_SPOUSE); - add_to_notes(contact, E_CONTACT_BLOG_URL); + add_to_notes (contact, E_CONTACT_OFFICE); + add_to_notes (contact, E_CONTACT_SPOUSE); + add_to_notes (contact, E_CONTACT_BLOG_URL); } contacts = g_list_prepend (contacts, contact); @@ -737,7 +737,7 @@ static EImportImporter ldif_importer = { }; EImportImporter * -evolution_ldif_importer_peek(void) +evolution_ldif_importer_peek (void) { ldif_importer.name = _("LDAP Data Interchange Format (.ldif)"); ldif_importer.description = _("Evolution LDIF importer"); diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 1bcd6d6540..efdf3b362c 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -64,7 +64,7 @@ typedef struct { EBook *book; } VCardImporter; -static void vcard_import_done(VCardImporter *gci); +static void vcard_import_done (VCardImporter *gci); static void add_to_notes (EContact *contact, EContactField field) @@ -91,7 +91,7 @@ add_to_notes (EContact *contact, EContactField field) } static void -vcard_import_contact(VCardImporter *gci, EContact *contact) +vcard_import_contact (VCardImporter *gci, EContact *contact) { EContactPhoto *photo; GList *attrs, *attr; @@ -239,7 +239,7 @@ vcard_import_contact(VCardImporter *gci, EContact *contact) } static gboolean -vcard_import_contacts(gpointer data) +vcard_import_contacts (gpointer data) { VCardImporter *gci = data; gint count = 0; @@ -247,7 +247,7 @@ vcard_import_contacts(gpointer data) if (gci->state == 0) { while (count < 50 && iterator) { - vcard_import_contact(gci, iterator->data); + vcard_import_contact (gci, iterator->data); count++; iterator = iterator->next; } @@ -257,7 +257,7 @@ vcard_import_contacts(gpointer data) gci->state = 1; } if (gci->state == 1) { - vcard_import_done(gci); + vcard_import_done (gci); return FALSE; } else { e_import_status ( @@ -385,12 +385,12 @@ static void primary_selection_changed_cb (ESourceSelector *selector, EImportTarget *target) { g_datalist_set_data_full(&target->data, "vcard-source", - g_object_ref(e_source_selector_peek_primary_selection(selector)), + g_object_ref (e_source_selector_peek_primary_selection (selector)), g_object_unref); } static GtkWidget * -vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) +vcard_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *vbox, *selector; ESource *primary; @@ -409,7 +409,7 @@ vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) primary = g_datalist_get_data(&target->data, "vcard-source"); if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); - g_object_ref(primary); + g_object_ref (primary); g_datalist_set_data_full ( &target->data, "vcard-source", primary, (GDestroyNotify) g_object_unref); @@ -428,7 +428,7 @@ vcard_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) } static gboolean -vcard_supported(EImport *ei, EImportTarget *target, EImportImporter *im) +vcard_supported (EImport *ei, EImportTarget *target, EImportImporter *im) { EImportTargetURI *s; gchar *filename; @@ -447,29 +447,29 @@ vcard_supported(EImport *ei, EImportTarget *target, EImportImporter *im) filename = g_filename_from_uri (s->uri_src, NULL, NULL); if (filename == NULL) return FALSE; - retval = (guess_vcard_encoding(filename) != VCARD_ENCODING_NONE); + retval = (guess_vcard_encoding (filename) != VCARD_ENCODING_NONE); g_free (filename); return retval; } static void -vcard_import_done(VCardImporter *gci) +vcard_import_done (VCardImporter *gci) { if (gci->idle_id) - g_source_remove(gci->idle_id); + g_source_remove (gci->idle_id); g_object_unref (gci->book); g_list_foreach (gci->contactlist, (GFunc) g_object_unref, NULL); g_list_free (gci->contactlist); - e_import_complete(gci->import, gci->target); - g_object_unref(gci->import); + e_import_complete (gci->import, gci->target); + g_object_unref (gci->import); g_free (gci); } static void -vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im) +vcard_import (EImport *ei, EImportTarget *target, EImportImporter *im) { VCardImporter *gci; gchar *contents; @@ -478,18 +478,18 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im) EImportTargetURI *s = (EImportTargetURI *)target; gchar *filename; - filename = g_filename_from_uri(s->uri_src, NULL, NULL); + filename = g_filename_from_uri (s->uri_src, NULL, NULL); if (filename == NULL) { g_message(G_STRLOC ": Couldn't get filename from URI '%s'", s->uri_src); - e_import_complete(ei, target); + e_import_complete (ei, target); return; } - encoding = guess_vcard_encoding(filename); + encoding = guess_vcard_encoding (filename); if (encoding == VCARD_ENCODING_NONE) { g_free (filename); /* This check is superfluous, we've already * checked otherwise we can't get here ... */ - e_import_complete(ei, target); + e_import_complete (ei, target); return; } @@ -497,22 +497,22 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im) if (book == NULL) { g_message(G_STRLOC ":Couldn't create EBook."); g_free (filename); - e_import_complete(ei, target); + e_import_complete (ei, target); return; } if (!g_file_get_contents (filename, &contents, NULL, NULL)) { g_message (G_STRLOC ":Couldn't read file."); g_free (filename); - e_import_complete(ei, target); - g_object_unref(book); + e_import_complete (ei, target); + g_object_unref (book); return; } g_free (filename); - gci = g_malloc0(sizeof(*gci)); + gci = g_malloc0 (sizeof (*gci)); g_datalist_set_data(&target->data, "vcard-data", gci); - gci->import = g_object_ref(ei); + gci->import = g_object_ref (ei); gci->target = target; gci->book = book; @@ -535,16 +535,16 @@ vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im) gci->contactlist = eab_contact_list_from_string (contents); g_free (contents); gci->iterator = gci->contactlist; - gci->total = g_list_length(gci->contactlist); + gci->total = g_list_length (gci->contactlist); if (gci->iterator) - gci->idle_id = g_idle_add(vcard_import_contacts, gci); + gci->idle_id = g_idle_add (vcard_import_contacts, gci); else - vcard_import_done(gci); + vcard_import_done (gci); } static void -vcard_cancel(EImport *ei, EImportTarget *target, EImportImporter *im) +vcard_cancel (EImport *ei, EImportTarget *target, EImportImporter *im) { VCardImporter *gci = g_datalist_get_data(&target->data, "vcard-data"); @@ -618,7 +618,7 @@ static EImportImporter vcard_importer = { }; EImportImporter * -evolution_vcard_importer_peek(void) +evolution_vcard_importer_peek (void) { vcard_importer.name = _("vCard (.vcf, .gcrd)"); vcard_importer.description = _("Evolution vCard Importer"); |