Commit 2c4ae5e7 authored by Matthew Barnes's avatar Matthew Barnes
Browse files

Coding style and whitespace cleanup.

parent 583da46b
......@@ -253,9 +253,10 @@ e_contact_editor_fullname_new (const EContactName *name)
{
GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL);
g_object_set (widget,
"name", name,
NULL);
g_object_set (
widget,
"name", name,
NULL);
return widget;
}
......@@ -320,9 +321,9 @@ extract_info (EContactEditorFullname *editor)
editor->name = name;
}
name->prefixes = extract_field (editor, "comboentry-title" );
name->given = extract_field (editor, "entry-first" );
name->prefixes = extract_field (editor, "comboentry-title");
name->given = extract_field (editor, "entry-first");
name->additional = extract_field (editor, "entry-middle");
name->family = extract_field (editor, "entry-last" );
name->family = extract_field (editor, "entry-last");
name->suffixes = extract_field (editor, "comboentry-suffix");
}
......@@ -689,7 +689,7 @@ sensitize_ok (EContactEditor *ce)
GtkWidget *widget;
gboolean allow_save;
GtkWidget *entry_fullname =
e_builder_get_widget (ce->builder, "entry-fullname" );
e_builder_get_widget (ce->builder, "entry-fullname");
GtkWidget *entry_file_as =
gtk_bin_get_child (GTK_BIN (
e_builder_get_widget (ce->builder, "combo-file-as")));
......@@ -808,7 +808,8 @@ init_email_record_location (EContactEditor *editor,
for (i = 0; i < G_N_ELEMENTS (common_location); i++) {
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
gtk_list_store_set (
store, &iter,
0, _(common_location[i].pretty_name),
-1);
}
......@@ -1894,8 +1895,8 @@ extract_im (EContactEditor *editor)
old_service_attr_list = e_contact_get_attributes (
editor->contact, im_service[i].field);
filled_in_slots =
MIN (remaining_slots,
filled_in_slots = MIN (
remaining_slots,
g_list_length (old_service_attr_list));
remaining_slots -= filled_in_slots;
......@@ -2289,9 +2290,11 @@ set_address_label (EContact *contact,
g_object_unref (settings);
if (format_address) {
address_label = eab_format_address (contact,
(field == E_CONTACT_ADDRESS_LABEL_WORK) ? E_CONTACT_ADDRESS_WORK :
E_CONTACT_ADDRESS_HOME);
address_label = eab_format_address (
contact,
(field == E_CONTACT_ADDRESS_LABEL_WORK) ?
E_CONTACT_ADDRESS_WORK :
E_CONTACT_ADDRESS_HOME);
}
if (!format_address || !address_label) {
......@@ -2702,7 +2705,8 @@ extract_simple_field (EContactEditor *editor,
gtk_combo_box_get_model (
GTK_COMBO_BOX (widget)));
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
gtk_tree_model_get (
GTK_TREE_MODEL (store), &iter,
0, &text,
-1);
}
......@@ -2776,7 +2780,7 @@ extract_simple_field (EContactEditor *editor,
NULL);
if (prompt_response == GTK_RESPONSE_YES) {
if ( width > height) {
if (width > height) {
height = height * 96 / width;
width = 96;
} else {
......@@ -3681,7 +3685,7 @@ save_contact (EContactEditor *ce,
return;
}
entry_fullname = e_builder_get_widget (ce->builder, "entry-fullname" );
entry_fullname = e_builder_get_widget (ce->builder, "entry-fullname");
entry_file_as = gtk_bin_get_child (
GTK_BIN (e_builder_get_widget (ce->builder, "combo-file-as")));
company_name = e_builder_get_widget (ce->builder, "entry-company");
......@@ -3794,8 +3798,9 @@ e_contact_editor_is_valid (EABEditor *editor)
/* If valid, see if the birthday is a future date */
bday = e_date_edit_get_time (E_DATE_EDIT (widget));
if (bday > now) {
g_string_append_printf (errmsg, _("'%s' cannot be a future date"),
e_contact_pretty_name (E_CONTACT_BIRTH_DATE));
g_string_append_printf (
errmsg, _("'%s' cannot be a future date"),
e_contact_pretty_name (E_CONTACT_BIRTH_DATE));
validation_error = TRUE;
}
......
......@@ -492,34 +492,40 @@ build_quick_add_dialog (QuickAdd *qa)
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,
0, 1, 0, 1,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (table, qa->name_entry,
1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, label,
0, 1, 0, 1,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, qa->name_entry,
1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
label = gtk_label_new_with_mnemonic (_("E_mail"));
gtk_label_set_mnemonic_widget ((GtkLabel *) label, qa->email_entry);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (table, label,
0, 1, 1, 2,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (table, qa->email_entry,
1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, label,
0, 1, 1, 2,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, qa->email_entry,
1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
label = gtk_label_new_with_mnemonic (_("_Select Address Book"));
gtk_label_set_mnemonic_widget ((GtkLabel *) label, qa->combo_box);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (table, label,
0, 1, 2, 3,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (table, qa->combo_box,
1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, label,
0, 1, 2, 3,
GTK_FILL, 0, xpad, ypad);
gtk_table_attach (
table, qa->combo_box,
1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
......
......@@ -175,44 +175,47 @@ eab_editor_class_init (EABEditorClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
signals[CONTACT_ADDED] =
g_signal_new ("contact_added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_added),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER, G_TYPE_OBJECT);
signals[CONTACT_MODIFIED] =
g_signal_new ("contact_modified",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_modified),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER, G_TYPE_OBJECT);
signals[CONTACT_DELETED] =
g_signal_new ("contact_deleted",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_deleted),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER, G_TYPE_OBJECT);
signals[EDITOR_CLOSED] =
g_signal_new ("editor_closed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, editor_closed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[CONTACT_ADDED] = g_signal_new (
"contact_added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_added),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_OBJECT);
signals[CONTACT_MODIFIED] = g_signal_new (
"contact_modified",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_modified),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_OBJECT);
signals[CONTACT_DELETED] = g_signal_new (
"contact_deleted",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, contact_deleted),
NULL, NULL,
e_marshal_NONE__POINTER_OBJECT,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_OBJECT);
signals[EDITOR_CLOSED] = g_signal_new (
"editor_closed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EABEditorClass, editor_closed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
......
......@@ -508,7 +508,8 @@ contact_list_editor_add_button_clicked_cb (GtkWidget *widget)
editor = contact_list_editor_extract (widget);
contact_list_editor_add_email (editor,
contact_list_editor_add_email (
editor,
gtk_entry_get_text (GTK_ENTRY (WIDGET (EMAIL_ENTRY))));
gtk_entry_set_text (GTK_ENTRY (WIDGET (EMAIL_ENTRY)), "");
}
......@@ -1208,7 +1209,8 @@ setup_custom_widgets (EContactListEditor *editor)
gtk_widget_get_name (old));
parent = gtk_widget_get_parent (old);
gtk_container_child_get (GTK_CONTAINER (parent), old,
gtk_container_child_get (
GTK_CONTAINER (parent), old,
"bottom-attach", &ba,
"left-attach", &la,
"right-attach", &ra,
......@@ -1660,12 +1662,13 @@ e_contact_list_editor_new (EShell *shell,
E_TYPE_CONTACT_LIST_EDITOR,
"shell", shell, NULL);
g_object_set (editor,
"client", book_client,
"contact", list_contact,
"is_new_list", is_new_list,
"editable", editable,
NULL);
g_object_set (
editor,
"client", book_client,
"contact", list_contact,
"is_new_list", is_new_list,
"editable", editable,
NULL);
return editor;
}
......@@ -1721,9 +1724,11 @@ save_contact_list (GtkTreeModel *model,
uid = g_strdup_printf ("%d", *parent_id);
attr = e_vcard_attribute_new (NULL, EVC_CONTACT_LIST);
e_vcard_attribute_add_param_with_value (attr,
e_vcard_attribute_add_param_with_value (
attr,
e_vcard_attribute_param_new (EVC_CL_UID), uid);
e_vcard_attribute_add_value (attr,
e_vcard_attribute_add_value (
attr,
e_destination_get_name (dest));
g_free (uid);
......@@ -1738,7 +1743,8 @@ save_contact_list (GtkTreeModel *model,
e_destination_export_to_vcard_attribute (dest, attr);
}
e_vcard_attribute_add_param_with_value (attr,
e_vcard_attribute_add_param_with_value (
attr,
e_vcard_attribute_param_new (EVC_PARENT_CL), pid_str);
*attrs = g_slist_prepend (*attrs, attr);
......@@ -1889,7 +1895,7 @@ e_contact_list_editor_set_is_new_list (EContactListEditor *editor,
g_return_if_fail (E_IS_CONTACT_LIST_EDITOR (editor));
if ((editor->priv->is_new_list ? 1 : 0) == (is_new_list ? 1 : 0))
if (editor->priv->is_new_list == is_new_list)
return;
editor->priv->is_new_list = is_new_list;
......@@ -1912,7 +1918,7 @@ e_contact_list_editor_set_editable (EContactListEditor *editor,
{
g_return_if_fail (E_IS_CONTACT_LIST_EDITOR (editor));
if ((editor->priv->editable ? 1 : 0) == (editable ? 1 : 0))
if (editor->priv->editable == editable)
return;
editor->priv->editable = editable;
......
......@@ -152,8 +152,9 @@ e_contact_list_model_add_destination (EContactListModel *model,
if (e_destination_is_evolution_list (destination)) {
const GList *dest, *dests = e_destination_list_get_root_dests (destination);
/* Get number of instances of this list in the model */
gint list_refs = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->uids_table,
e_destination_get_contact_uid (destination)));
gint list_refs = GPOINTER_TO_INT (
g_hash_table_lookup (model->priv->uids_table,
e_destination_get_contact_uid (destination)));
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, parent);
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, destination, -1);
......@@ -170,7 +171,8 @@ e_contact_list_model_add_destination (EContactListModel *model,
if (!gtk_tree_model_iter_has_child (GTK_TREE_MODEL (model), &iter)) {
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
} else {
g_hash_table_insert (model->priv->uids_table,
g_hash_table_insert (
model->priv->uids_table,
g_strdup (e_destination_get_contact_uid (destination)),
GINT_TO_POINTER (list_refs + 1));
}
......@@ -182,10 +184,12 @@ e_contact_list_model_add_destination (EContactListModel *model,
return NULL;
}
dest_refs = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->emails_table,
e_destination_get_email (destination)));
dest_refs = GPOINTER_TO_INT (
g_hash_table_lookup (model->priv->emails_table,
e_destination_get_email (destination)));
g_hash_table_insert (model->priv->emails_table,
g_hash_table_insert (
model->priv->emails_table,
g_strdup (e_destination_get_email (destination)),
GINT_TO_POINTER (dest_refs + 1));
......@@ -225,16 +229,19 @@ contact_list_model_unref_row_dest (EContactListModel *model,
if (gtk_tree_model_iter_has_child (tree_model, iter)) {
GtkTreeIter child_iter;
gint list_refs = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->uids_table,
gint list_refs = GPOINTER_TO_INT (
g_hash_table_lookup (model->priv->uids_table,
e_destination_get_contact_uid (dest)));
/* If the list is only once in the model, then remove it from the hash table,
* otherwise decrease the counter by one */
if (list_refs <= 1) {
g_hash_table_remove (model->priv->uids_table,
g_hash_table_remove (
model->priv->uids_table,
e_destination_get_contact_uid (dest));
} else {
g_hash_table_insert (model->priv->uids_table,
g_hash_table_insert (
model->priv->uids_table,
g_strdup (e_destination_get_contact_uid (dest)),
GINT_TO_POINTER (list_refs - 1));
}
......@@ -246,14 +253,18 @@ contact_list_model_unref_row_dest (EContactListModel *model,
}
} else {
gint dest_refs = GPOINTER_TO_INT (g_hash_table_lookup (model->priv->emails_table,
e_destination_get_email (dest)));
gint dest_refs = GPOINTER_TO_INT (
g_hash_table_lookup (
model->priv->emails_table,
e_destination_get_email (dest)));
if (dest_refs <= 1) {
g_hash_table_remove (model->priv->emails_table,
g_hash_table_remove (
model->priv->emails_table,
e_destination_get_email (dest));
} else {
g_hash_table_insert (model->priv->emails_table,
g_hash_table_insert (
model->priv->emails_table,
g_strdup (e_destination_get_email (dest)),
GINT_TO_POINTER (dest_refs - 1));
}
......
......@@ -442,7 +442,7 @@ match_email_hostname (const gchar *addr1,
--addr1;
--addr2;
}
if ((*addr1 == '@' && *addr2 != '@' ) || (*addr2 == '@' && *addr1 != '@'))
if ((*addr1 == '@' && *addr2 != '@') || (*addr2 == '@' && *addr1 != '@'))
return FALSE;
return TRUE;
......
......@@ -649,106 +649,113 @@ e_addressbook_model_class_init (EAddressbookModelClass *class)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
signals[WRITABLE_STATUS] =
g_signal_new ("writable_status",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, writable_status),
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE,
1, G_TYPE_BOOLEAN);
signals[STATUS_MESSAGE] =
g_signal_new ("status_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, status_message),
NULL, NULL,
e_marshal_VOID__STRING_INT,
G_TYPE_NONE,
2, G_TYPE_STRING, G_TYPE_INT);
signals[SEARCH_STARTED] =
g_signal_new ("search_started",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, search_started),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SEARCH_RESULT] =
g_signal_new ("search_result",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, search_result),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1, G_TYPE_ERROR);
signals[FOLDER_BAR_MESSAGE] =
g_signal_new ("folder_bar_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, folder_bar_message),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
signals[CONTACT_ADDED] =
g_signal_new ("contact_added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contact_added),
NULL, NULL,
e_marshal_NONE__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
signals[CONTACTS_REMOVED] =
g_signal_new ("contacts_removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contacts_removed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
signals[CONTACT_CHANGED] =
g_signal_new ("contact_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contact_changed),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT);
signals[MODEL_CHANGED] =
g_signal_new ("model_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, model_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[STOP_STATE_CHANGED] =
g_signal_new ("stop_state_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, stop_state_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[BACKEND_DIED] =
g_signal_new ("backend_died",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, backend_died),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[WRITABLE_STATUS] = g_signal_new (
"writable_status",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, writable_status),
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
signals[STATUS_MESSAGE] = g_signal_new (
"status_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, status_message),
NULL, NULL,
e_marshal_VOID__STRING_INT,
G_TYPE_NONE, 2,
G_TYPE_STRING,
G_TYPE_INT);
signals[SEARCH_STARTED] = g_signal_new (
"search_started",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, search_started),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SEARCH_RESULT] = g_signal_new (
"search_result",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, search_result),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
G_TYPE_ERROR);
signals[FOLDER_BAR_MESSAGE] = g_signal_new (
"folder_bar_message",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, folder_bar_message),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
signals[CONTACT_ADDED] = g_signal_new (
"contact_added",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contact_added),
NULL, NULL,
e_marshal_NONE__INT_INT,
G_TYPE_NONE, 2,
G_TYPE_INT,
G_TYPE_INT);
signals[CONTACTS_REMOVED] = g_signal_new (
"contacts_removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contacts_removed),