From f014ab82c81078d60cb1df8c986305c2cc9948c2 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 4 Jun 2011 15:53:10 -0500 Subject: Coding style and whitespace cleanups. --- plugins/bbdb/gaimbuddies.c | 23 ++++++-- plugins/dbx-import/dbx-importer.c | 29 ++++++---- plugins/save-calendar/csv-format.c | 112 +++++++++++++++++++++++++------------ 3 files changed, 111 insertions(+), 53 deletions(-) (limited to 'plugins') diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c index 164cf53e10..f6a048e975 100644 --- a/plugins/bbdb/gaimbuddies.c +++ b/plugins/bbdb/gaimbuddies.c @@ -118,8 +118,9 @@ bbdb_sync_buddy_list_check (void) return; } - /* Reprocess the buddy list if it's been updated. */ gconf = gconf_client_get_default (); + + /* Reprocess the buddy list if it's been updated. */ last_sync_str = gconf_client_get_string ( gconf, GCONF_KEY_GAIM_LAST_SYNC_TIME, NULL); if (last_sync_str == NULL || !strcmp ((const gchar *)last_sync_str, "")) @@ -135,8 +136,10 @@ bbdb_sync_buddy_list_check (void) return; } - last_sync_str = gconf_client_get_string (gconf, GCONF_KEY_GAIM_LAST_SYNC_MD5, NULL); - g_object_unref (G_OBJECT (gconf)); + last_sync_str = gconf_client_get_string ( + gconf, GCONF_KEY_GAIM_LAST_SYNC_MD5, NULL); + + g_object_unref (gconf); md5 = get_md5_as_string (blist_path); @@ -224,12 +227,16 @@ bbdb_sync_buddy_list_in_thread (gpointer data) } /* Look for an exact match full name == buddy alias */ - query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); + query = e_book_query_field_test ( + E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); + if (!e_book_get_contacts (std->book, query, &contacts, NULL)) { e_book_query_unref (query); continue; } + e_book_query_unref (query); + if (contacts != NULL) { /* FIXME: If there's more than one contact with this @@ -486,7 +493,9 @@ bbdb_get_gaim_buddy_list (void) } } if (blist == NULL) { - fprintf (stderr, "bbdb: Could not find 'blist' element in Pidgin buddy list.\n"); + fprintf ( + stderr, "bbdb: Could not find 'blist' " + "element in Pidgin buddy list.\n"); xmlFreeDoc (buddy_xml); return NULL; } @@ -580,7 +589,9 @@ parse_contact (xmlNodePtr contact, GList **buddies, GSList *blocked) for (child = buddy->children; child != NULL && !is_blocked; child = child->next) { if (!strcmp ((const gchar *)child->name, "setting")) { gchar *setting_type; - setting_type = e_xml_get_string_prop_by_name (child, (const guchar *)"name"); + + setting_type = e_xml_get_string_prop_by_name ( + child, (const guchar *)"name"); if (!strcmp ((const gchar *)setting_type, "buddy_icon")) gb->icon = get_buddy_icon_from_setting (child); diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c index 9b6f44c171..1c977750b1 100644 --- a/plugins/dbx-import/dbx-importer.c +++ b/plugins/dbx-import/dbx-importer.c @@ -219,22 +219,31 @@ org_gnome_evolution_readdbx_getwidget (EImport *ei, view = e_shell_window_get_active_view (shell_window); if (view && g_str_equal (view, "mail")) { - EShellView *shell_view = e_shell_window_get_shell_view (shell_window, view); + EShellView *shell_view; + EMFolderTree *folder_tree = NULL; + EShellSidebar *shell_sidebar; - if (shell_view) { - EMFolderTree *folder_tree = NULL; - EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + shell_view = e_shell_window_get_shell_view ( + shell_window, view); - g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + shell_sidebar = e_shell_view_get_shell_sidebar ( + shell_view); - if (folder_tree) - select_uri = em_folder_tree_get_selected_uri (folder_tree); - } + g_object_get ( + shell_sidebar, "folder-tree", + &folder_tree, NULL); + + select_uri = em_folder_tree_get_selected_uri ( + folder_tree); } } #endif - if (!select_uri) - select_uri = g_strdup (e_mail_local_get_folder_uri (E_MAIL_LOCAL_FOLDER_INBOX)); + if (!select_uri) { + const gchar *local_inbox_uri; + local_inbox_uri = e_mail_local_get_folder_uri ( + E_MAIL_LOCAL_FOLDER_INBOX); + select_uri = g_strdup (local_inbox_uri); + } hbox = gtk_hbox_new (FALSE, 0); diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c index 8692908544..15ed83817e 100644 --- a/plugins/save-calendar/csv-format.c +++ b/plugins/save-calendar/csv-format.c @@ -154,10 +154,9 @@ add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config) struct tm mytm = icaltimetype_to_tm (time); gchar *str = (gchar *) g_malloc (sizeof (gchar) * 200); - /* - * Translator: the %F %T is the thirth argument for a strftime function. - * It lets you define the formatting of the date in the csv-file. - * */ + /* Translators: the %F %T is the third argument for a + * strftime function. It lets you define the formatting + * of the date in the csv-file. */ e_utf8_strftime (str, 200, _("%F %T"), &mytm); needquotes = string_needsquotes (str, config); @@ -332,7 +331,9 @@ do_save_calendar_csv (FormatHandler *handler, /* open source client */ source_client = e_auth_new_cal_from_source (primary_source, type); if (!e_cal_open (source_client, TRUE, &error)) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); + display_error_message ( + gtk_widget_get_toplevel (GTK_WIDGET (selector)), + error); g_object_unref (source_client); g_error_free (error); return; @@ -346,13 +347,15 @@ do_save_calendar_csv (FormatHandler *handler, config->newline = userstring_to_systemstring (tmp?tmp:"\\n"); tmp = gtk_entry_get_text (GTK_ENTRY (d->quote_entry)); config->quote = userstring_to_systemstring (tmp?tmp:"\""); - config->header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d->header_check)); + config->header = gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (d->header_check)); stream = open_for_writing ( GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error); - if (stream && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) { + if (stream && e_cal_get_object_list_as_comp ( + source_client, "#t", &objects, NULL)) { if (config->header) { @@ -381,13 +384,15 @@ do_save_calendar_csv (FormatHandler *handler, line = g_string_new (""); for (i=0;i0) - line = g_string_append (line, config->delimiter); - line = g_string_append (line, _(labels[i])); + g_string_append (line, config->delimiter); + g_string_append (line, _(labels[i])); } - line = g_string_append (line, config->newline); + g_string_append (line, config->newline); - g_output_stream_write_all (stream, line->str, line->len, NULL, NULL, NULL); + g_output_stream_write_all ( + stream, line->str, line->len, + NULL, NULL, NULL); g_string_free (line, TRUE); } @@ -408,20 +413,24 @@ do_save_calendar_csv (FormatHandler *handler, line = add_string_to_csv (line, temp_constchar, config); e_cal_component_get_summary (comp, &temp_comptext); - line = add_string_to_csv (line, temp_comptext.value, config); + line = add_string_to_csv ( + line, temp_comptext.value, config); e_cal_component_get_description_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); + line = add_list_to_csv ( + line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); e_cal_component_get_categories_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, CONSTCHAR); + line = add_list_to_csv ( + line, temp_list, config, CONSTCHAR); if (temp_list) e_cal_component_free_categories_list (temp_list); e_cal_component_get_comment_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); + line = add_list_to_csv ( + line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); @@ -436,20 +445,27 @@ do_save_calendar_csv (FormatHandler *handler, e_cal_component_free_icaltimetype (temp_time); e_cal_component_get_contact_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); + line = add_list_to_csv ( + line, temp_list, config, ECALCOMPONENTTEXT); if (temp_list) e_cal_component_free_text_list (temp_list); e_cal_component_get_dtstart (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); + line = add_time_to_csv ( + line, temp_dt.value ? + temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_dtend (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); + line = add_time_to_csv ( + line, temp_dt.value ? + temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_due (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); + line = add_time_to_csv ( + line, temp_dt.value ? + temp_dt.value : NULL, config); e_cal_component_free_datetime (&temp_dt); e_cal_component_get_percent (comp, &temp_int); @@ -463,11 +479,15 @@ do_save_calendar_csv (FormatHandler *handler, if (e_cal_component_has_attendees (comp)) { e_cal_component_get_attendee_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTATTENDEE); + line = add_list_to_csv ( + line, temp_list, config, + ECALCOMPONENTATTENDEE); if (temp_list) e_cal_component_free_attendee_list (temp_list); } else { - line = add_list_to_csv (line, NULL, config, ECALCOMPONENTATTENDEE); + line = add_list_to_csv ( + line, NULL, config, + ECALCOMPONENTATTENDEE); } e_cal_component_get_location (comp, &temp_constchar); @@ -487,14 +507,17 @@ do_save_calendar_csv (FormatHandler *handler, /* Important note! * The documentation is not requiring this! * - * if (temp_time) e_cal_component_free_icaltimetype (temp_time); + * if (temp_time) + * e_cal_component_free_icaltimetype (temp_time); * * Please uncomment and fix documentation if untrue * http://www.gnome.org/projects/evolution/ * developer-doc/libecal/ECalComponent.html * #e-cal-component-get-last-modified */ - g_output_stream_write_all (stream, line->str, line->len, NULL, NULL, &error); + g_output_stream_write_all ( + stream, line->str, line->len, + NULL, NULL, &error); /* It's written, so we can free it */ g_string_free (line, TRUE); @@ -516,7 +539,9 @@ do_save_calendar_csv (FormatHandler *handler, g_free (config); if (error) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error); + display_error_message ( + gtk_widget_get_toplevel (GTK_WIDGET (selector)), + error); g_error_free (error); } @@ -535,7 +560,8 @@ create_options_widget (FormatHandler *handler) d->delimiter_entry = gtk_entry_new (); d->newline_entry = gtk_entry_new (); d->quote_entry = gtk_entry_new (); - d->header_check = gtk_check_button_new_with_mnemonic (_("Prepend a _header")); + d->header_check = gtk_check_button_new_with_mnemonic ( + _("Prepend a _header")); /* Advanced CSV options */ gtk_entry_set_text (GTK_ENTRY(d->delimiter_entry), ", "); @@ -547,24 +573,36 @@ create_options_widget (FormatHandler *handler) label = gtk_label_new_with_mnemonic (_("_Value delimiter:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), d->delimiter_entry); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->delimiter_entry, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), label, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), d->delimiter_entry, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); label = gtk_label_new_with_mnemonic (_("_Record delimiter:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), d->newline_entry); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->newline_entry, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), label, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), d->newline_entry, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); label = gtk_label_new_with_mnemonic (_("_Encapsulate values with:")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), d->quote_entry); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->quote_entry, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), label, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_table_attach ( + GTK_TABLE (table), d->quote_entry, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); gtk_box_pack_start (GTK_BOX (vbox), d->header_check, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); -- cgit v1.2.3