Commit fcbbdfbd authored by Matthew Barnes's avatar Matthew Barnes
Browse files

Coding style and whitespace cleanup.

parent f78417c4
......@@ -30,7 +30,7 @@
#include <atk/atkobject.h>
#define EA_FACTORY_PARTA_GOBJECT(type, type_as_function, opt_create_accessible) \
static AtkObject* \
static AtkObject * \
type_as_function ## _factory_create_accessible (GObject *obj) \
{ \
AtkObject *accessible; \
......@@ -40,7 +40,7 @@ type_as_function ## _factory_create_accessible (GObject *obj) \
}
#define EA_FACTORY_PARTA(type, type_as_function, opt_create_accessible) \
static AtkObject* \
static AtkObject * \
type_as_function ## _factory_create_accessible (GObject *obj) \
{ \
GtkWidget *widget; \
......
......@@ -36,7 +36,7 @@ type_as_function ## _factory_get_accessible_type (void) \
return type; \
} \
\
static AtkObject* \
static AtkObject * \
type_as_function ## _factory_create_accessible (GObject *obj) \
{ \
GtkWidget *widget; \
......
......@@ -28,12 +28,12 @@
#include "gal-a11y-util.h"
GType
gal_a11y_type_register_static_with_private (GType parent_type,
const gchar *type_name,
GTypeInfo *info,
GTypeFlags flags,
gint priv_size,
gint *priv_offset)
gal_a11y_type_register_static_with_private (GType parent_type,
const gchar *type_name,
GTypeInfo *info,
GTypeFlags flags,
gint priv_size,
gint *priv_offset)
{
GTypeQuery query;
......
......@@ -249,7 +249,7 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
GTK_WINDOW (e_contact_editor_fullname), "contact-new");
}
GtkWidget*
GtkWidget *
e_contact_editor_fullname_new (const EContactName *name)
{
GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL);
......
......@@ -76,11 +76,11 @@ enum {
static void e_contact_editor_init (EContactEditor *editor);
static void e_contact_editor_class_init (EContactEditorClass *klass);
static void e_contact_editor_set_property (GObject *object,
guint prop_id,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void e_contact_editor_get_property (GObject *object,
guint prop_id,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void e_contact_editor_dispose (GObject *object);
......@@ -488,7 +488,7 @@ name_to_style (const EContactName *name,
string = g_strjoinv(" ", strings);
break;
case 2:
midstrptr=midstring;
midstrptr = midstring;
if (name) {
if (name->family && *name->family)
*(midstrptr++) = name->family;
......@@ -567,7 +567,8 @@ file_as_get_style (EContactEditor *editor)
}
static void
file_as_set_style (EContactEditor *editor, gint style)
file_as_set_style (EContactEditor *editor,
gint style)
{
gchar *string;
gint i;
......@@ -1008,7 +1009,8 @@ get_ui_slot (EVCardAttribute *attr)
}
static void
set_ui_slot (EVCardAttribute *attr, gint slot)
set_ui_slot (EVCardAttribute *attr,
gint slot)
{
EVCardAttributeParam *param;
gchar *slot_str;
......@@ -1524,7 +1526,8 @@ extract_phone (EContactEditor *editor)
}
static void
init_phone_record_type (EContactEditor *editor, gint record)
init_phone_record_type (EContactEditor *editor,
gint record)
{
GtkWidget *phone_type_combo_box;
GtkWidget *phone_entry;
......@@ -1945,7 +1948,8 @@ extract_im (EContactEditor *editor)
}
static void
sensitize_im_types (EContactEditor *editor, GtkWidget *combo_box)
sensitize_im_types (EContactEditor *editor,
GtkWidget *combo_box)
{
GtkTreeModel *model;
GtkTreeIter iter;
......@@ -1971,7 +1975,9 @@ sensitize_im_types (EContactEditor *editor, GtkWidget *combo_box)
}
static void
sensitize_im_record (EContactEditor *editor, gint record, gboolean enabled)
sensitize_im_record (EContactEditor *editor,
gint record,
gboolean enabled)
{
GtkWidget *service_combo_box;
#ifdef ENABLE_IM_LOCATION
......@@ -2038,7 +2044,8 @@ init_personal (EContactEditor *editor)
}
static void
init_address_textview (EContactEditor *editor, gint record)
init_address_textview (EContactEditor *editor,
gint record)
{
gchar *textview_name;
GtkWidget *textview;
......@@ -2078,7 +2085,8 @@ init_address_field (EContactEditor *editor,
}
static void
init_address_record (EContactEditor *editor, gint record)
init_address_record (EContactEditor *editor,
gint record)
{
init_address_textview (editor, record);
init_address_field (editor, record, "city");
......@@ -2325,7 +2333,8 @@ set_address_label (EContact *contact,
}
static void
extract_address_record (EContactEditor *editor, gint record)
extract_address_record (EContactEditor *editor,
gint record)
{
EContactAddress *address;
......@@ -2411,7 +2420,9 @@ sensitize_address_field (EContactEditor *editor,
}
static void
sensitize_address_record (EContactEditor *editor, gint record, gboolean enabled)
sensitize_address_record (EContactEditor *editor,
gint record,
gboolean enabled)
{
sensitize_address_textview (editor, record, enabled);
sensitize_address_field (editor, record, "city", enabled);
......@@ -2520,7 +2531,8 @@ static FieldMapping simple_field_map[] = {
};
static void
init_simple_field (EContactEditor *editor, GtkWidget *widget)
init_simple_field (EContactEditor *editor,
GtkWidget *widget)
{
GObject *changed_object = NULL;
......@@ -2569,7 +2581,9 @@ init_simple_field (EContactEditor *editor, GtkWidget *widget)
}
static void
fill_in_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
fill_in_simple_field (EContactEditor *editor,
GtkWidget *widget,
gint field_id)
{
EContact *contact;
......@@ -2707,9 +2721,9 @@ extract_simple_field (EContactEditor *editor,
EContactDate date;
if (e_date_edit_get_date (
E_DATE_EDIT (widget),
(gint *)&date.year,
(gint *)&date.month,
(gint *)&date.day))
(gint *) &date.year,
(gint *) &date.month,
(gint *) &date.day))
e_contact_set (contact, field_id, &date);
else
e_contact_set (contact, field_id, NULL);
......@@ -2809,7 +2823,8 @@ extract_simple_field (EContactEditor *editor,
}
static void
sensitize_simple_field (GtkWidget *widget, gboolean enabled)
sensitize_simple_field (GtkWidget *widget,
gboolean enabled)
{
if (GTK_IS_ENTRY (widget))
gtk_editable_set_editable (GTK_EDITABLE (widget), enabled);
......@@ -3258,7 +3273,7 @@ categories_clicked (GtkWidget *button,
return;
}
g_signal_connect(dialog, "response",
g_signal_connect (dialog, "response",
G_CALLBACK (categories_response), editor);
/* Close the category dialog if the editor is closed*/
......@@ -3649,7 +3664,8 @@ save_contact (EContactEditor *ce,
}
static void
e_contact_editor_save_contact (EABEditor *editor, gboolean should_close)
e_contact_editor_save_contact (EABEditor *editor,
gboolean should_close)
{
save_contact (E_CONTACT_EDITOR (editor), should_close);
}
......@@ -3782,7 +3798,7 @@ e_contact_editor_is_changed (EABEditor *editor)
return E_CONTACT_EDITOR (editor)->changed;
}
static GtkWindow*
static GtkWindow *
e_contact_editor_get_window (EABEditor *editor)
{
return GTK_WINDOW (E_CONTACT_EDITOR (editor)->app);
......@@ -3837,14 +3853,17 @@ app_delete_event_cb (GtkWidget *widget,
}
static void
show_help_cb (GtkWidget *widget, gpointer data)
show_help_cb (GtkWidget *widget,
gpointer data)
{
/* FIXME Pass a proper parent window. */
e_display_help (NULL, "usage-contact-cards");
}
static GList *
add_to_tab_order (GList *list, GtkBuilder *builder, const gchar *name)
add_to_tab_order (GList *list,
GtkBuilder *builder,
const gchar *name)
{
GtkWidget *widget = e_builder_get_widget (builder, name);
return g_list_prepend (list, widget);
......@@ -3857,7 +3876,7 @@ setup_tab_order (GtkBuilder *builder)
GList *list = NULL;
/*
container = e_builder_get_widget(builder, "table-contact-editor-general");
*
if (container) {
list = add_to_tab_order(list, builder, "entry-fullname");
list = add_to_tab_order(list, builder, "entry-jobtitle");
......@@ -3867,7 +3886,7 @@ setup_tab_order (GtkBuilder *builder)
list = add_to_tab_order(list, builder, "entry-phone-2");
list = add_to_tab_order(list, builder, "entry-phone-3");
list = add_to_tab_order(list, builder, "entry-phone-4");
*
list = add_to_tab_order(list, builder, "entry-email1");
list = add_to_tab_order(list, builder, "alignment-htmlmail");
list = add_to_tab_order(list, builder, "entry-web");
......@@ -4253,12 +4272,16 @@ e_contact_editor_new (EShell *shell,
}
static void
notify_readonly_cb (EBookClient *book_client, GParamSpec *pspec, EContactEditor *ce)
notify_readonly_cb (EBookClient *book_client,
GParamSpec *pspec,
EContactEditor *ce)
{
EClient *client;
gint new_target_editable;
gboolean changed = FALSE;
new_target_editable = !e_client_is_readonly (E_CLIENT (ce->target_client));
client = E_CLIENT (ce->target_client);
new_target_editable = !e_client_is_readonly (client);
if (ce->target_editable != new_target_editable)
changed = TRUE;
......@@ -4271,7 +4294,7 @@ notify_readonly_cb (EBookClient *book_client, GParamSpec *pspec, EContactEditor
static void
e_contact_editor_set_property (GObject *object,
guint prop_id,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
......@@ -4279,7 +4302,7 @@ e_contact_editor_set_property (GObject *object,
editor = E_CONTACT_EDITOR (object);
switch (prop_id) {
switch (property_id) {
case PROP_SOURCE_CLIENT: {
gboolean writable;
gboolean changed = FALSE;
......@@ -4429,14 +4452,14 @@ e_contact_editor_set_property (GObject *object,
NULL, g_value_get_pointer (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
e_contact_editor_get_property (GObject *object,
guint prop_id,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
......@@ -4444,7 +4467,7 @@ e_contact_editor_get_property (GObject *object,
e_contact_editor = E_CONTACT_EDITOR (object);
switch (prop_id) {
switch (property_id) {
case PROP_SOURCE_CLIENT:
g_value_set_object (value, e_contact_editor->source_client);
break;
......@@ -4480,7 +4503,7 @@ e_contact_editor_get_property (GObject *object,
g_value_set_pointer (value, e_contact_editor->required_fields);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
......
......@@ -91,7 +91,8 @@ quick_add_unref (QuickAdd *qa)
}
static void
quick_add_set_name (QuickAdd *qa, const gchar *name)
quick_add_set_name (QuickAdd *qa,
const gchar *name)
{
if (name == qa->name)
return;
......@@ -101,7 +102,8 @@ quick_add_set_name (QuickAdd *qa, const gchar *name)
}
static void
quick_add_set_email (QuickAdd *qa, const gchar *email)
quick_add_set_email (QuickAdd *qa,
const gchar *email)
{
if (email == qa->email)
return;
......@@ -111,7 +113,8 @@ quick_add_set_email (QuickAdd *qa, const gchar *email)
}
static void
quick_add_set_vcard (QuickAdd *qa, const gchar *vcard)
quick_add_set_vcard (QuickAdd *qa,
const gchar *vcard)
{
if (vcard == qa->vcard)
return;
......@@ -332,7 +335,9 @@ edit_contact (QuickAdd *qa)
#define QUICK_ADD_RESPONSE_EDIT_FULL 2
static void
clicked_cb (GtkWidget *w, gint button, gpointer closure)
clicked_cb (GtkWidget *w,
gint button,
gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
......@@ -400,7 +405,8 @@ sanitize_widgets (QuickAdd *qa)
}
static void
source_changed (ESourceComboBox *source_combo_box, QuickAdd *qa)
source_changed (ESourceComboBox *source_combo_box,
QuickAdd *qa)
{
ESource *source;
......@@ -423,7 +429,7 @@ build_quick_add_dialog (QuickAdd *qa)
GtkWidget *label;
GtkTable *table;
ESource *source;
const gint xpad=0, ypad=0;
const gint xpad = 0, ypad = 0;
g_return_val_if_fail (qa != NULL, NULL);
......@@ -480,7 +486,7 @@ build_quick_add_dialog (QuickAdd *qa)
gtk_table_set_col_spacings (table, 12);
label = gtk_label_new_with_mnemonic (_("_Full name"));
gtk_label_set_mnemonic_widget ((GtkLabel*) label, qa->name_entry);
gtk_label_set_mnemonic_widget ((GtkLabel *) label, qa->name_entry);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (table, label,
......@@ -522,8 +528,10 @@ build_quick_add_dialog (QuickAdd *qa)
}
void
e_contact_quick_add (const gchar *in_name, const gchar *email,
EContactQuickAddCallback cb, gpointer closure)
e_contact_quick_add (const gchar *in_name,
const gchar *email,
EContactQuickAddCallback cb,
gpointer closure)
{
QuickAdd *qa;
GtkWidget *dialog;
......@@ -543,10 +551,10 @@ e_contact_quick_add (const gchar *in_name, const gchar *email,
/* Remove extra whitespace and the quotes some mailers put around names. */
g_strstrip (name);
len = strlen (name);
if ((name[0] == '\'' && name[len-1] == '\'') ||
if ((name[0] == '\'' && name[len - 1] == '\'') ||
(name[0] == '"' && name[len-1] == '"')) {
name[0] = ' ';
name[len-1] = ' ';
name[len - 1] = ' ';
}
g_strstrip (name);
}
......@@ -570,7 +578,7 @@ e_contact_quick_add_free_form (const gchar *text,
EContactQuickAddCallback cb,
gpointer closure)
{
gchar *name=NULL, *email=NULL;
gchar *name = NULL, *email = NULL;
const gchar *last_at, *s;
gboolean in_quote;
......@@ -612,7 +620,7 @@ e_contact_quick_add_free_form (const gchar *text,
/* ...and then split the text there */
if (!bad_char) {
if (text < last_at)
name = g_strndup (text, last_at-text);
name = g_strndup (text, last_at - text);
email = g_strdup (last_at);
}
}
......@@ -629,8 +637,8 @@ e_contact_quick_add_free_form (const gchar *text,
*email = ' ';
changed = TRUE;
}
if (email[strlen (email)-1] == '>') {
email[strlen (email)-1] = ' ';
if (email[strlen (email) - 1] == '>') {
email[strlen (email) - 1] = ' ';
changed = TRUE;
}
if (changed)
......
......@@ -301,7 +301,8 @@ eab_editor_raise (EABEditor *editor)
}
void
eab_editor_save_contact (EABEditor *editor, gboolean should_close)
eab_editor_save_contact (EABEditor *editor,
gboolean should_close)
{
EABEditorClass *class;
......@@ -339,7 +340,7 @@ eab_editor_is_valid (EABEditor *editor)
return class->is_valid (editor);
}
GtkWindow*
GtkWindow *
eab_editor_get_window (EABEditor *editor)
{
EABEditorClass *class;
......@@ -353,11 +354,12 @@ eab_editor_get_window (EABEditor *editor)
}
/* This function prompts for saving if editor conents are in changed state and
save or discards or cancels (just returns with out doing anything) according
to user input. Editor gets destroyed in case of save and discard case. */
* save or discards or cancels (just returns with out doing anything) according
* to user input. Editor gets destroyed in case of save and discard case. */
gboolean
eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window)
eab_editor_prompt_to_save_changes (EABEditor *editor,
GtkWindow *window)
{
if (!eab_editor_is_changed (editor)) {
eab_editor_close (EAB_EDITOR (editor));
......
......@@ -68,7 +68,7 @@ struct _EABEditorClass {
void (* save_contact) (EABEditor *editor, gboolean should_close);
gboolean (* is_valid) (EABEditor *editor);
gboolean (* is_changed) (EABEditor *editor);
GtkWindow* (* get_window) (EABEditor *editor);
GtkWindow * (* get_window) (EABEditor *editor);
/* signals */
void (* contact_added) (EABEditor *editor, const GError *error, EContact *contact);
......
......@@ -67,7 +67,8 @@ read_file (gchar *name)
/* Callback used when a contact editor is closed */
static void
editor_closed_cb (EContactEditor *ce, gpointer data)
editor_closed_cb (EContactEditor *ce,
gpointer data)
{
static gint count = 2;
......@@ -79,7 +80,8 @@ editor_closed_cb (EContactEditor *ce, gpointer data)
}
gint
main (gint argc, gchar *argv[])
main (gint argc,
gchar *argv[])
{
gchar *cardstr;
EContactEditor *ce;
......
......@@ -258,7 +258,7 @@ contact_list_editor_add_destination (GtkWidget *widget,
static void
contact_list_editor_add_email (EContactListEditor *editor,
const gchar *email)
const gchar *email)
{
CamelInternetAddress *addr;
EContactListEditorPrivate *priv = editor->priv;
......@@ -424,7 +424,7 @@ contact_list_editor_render_destination (GtkTreeViewColumn *column,
static void
contact_list_editor_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
gpointer user_data)
{
EContactListEditor *editor = user_data;
GtkTreeModel *model;
......@@ -545,15 +545,17 @@ contact_list_editor_delete_event_cb (GtkWidget *widget,
void
contact_list_editor_drag_data_received_cb (GtkWidget *widget,
GdkDragContext *context,
gint x, gint y,
GtkSelectionData *selection_data,
guint info,
guint time);
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time);
void
contact_list_editor_drag_data_received_cb (GtkWidget *widget,
GdkDragContext *context,
gint x, gint y,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time)
......@@ -695,7 +697,7 @@ contact_list_editor_email_entry_key_press_event_cb (GtkWidget *widget,
gint cpos = -1;
entry = GTK_ENTRY (WIDGET (EMAIL_ENTRY));
g_object_get (G_OBJECT (entry), "cursor-position", &cpos, NULL);
g_object_get (entry, "cursor-position", &cpos, NULL);
/* not the first letter */
if (cpos > 0) {
......@@ -817,7 +819,7 @@ contact_list_editor_remove_button_clicked_cb (GtkWidget *widget)
}
/* new_selection != NULL when there is at least one item below the
removed selection */
* removed selection */
if (new_selection) {
path = gtk_tree_row_reference_get_path (new_selection);
gtk_tree_selection_select_path (selection, path);
......@@ -825,7 +827,7 @@ contact_list_editor_remove_button_clicked_cb (GtkWidget *widget)
gtk_tree_row_reference_free (new_selection);
} else {
/* If selection was including the last item in the list, then
find and select the new last item */
* find and select the new last item */
GtkTreeIter iter, iter2;
/* When FALSE is returned, there are no items in the list to be selected */
......@@ -1157,7 +1159,7 @@ setup_custom_widgets (EContactListEditor *editor)
combo_box = WIDGET (SOURCE_MENU);
if (!e_book_client_get_sources (&source_list, &error))
source_list = NULL;
g_object_set (G_OBJECT (combo_box), "source-list", source_list, NULL);
g_object_set (combo_box, "source-list", source_list, NULL);
if (source_list)
g_object_unref (source_list);
......@@ -1242,7 +1244,7 @@ contact_list_editor_constructor (GType type,
static void
contact_list_editor_set_property (GObject *object,
guint property_id,
const GValue *value,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
......@@ -1772,8 +1774,8 @@ e_contact_list_editor_get_contact (EContactListEditor *editor)
save_contact_list (model, &iter, &attrs, &parent_id);
/* Put it in reverse order because e_vcard_add_attribute also uses prepend,
but we want to keep order of mails there. Hopefully noone will change
the behaviour of the e_vcard_add_attribute. */