diff options
Diffstat (limited to 'addressbook')
24 files changed, 1260 insertions, 1004 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c index 8dc2621787..4777091128 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c @@ -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"); } diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index d2111f0def..8e2e455dc1 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -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; } diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index fd4c8edb82..e9076a9df8 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -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)); diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c index a7165e70d8..fcbdfb1049 100644 --- a/addressbook/gui/contact-editor/eab-editor.c +++ b/addressbook/gui/contact-editor/eab-editor.c @@ -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 diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index e3cb38ec96..a6205757d8 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -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; diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c index 55cc70bec7..337fd351e4 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-model.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-model.c @@ -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)); } diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index 7c7f096e90..7f5dfe1564 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -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; diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 9eea4c7f89..1720b19a09 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -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), + 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); } static void @@ -945,7 +952,7 @@ e_addressbook_model_set_editable (EAddressbookModel *model, { g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model)); - if ((model->priv->editable ? 1 : 0) != (editable ? 1 : 0)) { + if (model->priv->editable != editable) { model->priv->editable = editable; g_signal_emit ( diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c index 00a86ce73f..48ed73bb25 100644 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c @@ -73,23 +73,29 @@ unlink_model (EAddressbookReflowAdapter *adapter) EAddressbookReflowAdapterPrivate *priv = adapter->priv; if (priv->model && priv->create_contact_id) - g_signal_handler_disconnect (priv->model, - priv->create_contact_id); + g_signal_handler_disconnect ( + priv->model, + priv->create_contact_id); if (priv->model && priv->remove_contact_id) - g_signal_handler_disconnect (priv->model, - priv->remove_contact_id); + g_signal_handler_disconnect ( + priv->model, + priv->remove_contact_id); if (priv->model && priv->modify_contact_id) - g_signal_handler_disconnect (priv->model, - priv->modify_contact_id); + g_signal_handler_disconnect ( + priv->model, + priv->modify_contact_id); if (priv->model && priv->model_changed_id) - g_signal_handler_disconnect (priv->model, - priv->model_changed_id); + g_signal_handler_disconnect ( + priv->model, + priv->model_changed_id); if (priv->model && priv->search_started_id) - g_signal_handler_disconnect (priv->model, - priv->search_started_id); + g_signal_handler_disconnect ( + priv->model, + priv->search_started_id); if (priv->model && priv->search_result_id) - g_signal_handler_disconnect (priv->model, - priv->search_result_id); + g_signal_handler_disconnect ( + priv->model, + priv->search_result_id); priv->create_contact_id = 0; priv->remove_contact_id = 0; @@ -289,9 +295,10 @@ adapter_drag_begin (EMinicard *card, { gint ret_val = 0; - g_signal_emit (adapter, - signals[DRAG_BEGIN], 0, - event, &ret_val); + g_signal_emit ( + adapter, + signals[DRAG_BEGIN], 0, + event, &ret_val); return ret_val; } @@ -338,9 +345,10 @@ addressbook_reincarnate (EReflowModel *erm, EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER (erm); EAddressbookReflowAdapterPrivate *priv = adapter->priv; - gnome_canvas_item_set (item, - "contact", e_addressbook_model_contact_at (priv->model, i), - NULL); + gnome_canvas_item_set ( + item, + "contact", e_addressbook_model_contact_at (priv->model, i), + NULL); } static void @@ -349,9 +357,10 @@ create_contact (EAddressbookModel *model, gint count, EAddressbookReflowAdapter *adapter) { - e_reflow_model_items_inserted (E_REFLOW_MODEL (adapter), - index, - count); + e_reflow_model_items_inserted ( + E_REFLOW_MODEL (adapter), + index, + count); } static void @@ -418,19 +427,22 @@ addressbook_set_property (GObject *object, switch (property_id) { case PROP_CLIENT: - g_object_set (priv->model, - "client", g_value_get_object (value), - NULL); + g_object_set ( + priv->model, + "client", g_value_get_object (value), + NULL); break; case PROP_QUERY: - g_object_set (priv->model, - "query", g_value_get_string (value), - NULL); + g_object_set ( + priv->model, + "query", g_value_get_string (value), + NULL); break; case PROP_EDITABLE: - g_object_set (priv->model, - "editable", g_value_get_boolean (value), - NULL); + g_object_set ( + priv->model, + "editable", g_value_get_boolean (value), + NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -449,18 +461,21 @@ addressbook_get_property (GObject *object, switch (property_id) { case PROP_CLIENT: { - g_object_get_property (G_OBJECT (priv->model), - "client", value); + g_object_get_property ( + G_OBJECT (priv->model), + "client", value); break; } case PROP_QUERY: { - g_object_get_property (G_OBJECT (priv->model), - "query", value); + g_object_get_property ( + G_OBJECT (priv->model), + "query", value); break; } case PROP_EDITABLE: { - g_object_get_property (G_OBJECT (priv->model), - "editable", value); + g_object_get_property ( + G_OBJECT (priv->model), + "editable", value); break; } case PROP_MODEL: @@ -495,52 +510,65 @@ e_addressbook_reflow_adapter_class_init (EAddressbookReflowAdapterClass *class) reflow_model_class->incarnate = addressbook_incarnate; reflow_model_class->reincarnate = addressbook_reincarnate; - g_object_class_install_property (object_class, PROP_CLIENT, - g_param_spec_object ("client", - "EBookClient", - NULL, - E_TYPE_BOOK_CLIENT, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - "Query", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - "Model", - NULL, - E_TYPE_ADDRESSBOOK_MODEL, - G_PARAM_READABLE)); - - signals[DRAG_BEGIN] = - g_signal_new ("drag_begin", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, drag_begin), - NULL, NULL, - e_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - signals[OPEN_CONTACT] = - g_signal_new ("open-contact", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, open_contact), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - E_TYPE_CONTACT); + g_object_class_install_property ( + object_class, + PROP_CLIENT, + g_param_spec_object ( + "client", + "EBookClient", + NULL, + E_TYPE_BOOK_CLIENT, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_QUERY, + g_param_spec_string ( + "query", + "Query", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MODEL, + g_param_spec_object ( + "model", + "Model", + NULL, + E_TYPE_ADDRESSBOOK_MODEL, + G_PARAM_READABLE)); + + signals[DRAG_BEGIN] = g_signal_new ( + "drag_begin", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, drag_begin), + NULL, NULL, + e_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); + + signals[OPEN_CONTACT] = g_signal_new ( + "open-contact", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, open_contact), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + E_TYPE_CONTACT); } static void diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 035a194cca..4d6aea77ae 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1137,7 +1137,8 @@ backend_died (EAddressbookView *view) book_client = e_addressbook_model_get_client (model); source = e_client_get_source (E_CLIENT (book_client)); - e_alert_submit (alert_sink, + e_alert_submit ( + alert_sink, "addressbook:backend-died", e_source_get_display_name (source), NULL); } @@ -1310,29 +1311,29 @@ addressbook_view_confirm_delete (GtkWindow *parent, if (plural) { message = g_strdup ( _("Are you sure you want to " - "delete these contact lists?")); + "delete these contact lists?")); } else if (name == NULL) { message = g_strdup ( _("Are you sure you want to " - "delete this contact list?")); + "delete this contact list?")); } else { message = g_strdup_printf ( _("Are you sure you want to delete " - "this contact list (%s)?"), name); + "this contact list (%s)?"), name); } } else { if (plural) { message = g_strdup ( _("Are you sure you want to " - "delete these contacts?")); + "delete these contacts?")); } else if (name == NULL) { message = g_strdup ( _("Are you sure you want to " - "delete this contact?")); + "delete this contact?")); } else { message = g_strdup_printf ( _("Are you sure you want to delete " - "this contact (%s)?"), name); + "this contact (%s)?"), name); } } diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c index 584ed9fe98..618e4ea160 100644 --- a/addressbook/gui/widgets/e-minicard-label.c +++ b/addressbook/gui/widgets/e-minicard-label.c @@ -42,7 +42,7 @@ static void e_minicard_label_realize (GnomeCanvasItem *item); static void e_minicard_label_reflow (GnomeCanvasItem *item, gint flags); static void e_minicard_label_style_set (EMinicardLabel *label, GtkStyle *previous_style); -static void e_minicard_label_resize_children ( EMinicardLabel *e_minicard_label ); +static void e_minicard_label_resize_children (EMinicardLabel *e_minicard_label); static void set_colors (EMinicardLabel *label); @@ -83,73 +83,96 @@ e_minicard_label_class_init (EMinicardLabelClass *class) object_class->set_property = e_minicard_label_set_property; object_class->get_property = e_minicard_label_get_property; - /* object_class->destroy = e_minicard_label_destroy; */ - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - "Width", - NULL, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - "Height", - NULL, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HAS_FOCUS, - g_param_spec_boolean ("has_focus", - "Has Focus", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FIELD, - g_param_spec_string ("field", - "Field", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FIELDNAME, - g_param_spec_string ("fieldname", - "Field Name", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_TEXT_MODEL, - g_param_spec_object ("text_model", - "Text Model", - NULL, - E_TYPE_TEXT_MODEL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MAX_FIELD_NAME_WIDTH, - g_param_spec_double ("max_field_name_length", - "Max field name length", - NULL, - -1.0, G_MAXDOUBLE, -1.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - NULL, - FALSE, - G_PARAM_READWRITE)); - - e_minicard_label_signals[STYLE_SET] = - g_signal_new ("style_set", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMinicardLabelClass, style_set), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_STYLE); + + g_object_class_install_property ( + object_class, + PROP_WIDTH, + g_param_spec_double ( + "width", + "Width", + NULL, + 0.0, G_MAXDOUBLE, 10.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HEIGHT, + g_param_spec_double ( + "height", + "Height", + NULL, + 0.0, G_MAXDOUBLE, 10.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HAS_FOCUS, + g_param_spec_boolean ( + "has_focus", + "Has Focus", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FIELD, + g_param_spec_string ( + "field", + "Field", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FIELDNAME, + g_param_spec_string ( + "fieldname", + "Field Name", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_TEXT_MODEL, + g_param_spec_object ( + "text_model", + "Text Model", + NULL, + E_TYPE_TEXT_MODEL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_MAX_FIELD_NAME_WIDTH, + g_param_spec_double ( + "max_field_name_length", + "Max field name length", + NULL, + -1.0, G_MAXDOUBLE, -1.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + NULL, + FALSE, + G_PARAM_READWRITE)); + + e_minicard_label_signals[STYLE_SET] = g_signal_new ( + "style_set", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMinicardLabelClass, style_set), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GTK_TYPE_STYLE); /* GnomeCanvasItem method overrides */ item_class->realize = e_minicard_label_realize; @@ -159,15 +182,17 @@ e_minicard_label_class_init (EMinicardLabelClass *class) static void e_minicard_label_init (EMinicardLabel *minicard_label) { - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; + minicard_label->width = 10; + minicard_label->height = 10; + minicard_label->rect = NULL; + minicard_label->fieldname = NULL; + minicard_label->field = NULL; - minicard_label->max_field_name_length = -1; + minicard_label->max_field_name_length = -1; - e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (minicard_label), e_minicard_label_reflow); + e_canvas_item_set_reflow_callback ( + GNOME_CANVAS_ITEM (minicard_label), + e_minicard_label_reflow); } static void @@ -193,13 +218,13 @@ e_minicard_label_set_property (GObject *object, e_canvas_item_grab_focus (e_minicard_label->field, FALSE); break; case PROP_FIELD: - gnome_canvas_item_set ( e_minicard_label->field, "text", g_value_get_string (value), NULL ); + gnome_canvas_item_set (e_minicard_label->field, "text", g_value_get_string (value), NULL); break; case PROP_FIELDNAME: - gnome_canvas_item_set ( e_minicard_label->fieldname, "text", g_value_get_string (value), NULL ); + gnome_canvas_item_set (e_minicard_label->fieldname, "text", g_value_get_string (value), NULL); break; case PROP_TEXT_MODEL: - gnome_canvas_item_set ( e_minicard_label->field, "model", g_value_get_object (value), NULL); + gnome_canvas_item_set (e_minicard_label->field, "model", g_value_get_object (value), NULL); break; case PROP_MAX_FIELD_NAME_WIDTH: e_minicard_label->max_field_name_length = g_value_get_double (value); @@ -235,16 +260,19 @@ e_minicard_label_get_property (GObject *object, g_value_set_boolean (value, e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE); break; case PROP_FIELD: - g_object_get_property (G_OBJECT (e_minicard_label->field), - "text", value); + g_object_get_property ( + G_OBJECT (e_minicard_label->field), + "text", value); break; case PROP_FIELDNAME: - g_object_get_property (G_OBJECT (e_minicard_label->fieldname), - "text", value); + g_object_get_property ( + G_OBJECT (e_minicard_label->fieldname), + "text", value); break; case PROP_TEXT_MODEL: - g_object_get_property (G_OBJECT (e_minicard_label->field), - "model", value); + g_object_get_property ( + G_OBJECT (e_minicard_label->field), + "model", value); break; case PROP_MAX_FIELD_NAME_WIDTH: g_value_set_double (value, e_minicard_label->max_field_name_length); @@ -265,43 +293,48 @@ e_minicard_label_realize (GnomeCanvasItem *item) GnomeCanvasGroup *group; e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP ( item ); + group = GNOME_CANVAS_GROUP (item); GNOME_CANVAS_ITEM_CLASS (e_minicard_label_parent_class)->realize (item); e_canvas_item_request_reflow (item); - e_minicard_label->rect = - gnome_canvas_item_new ( group, - gnome_canvas_rect_get_type (), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new ( group, - e_text_get_type (), - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color", "black", - "im_context", E_CANVAS (item->canvas)->im_context, - NULL ); + e_minicard_label->rect = gnome_canvas_item_new ( + group, + gnome_canvas_rect_get_type (), + "x1", (gdouble) 0, + "y1", (gdouble) 0, + "x2", (gdouble) e_minicard_label->width - 1, + "y2", (gdouble) e_minicard_label->height - 1, + "outline_color", NULL, + NULL); + + e_minicard_label->fieldname = gnome_canvas_item_new ( + group, + e_text_get_type (), + "clip_width", (gdouble) (e_minicard_label->width / 2 - 4), + "clip", TRUE, + "use_ellipsis", TRUE, + "fill_color", "black", + "im_context", E_CANVAS (item->canvas)->im_context, + NULL); + e_canvas_item_move_absolute (e_minicard_label->fieldname, 2, 1); - e_minicard_label->field = - gnome_canvas_item_new ( group, - e_text_get_type (), - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color", "black", - "editable", FALSE, /* e_minicard_label->editable, */ - "im_context", E_CANVAS (item->canvas)->im_context, - NULL ); - e_canvas_item_move_absolute (e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); + e_minicard_label->field = gnome_canvas_item_new ( + group, + e_text_get_type (), + "clip_width", (gdouble) ((e_minicard_label->width + 1) / 2 - 4), + "clip", TRUE, + "use_ellipsis", TRUE, + "fill_color", "black", + "editable", FALSE, /* e_minicard_label->editable, */ + "im_context", E_CANVAS (item->canvas)->im_context, + NULL); + + e_canvas_item_move_absolute ( + e_minicard_label->field, + (e_minicard_label->width / 2 + 2), 1); set_colors (e_minicard_label); @@ -334,9 +367,10 @@ e_minicard_label_event (GnomeCanvasItem *item, e_minicard_label->has_focus = focus_event->in; set_colors (e_minicard_label); - g_object_set (e_minicard_label->field, - "handle_popup", e_minicard_label->has_focus, - NULL); + g_object_set ( + e_minicard_label->field, + "handle_popup", e_minicard_label->has_focus, + NULL); break; } case GDK_BUTTON_PRESS: @@ -368,14 +402,16 @@ e_minicard_label_resize_children (EMinicardLabel *e_minicard_label) else left_width = e_minicard_label->width / 2 - 4; - fieldnamewidth = (double) MAX ( left_width, 0 ); - fieldwidth = (double) MAX ( e_minicard_label->width - 8 - left_width, 0 ); - gnome_canvas_item_set ( e_minicard_label->fieldname, - "clip_width", is_rtl ? fieldwidth : fieldnamewidth, - NULL ); - gnome_canvas_item_set ( e_minicard_label->field, - "clip_width", is_rtl ? fieldnamewidth : fieldwidth, - NULL ); + fieldnamewidth = (gdouble) MAX (left_width, 0); + fieldwidth = (gdouble) MAX (e_minicard_label->width - 8 - left_width, 0); + gnome_canvas_item_set ( + e_minicard_label->fieldname, + "clip_width", is_rtl ? fieldwidth : fieldnamewidth, + NULL); + gnome_canvas_item_set ( + e_minicard_label->field, + "clip_width", is_rtl ? fieldnamewidth : fieldwidth, + NULL); } static void @@ -391,32 +427,38 @@ set_colors (EMinicardLabel *label) style = gtk_widget_get_style (GTK_WIDGET (canvas)); if (label->has_focus) { - gnome_canvas_item_set (label->rect, - "outline_color_gdk", &style->mid[GTK_STATE_SELECTED], - "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], - NULL); - - gnome_canvas_item_set (label->field, - "fill_color_gdk", &style->text[GTK_STATE_NORMAL], - NULL); - - gnome_canvas_item_set (label->fieldname, - "fill_color_gdk", &style->text[GTK_STATE_NORMAL], - NULL); + gnome_canvas_item_set ( + label->rect, + "outline_color_gdk", &style->mid[GTK_STATE_SELECTED], + "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], + NULL); + + gnome_canvas_item_set ( + label->field, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); + + gnome_canvas_item_set ( + label->fieldname, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); } else { - gnome_canvas_item_set (label->rect, - "outline_color_gdk", NULL, - "fill_color_gdk", NULL, - NULL); - - gnome_canvas_item_set (label->field, - "fill_color_gdk", &style->text[GTK_STATE_NORMAL], - NULL); - - gnome_canvas_item_set (label->fieldname, - "fill_color_gdk", &style->text[GTK_STATE_NORMAL], - NULL); + gnome_canvas_item_set ( + label->rect, + "outline_color_gdk", NULL, + "fill_color_gdk", NULL, + NULL); + + gnome_canvas_item_set ( + label->field, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); + + gnome_canvas_item_set ( + label->fieldname, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); } } } @@ -440,28 +482,32 @@ e_minicard_label_reflow (GnomeCanvasItem *item, old_height = e_minicard_label->height; - g_object_get (e_minicard_label->fieldname, - "text_height", &text_height, - NULL); + g_object_get ( + e_minicard_label->fieldname, + "text_height", &text_height, + NULL); e_minicard_label->height = text_height; - g_object_get (e_minicard_label->field, - "text_height", &text_height, - NULL); + g_object_get ( + e_minicard_label->field, + "text_height", &text_height, + NULL); if (e_minicard_label->height < text_height) e_minicard_label->height = text_height; e_minicard_label->height += 3; - gnome_canvas_item_set ( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); + gnome_canvas_item_set ( + e_minicard_label->rect, + "x2", (gdouble) e_minicard_label->width - 1, + "y2", (gdouble) e_minicard_label->height - 1, + NULL); - gnome_canvas_item_set ( e_minicard_label->fieldname, - "clip_height", (double) e_minicard_label->height - 3, - NULL ); + gnome_canvas_item_set ( + e_minicard_label->fieldname, + "clip_height", (gdouble) e_minicard_label->height - 3, + NULL); if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) left_width = e_minicard_label->max_field_name_length; @@ -477,7 +523,7 @@ e_minicard_label_reflow (GnomeCanvasItem *item, GnomeCanvasItem * e_minicard_label_new (GnomeCanvasGroup *parent) { - GnomeCanvasItem *item = gnome_canvas_item_new (parent, e_minicard_label_get_type (), NULL); - return item; + return gnome_canvas_item_new ( + parent, e_minicard_label_get_type (), NULL); } diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c index f7ebabf246..ecb2483652 100644 --- a/addressbook/gui/widgets/e-minicard-view-widget.c +++ b/addressbook/gui/widgets/e-minicard-view-widget.c @@ -104,78 +104,92 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *class) class->column_width_changed = NULL; class->right_click = NULL; - g_object_class_install_property (object_class, PROP_CLIENT, - g_param_spec_object ("client", - "EBookClient", - NULL, - E_TYPE_BOOK_CLIENT, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - "Query", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_COLUMN_WIDTH, - g_param_spec_double ("column_width", - "Column Width", - NULL, - 0.0, G_MAXDOUBLE, 225.0, - G_PARAM_READWRITE)); - - signals[CREATE_CONTACT] = - g_signal_new ("create-contact", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[CREATE_CONTACT_LIST] = - g_signal_new ("create-contact-list", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact_list), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[SELECTION_CHANGE] = - g_signal_new ("selection_change", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, selection_change), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[COLUMN_WIDTH_CHANGED] = - g_signal_new ("column_width_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, column_width_changed), - NULL, NULL, - g_cclosure_marshal_VOID__DOUBLE, - G_TYPE_NONE, 1, G_TYPE_DOUBLE); - - signals[RIGHT_CLICK] = - g_signal_new ("right_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewWidgetClass, right_click), - NULL, NULL, - e_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); + g_object_class_install_property ( + object_class, + PROP_CLIENT, + g_param_spec_object ( + "client", + "EBookClient", + NULL, + E_TYPE_BOOK_CLIENT, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_QUERY, + g_param_spec_string ( + "query", + "Query", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_COLUMN_WIDTH, + g_param_spec_double ( + "column_width", + "Column Width", + NULL, + 0.0, G_MAXDOUBLE, 225.0, + G_PARAM_READWRITE)); + + signals[CREATE_CONTACT] = g_signal_new ( + "create-contact", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[CREATE_CONTACT_LIST] = g_signal_new ( + "create-contact-list", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewWidgetClass, create_contact_list), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[SELECTION_CHANGE] = g_signal_new ( + "selection_change", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewWidgetClass, selection_change), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[COLUMN_WIDTH_CHANGED] = g_signal_new ( + "column_width_changed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewWidgetClass, column_width_changed), + NULL, NULL, + g_cclosure_marshal_VOID__DOUBLE, + G_TYPE_NONE, 1, + G_TYPE_DOUBLE); + + signals[RIGHT_CLICK] = g_signal_new ( + "right_click", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewWidgetClass, right_click), + NULL, NULL, + e_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); } static void @@ -222,30 +236,34 @@ e_minicard_view_widget_set_property (GObject *object, } else emvw->book_client = NULL; if (emvw->emv) - g_object_set (emvw->emv, - "client", emvw->book_client, - NULL); + g_object_set ( + emvw->emv, + "client", emvw->book_client, + NULL); break; case PROP_QUERY: emvw->query = g_strdup (g_value_get_string (value)); if (emvw->emv) - g_object_set (emvw->emv, - "query", emvw->query, - NULL); + g_object_set ( + emvw->emv, + "query", emvw->query, + NULL); break; case PROP_EDITABLE: emvw->editable = g_value_get_boolean (value); if (emvw->emv) - g_object_set (emvw->emv, - "editable", emvw->editable, - NULL); + g_object_set ( + emvw->emv, + "editable", emvw->editable, + NULL); break; case PROP_COLUMN_WIDTH: emvw->column_width = g_value_get_double (value); if (emvw->emv) { - g_object_set (emvw->emv, - "column_width", emvw->column_width, - NULL); + g_object_set ( + emvw->emv, + "column_width", emvw->column_width, + NULL); } break; default: @@ -383,16 +401,16 @@ e_minicard_view_widget_realize (GtkWidget *widget) gnome_canvas_root (GNOME_CANVAS (view)), e_canvas_background_get_type (), "fill_color_gdk", &style->base[GTK_STATE_NORMAL], - NULL ); + NULL); view->emv = gnome_canvas_item_new ( gnome_canvas_root (GNOME_CANVAS (view)), e_minicard_view_get_type (), - "height", (double) 100, - "minimum_width", (double) 100, + "height", (gdouble) 100, + "minimum_width", (gdouble) 100, "adapter", view->adapter, "column_width", view->column_width, - NULL ); + NULL); g_signal_connect ( E_REFLOW (view->emv)->selection, diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 01899e8a57..88633d4492 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -144,8 +144,9 @@ e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, target_list = gtk_target_list_new (drag_types, G_N_ELEMENTS (drag_types)); - context = gtk_drag_begin (GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas), - target_list, actions, 1/*XXX */, event); + context = gtk_drag_begin ( + GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas), + target_list, actions, 1/*XXX */, event); if (!view->canvas_drag_data_get_id) view->canvas_drag_data_get_id = g_signal_connect ( @@ -167,11 +168,12 @@ set_empty_message (EMinicardView *view) EAddressbookModel *model = NULL; EBookClient *book_client = NULL; - g_object_get (view->adapter, - "editable", &editable, - "model", &model, - "client", &book_client, - NULL); + g_object_get ( + view->adapter, + "editable", &editable, + "model", &model, + "client", &book_client, + NULL); if (book_client && !e_client_check_capability (E_CLIENT (book_client), "do-initial-query")) perform_initial_query = TRUE; @@ -200,9 +202,10 @@ set_empty_message (EMinicardView *view) empty_message = _("\n\nThere are no items to show in this view."); } - g_object_set (view, - "empty_message", empty_message, - NULL); + g_object_set ( + view, + "empty_message", empty_message, + NULL); } static void @@ -245,9 +248,10 @@ e_minicard_view_set_property (GObject *object, if (view->adapter) { if (view->writable_status_id || view->stop_state_id) { EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); + g_object_get ( + view->adapter, + "model", &model, + NULL); if (model) { if (view->writable_status_id) g_signal_handler_disconnect (model, view->writable_status_id); @@ -263,14 +267,16 @@ e_minicard_view_set_property (GObject *object, view->adapter = g_value_get_object (value); g_object_ref (view->adapter); adapter_changed (view); - g_object_set (view, - "model", view->adapter, - NULL); + g_object_set ( + view, + "model", view->adapter, + NULL); if (view->adapter) { EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); + g_object_get ( + view->adapter, + "model", &model, + NULL); if (model) { view->writable_status_id = g_signal_connect ( model, "writable_status", @@ -283,20 +289,23 @@ e_minicard_view_set_property (GObject *object, } break; case PROP_CLIENT: - g_object_set (view->adapter, - "client", g_value_get_object (value), - NULL); + g_object_set ( + view->adapter, + "client", g_value_get_object (value), + NULL); set_empty_message (view); break; case PROP_QUERY: - g_object_set (view->adapter, - "query", g_value_get_string (value), - NULL); + g_object_set ( + view->adapter, + "query", g_value_get_string (value), + NULL); break; case PROP_EDITABLE: - g_object_set (view->adapter, - "editable", g_value_get_boolean (value), - NULL); + g_object_set ( + view->adapter, + "editable", g_value_get_boolean (value), + NULL); set_empty_message (view); break; default: @@ -320,16 +329,19 @@ e_minicard_view_get_property (GObject *object, g_value_set_object (value, view->adapter); break; case PROP_CLIENT: - g_object_get_property (G_OBJECT (view->adapter), - "client", value); + g_object_get_property ( + G_OBJECT (view->adapter), + "client", value); break; case PROP_QUERY: - g_object_get_property (G_OBJECT (view->adapter), - "query", value); + g_object_get_property ( + G_OBJECT (view->adapter), + "query", value); break; case PROP_EDITABLE: - g_object_get_property (G_OBJECT (view->adapter), - "editable", value); + g_object_get_property ( + G_OBJECT (view->adapter), + "editable", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -345,17 +357,19 @@ e_minicard_view_dispose (GObject *object) clear_drag_data (view); if (view->canvas_drag_data_get_id) { - g_signal_handler_disconnect (GNOME_CANVAS_ITEM (view)->canvas, - view->canvas_drag_data_get_id); + g_signal_handler_disconnect ( + GNOME_CANVAS_ITEM (view)->canvas, + view->canvas_drag_data_get_id); view->canvas_drag_data_get_id = 0; } if (view->adapter) { if (view->writable_status_id || view->stop_state_id) { EAddressbookModel *model; - g_object_get (view->adapter, - "model", &model, - NULL); + g_object_get ( + view->adapter, + "model", &model, + NULL); if (model) { if (view->writable_status_id) g_signal_handler_disconnect (model, view->writable_status_id); @@ -379,8 +393,9 @@ e_minicard_view_right_click (EMinicardView *view, GdkEvent *event) { guint ret_val = 0; - g_signal_emit (view, signals[RIGHT_CLICK], 0, - event, &ret_val); + g_signal_emit ( + view, signals[RIGHT_CLICK], 0, + event, &ret_val); return ret_val; } @@ -474,58 +489,71 @@ e_minicard_view_class_init (EMinicardViewClass *class) object_class->get_property = e_minicard_view_get_property; object_class->dispose = e_minicard_view_dispose; - g_object_class_install_property (object_class, PROP_ADAPTER, - g_param_spec_object ("adapter", - "Adapter", - NULL, - E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CLIENT, - g_param_spec_object ("client", - "EBookClient", - NULL, - E_TYPE_BOOK_CLIENT, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_QUERY, - g_param_spec_string ("query", - "Query", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - NULL, - FALSE, - G_PARAM_READWRITE)); - - signals[CREATE_CONTACT] = - g_signal_new ("create-contact", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[CREATE_CONTACT_LIST] = - g_signal_new ("create-contact-list", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - signals[RIGHT_CLICK] = - g_signal_new ("right_click", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardViewClass, right_click), - NULL, NULL, - e_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); + g_object_class_install_property ( + object_class, + PROP_ADAPTER, + g_param_spec_object ( + "adapter", + "Adapter", + NULL, + E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_CLIENT, + g_param_spec_object ( + "client", + "EBookClient", + NULL, + E_TYPE_BOOK_CLIENT, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_QUERY, + g_param_spec_string ( + "query", + "Query", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + NULL, + FALSE, + G_PARAM_READWRITE)); + + signals[CREATE_CONTACT] = g_signal_new ( + "create-contact", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[CREATE_CONTACT_LIST] = g_signal_new ( + "create-contact-list", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + signals[RIGHT_CLICK] = g_signal_new ( + "right_click", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardViewClass, right_click), + NULL, NULL, + e_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); item_class->event = e_minicard_view_event; @@ -556,9 +584,10 @@ e_minicard_view_jump_to_letter (EMinicardView *view, gchar uft_str[6 + 1]; utf_str[g_unichar_to_utf8 (letter, utf_str)] = '\0'; - e_reflow_sorted_jump (E_REFLOW_SORTED (view), - (GCompareFunc) compare_to_utf_str, - utf_str); + e_reflow_sorted_jump ( + E_REFLOW_SORTED (view), + (GCompareFunc) compare_to_utf_str, + utf_str); #endif } diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index d0af5117b0..4e0df4c42f 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -46,11 +46,11 @@ static void e_minicard_dispose (GObject *object); static void e_minicard_finalize (GObject *object); static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_reflow ( GnomeCanvasItem *item, gint flags ); +static void e_minicard_reflow (GnomeCanvasItem *item, gint flags); static void e_minicard_style_set (EMinicard *minicard, GtkStyle *previous_style); -static void e_minicard_resize_children ( EMinicard *e_minicard ); -static void remodel ( EMinicard *e_minicard ); +static void e_minicard_resize_children (EMinicard *e_minicard); +static void remodel (EMinicard *e_minicard); static gint e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event); @@ -118,94 +118,118 @@ e_minicard_class_init (EMinicardClass *class) class->style_set = e_minicard_style_set; class->selected = NULL; - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - "Width", - NULL, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - "Height", - NULL, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READABLE)); - - g_object_class_install_property (object_class, PROP_HAS_FOCUS, - /* XXX should be _enum */ - g_param_spec_int ("has_focus", - "Has Focus", - NULL, - E_MINICARD_FOCUS_TYPE_START, E_MINICARD_FOCUS_TYPE_END, - E_MINICARD_FOCUS_TYPE_START, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_SELECTED, - g_param_spec_boolean ("selected", - "Selected", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HAS_CURSOR, - g_param_spec_boolean ("has_cursor", - "Has Cursor", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - "Editable", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CONTACT, - g_param_spec_object ("contact", - "Contact", - NULL, - E_TYPE_CONTACT, - G_PARAM_READWRITE)); - - signals[SELECTED] = - g_signal_new ("selected", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, selected), - NULL, NULL, - e_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - signals[DRAG_BEGIN] = - g_signal_new ("drag_begin", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, drag_begin), - NULL, NULL, - e_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - - signals[OPEN_CONTACT] = - g_signal_new ("open-contact", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, open_contact), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - E_TYPE_CONTACT); - - signals[STYLE_SET] = - g_signal_new ("style_set", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMinicardClass, style_set), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - GTK_TYPE_STYLE); + g_object_class_install_property ( + object_class, + PROP_WIDTH, + g_param_spec_double ( + "width", + "Width", + NULL, + 0.0, G_MAXDOUBLE, 10.0, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HEIGHT, + g_param_spec_double ( + "height", + "Height", + NULL, + 0.0, G_MAXDOUBLE, 10.0, + G_PARAM_READABLE)); + + g_object_class_install_property ( + object_class, + PROP_HAS_FOCUS, + /* XXX should be _enum */ + g_param_spec_int ( + "has_focus", + "Has Focus", + NULL, + E_MINICARD_FOCUS_TYPE_START, + E_MINICARD_FOCUS_TYPE_END, + E_MINICARD_FOCUS_TYPE_START, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_SELECTED, + g_param_spec_boolean ( + "selected", + "Selected", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_HAS_CURSOR, + g_param_spec_boolean ( + "has_cursor", + "Has Cursor", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_EDITABLE, + g_param_spec_boolean ( + "editable", + "Editable", + NULL, + FALSE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_CONTACT, + g_param_spec_object ( + "contact", + "Contact", + NULL, + E_TYPE_CONTACT, + G_PARAM_READWRITE)); + + signals[SELECTED] = g_signal_new ( + "selected", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardClass, selected), + NULL, NULL, + e_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); + + signals[DRAG_BEGIN] = g_signal_new ( + "drag_begin", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardClass, drag_begin), + NULL, NULL, + e_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); + + signals[OPEN_CONTACT] = g_signal_new ( + "open-contact", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMinicardClass, open_contact), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + E_TYPE_CONTACT); + + signals[STYLE_SET] = g_signal_new ( + "style_set", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (EMinicardClass, style_set), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GTK_TYPE_STYLE); /* init the accessibility support for e_minicard */ e_minicard_a11y_init (); @@ -244,25 +268,31 @@ set_selected (EMinicard *minicard, style = gtk_widget_get_style (GTK_WIDGET (canvas)); if (selected) { - gnome_canvas_item_set (minicard->rect, - "outline_color_gdk", &style->bg[GTK_STATE_ACTIVE], - NULL); - gnome_canvas_item_set (minicard->header_rect, - "fill_color_gdk", &style->bg[GTK_STATE_SELECTED], - NULL); - gnome_canvas_item_set (minicard->header_text, - "fill_color_gdk", &style->text[GTK_STATE_SELECTED], - NULL); + gnome_canvas_item_set ( + minicard->rect, + "outline_color_gdk", &style->bg[GTK_STATE_ACTIVE], + NULL); + gnome_canvas_item_set ( + minicard->header_rect, + "fill_color_gdk", &style->bg[GTK_STATE_SELECTED], + NULL); + gnome_canvas_item_set ( + minicard->header_text, + "fill_color_gdk", &style->text[GTK_STATE_SELECTED], + NULL); } else { - gnome_canvas_item_set (minicard->rect, - "outline_color", NULL, - NULL); - gnome_canvas_item_set (minicard->header_rect, - "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], - NULL); - gnome_canvas_item_set (minicard->header_text, - "fill_color_gdk", &style->text[GTK_STATE_NORMAL], - NULL); + gnome_canvas_item_set ( + minicard->rect, + "outline_color", NULL, + NULL); + gnome_canvas_item_set ( + minicard->header_rect, + "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], + NULL); + gnome_canvas_item_set ( + minicard->header_text, + "fill_color_gdk", &style->text[GTK_STATE_NORMAL], + NULL); } minicard->selected = selected; } @@ -301,15 +331,17 @@ e_minicard_set_property (GObject *object, break; case PROP_HAS_FOCUS: if (e_minicard->fields) { - if ( g_value_get_int (value) == E_FOCUS_START || + if (g_value_get_int (value) == E_FOCUS_START || g_value_get_int (value) == E_FOCUS_CURRENT) { - gnome_canvas_item_set (E_MINICARD_FIELD (e_minicard->fields->data)->label, - "has_focus", g_value_get_int (value), - NULL); + gnome_canvas_item_set ( + E_MINICARD_FIELD (e_minicard->fields->data)->label, + "has_focus", g_value_get_int (value), + NULL); } else if (g_value_get_int (value) == E_FOCUS_END) { - gnome_canvas_item_set (E_MINICARD_FIELD (g_list_last (e_minicard->fields)->data)->label, - "has_focus", g_value_get_int (value), - NULL); + gnome_canvas_item_set ( + E_MINICARD_FIELD (g_list_last (e_minicard->fields)->data)->label, + "has_focus", g_value_get_int (value), + NULL); } } else { @@ -324,9 +356,10 @@ e_minicard_set_property (GObject *object, case PROP_EDITABLE: e_minicard->editable = g_value_get_boolean (value); for (l = e_minicard->fields; l; l = l->next) { - g_object_set (E_MINICARD_FIELD (l->data)->label, - "editable", FALSE /* e_minicard->editable */, - NULL); + g_object_set ( + E_MINICARD_FIELD (l->data)->label, + "editable", FALSE /* e_minicard->editable */, + NULL); } break; case PROP_HAS_CURSOR: @@ -467,43 +500,43 @@ e_minicard_realize (GnomeCanvasItem *item) GNOME_CANVAS_ITEM_CLASS (e_minicard_parent_class)->realize (item); - e_minicard->rect = - gnome_canvas_item_new ( group, - gnome_canvas_rect_get_type (), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) MAX (e_minicard->width - 1, 0), - "y2", (double) MAX (e_minicard->height - 1, 0), - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new ( group, - gnome_canvas_rect_get_type (), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) MAX (e_minicard->width - 3, 0), - "y2", (double) MAX (e_minicard->height - 3, 0), - "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new ( group, - e_text_get_type (), - "width", (double) MAX ( e_minicard->width - 12, 0 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color_gdk", &style->fg[GTK_STATE_NORMAL], - "text", "", - NULL ); + e_minicard->rect = gnome_canvas_item_new ( + group, + gnome_canvas_rect_get_type (), + "x1", (gdouble) 0, + "y1", (gdouble) 0, + "x2", (gdouble) MAX (e_minicard->width - 1, 0), + "y2", (gdouble) MAX (e_minicard->height - 1, 0), + "outline_color", NULL, + NULL); + + e_minicard->header_rect = gnome_canvas_item_new ( + group, + gnome_canvas_rect_get_type (), + "x1", (gdouble) 2, + "y1", (gdouble) 2, + "x2", (gdouble) MAX (e_minicard->width - 3, 0), + "y2", (gdouble) MAX (e_minicard->height - 3, 0), + "fill_color_gdk", &style->bg[GTK_STATE_NORMAL], + NULL); + + e_minicard->header_text = gnome_canvas_item_new ( + group, + e_text_get_type (), + "width", (gdouble) MAX (e_minicard->width - 12, 0), + "clip", TRUE, + "use_ellipsis", TRUE, + "fill_color_gdk", &style->fg[GTK_STATE_NORMAL], + "text", "", + NULL); e_canvas_item_move_absolute (e_minicard->header_text, 6, 6); - e_minicard->list_icon = - gnome_canvas_item_new ( group, - gnome_canvas_pixbuf_get_type (), - "pixbuf", e_minicard->list_icon_pixbuf, - NULL); + e_minicard->list_icon = gnome_canvas_item_new ( + group, + gnome_canvas_pixbuf_get_type (), + "pixbuf", e_minicard->list_icon_pixbuf, + NULL); set_selected (e_minicard, e_minicard->selected); @@ -634,9 +667,10 @@ e_minicard_event (GnomeCanvasItem *item, model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index); if (reflow->items[model_index] == NULL) { reflow->items[model_index] = e_reflow_model_incarnate (reflow->model, model_index, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[model_index], - "width", (double) reflow->column_width, - NULL); + g_object_set ( + reflow->items[model_index], + "width", (gdouble) reflow->column_width, + NULL); } e_canvas_item_grab_focus (reflow->items[model_index], FALSE); @@ -660,9 +694,10 @@ e_minicard_event (GnomeCanvasItem *item, model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index); if (reflow->items[model_index] == NULL) { reflow->items[model_index] = e_reflow_model_incarnate (reflow->model, model_index, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[model_index], - "width", (double) reflow->column_width, - NULL); + g_object_set ( + reflow->items[model_index], + "width", (gdouble) reflow->column_width, + NULL); } e_canvas_item_grab_focus (reflow->items[model_index], FALSE); @@ -690,20 +725,23 @@ e_minicard_resize_children (EMinicard *e_minicard) gboolean is_list = GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)); if (e_minicard->header_text) { - gnome_canvas_item_set ( e_minicard->header_text, - "width", ((double) e_minicard->width - 12 - - (is_list ? e_minicard->list_icon_size : 0.0)), - NULL ); + gnome_canvas_item_set ( + e_minicard->header_text, + "width", ((gdouble) e_minicard->width - 12 + - (is_list ? e_minicard->list_icon_size : 0.0)), + NULL); } if (e_minicard->list_icon) { - e_canvas_item_move_absolute (e_minicard->list_icon, - e_minicard->width - e_minicard->list_icon_size - 3, - 3); + e_canvas_item_move_absolute ( + e_minicard->list_icon, + e_minicard->width - e_minicard->list_icon_size - 3, + 3); } - for (list = e_minicard->fields; list; list = g_list_next ( list )) { - gnome_canvas_item_set ( E_MINICARD_FIELD ( list->data )->label, - "width", (double) e_minicard->width - 4.0, - NULL ); + for (list = e_minicard->fields; list; list = g_list_next (list)) { + gnome_canvas_item_set ( + E_MINICARD_FIELD (list->data)->label, + "width", (gdouble) e_minicard->width - 4.0, + NULL); } } @@ -719,7 +757,7 @@ add_field (EMinicard *e_minicard, gchar *string; gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL); - group = GNOME_CANVAS_GROUP ( e_minicard ); + group = GNOME_CANVAS_GROUP (e_minicard); name = g_strdup_printf ("%s:", e_contact_pretty_name (field)); string = e_contact_get (e_minicard->contact, field); @@ -727,36 +765,40 @@ add_field (EMinicard *e_minicard, new_item = e_minicard_label_new (group); if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) - gnome_canvas_item_set (new_item, - "fieldname", is_rtl ? "" : string, - "field", is_rtl ? string : "", - "max_field_name_length", left_width, - "editable", FALSE /* e_minicard->editable */, - "width", e_minicard->width - 4.0, - NULL ); + gnome_canvas_item_set ( + new_item, + "fieldname", is_rtl ? "" : string, + "field", is_rtl ? string : "", + "max_field_name_length", left_width, + "editable", FALSE /* e_minicard->editable */, + "width", e_minicard->width - 4.0, + NULL); else - gnome_canvas_item_set (new_item, - "fieldname", is_rtl ? string : name, - "field", is_rtl ? name : string, - "max_field_name_length", left_width, - "editable", FALSE /* e_minicard->editable */, - "width", e_minicard->width - 4.0, - NULL ); + gnome_canvas_item_set ( + new_item, + "fieldname", is_rtl ? string : name, + "field", is_rtl ? name : string, + "max_field_name_length", left_width, + "editable", FALSE /* e_minicard->editable */, + "width", e_minicard->width - 4.0, + NULL); #ifdef notyet - g_object_set (E_MINICARD_LABEL (new_item)->field, - "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field), - NULL); + g_object_set ( + E_MINICARD_LABEL (new_item)->field, + "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field), + NULL); #endif - g_object_set_data (G_OBJECT (E_MINICARD_LABEL (new_item)->field), - "EMinicard:field", - GINT_TO_POINTER (field)); + g_object_set_data ( + G_OBJECT (E_MINICARD_LABEL (new_item)->field), + "EMinicard:field", + GINT_TO_POINTER (field)); minicard_field = g_new (EMinicardField, 1); minicard_field->field = field; minicard_field->label = new_item; - e_minicard->fields = g_list_append ( e_minicard->fields, minicard_field); + e_minicard->fields = g_list_append (e_minicard->fields, minicard_field); e_canvas_item_move_absolute (new_item, 2, e_minicard->height); g_free (name); g_free (string); @@ -790,7 +832,7 @@ add_email_field (EMinicard *e_minicard, gint count =0; gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL); GList *emails = e_contact_get (e_minicard->contact, E_CONTACT_EMAIL); - group = GNOME_CANVAS_GROUP ( e_minicard ); + group = GNOME_CANVAS_GROUP (e_minicard); for (l = email_list, le = emails; l != NULL && count < limit && le != NULL; l = l->next, le = le->next) { const gchar *tmp; @@ -818,28 +860,31 @@ add_email_field (EMinicard *e_minicard, new_item = e_minicard_label_new (group); - gnome_canvas_item_set (new_item, - "fieldname", is_rtl ? string : name, - "field", is_rtl ? name : string, - "max_field_name_length", left_width, - "editable", FALSE /* e_minicard->editable */, - "width", e_minicard->width - 4.0, - NULL ); + gnome_canvas_item_set ( + new_item, + "fieldname", is_rtl ? string : name, + "field", is_rtl ? name : string, + "max_field_name_length", left_width, + "editable", FALSE /* e_minicard->editable */, + "width", e_minicard->width - 4.0, + NULL); #ifdef notyet - g_object_set (E_MINICARD_LABEL (new_item)->field, - "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field), - NULL); + g_object_set ( + E_MINICARD_LABEL (new_item)->field, + "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field), + NULL); #endif - g_object_set_data (G_OBJECT (E_MINICARD_LABEL (new_item)->field), - "EMinicard:field", - GINT_TO_POINTER (E_CONTACT_EMAIL)); + g_object_set_data ( + G_OBJECT (E_MINICARD_LABEL (new_item)->field), + "EMinicard:field", + GINT_TO_POINTER (E_CONTACT_EMAIL)); minicard_field = g_new (EMinicardField, 1); minicard_field->field = E_CONTACT_EMAIL; minicard_field->label = new_item; - e_minicard->fields = g_list_append ( e_minicard->fields, minicard_field); + e_minicard->fields = g_list_append (e_minicard->fields, minicard_field); e_canvas_item_move_absolute (new_item, 2, e_minicard->height); count++; if (!is_list) @@ -902,9 +947,10 @@ remodel (EMinicard *e_minicard) if (e_minicard->header_text) { file_as = e_contact_get (e_minicard->contact, E_CONTACT_FILE_AS); - gnome_canvas_item_set (e_minicard->header_text, - "text", file_as ? file_as : "", - NULL ); + gnome_canvas_item_set ( + e_minicard->header_text, + "text", file_as ? file_as : "", + NULL); g_free (file_as); } @@ -947,9 +993,10 @@ remodel (EMinicard *e_minicard) string = e_contact_get (e_minicard->contact, field); if (string && *string) { e_minicard->fields = g_list_append (e_minicard->fields, minicard_field); - g_object_set (minicard_field->label, - "field", string, - NULL); + g_object_set ( + minicard_field->label, + "field", string, + NULL); count++; } else { e_minicard_field_destroy (minicard_field); @@ -1012,35 +1059,40 @@ e_minicard_reflow (GnomeCanvasItem *item, old_height = e_minicard->height; - g_object_get (e_minicard->header_text, - "text_height", &text_height, - NULL); + g_object_get ( + e_minicard->header_text, + "text_height", &text_height, + NULL); e_minicard->height = text_height + 10.0; - gnome_canvas_item_set (e_minicard->header_rect, - "y2", text_height + 9.0, - NULL); + gnome_canvas_item_set ( + e_minicard->header_rect, + "y2", text_height + 9.0, + NULL); for (list = e_minicard->fields; list; list = g_list_next (list)) { EMinicardField *field = E_MINICARD_FIELD (list->data); /* Why not use the item that is passed in? */ GnomeCanvasItem *item = field->label; - g_object_get (item, - "height", &text_height, - NULL); + g_object_get ( + item, + "height", &text_height, + NULL); e_canvas_item_move_absolute (item, 2, e_minicard->height); e_minicard->height += text_height; } e_minicard->height += 2; - gnome_canvas_item_set (e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL); - gnome_canvas_item_set (e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL); + gnome_canvas_item_set ( + e_minicard->rect, + "x2", (gdouble) e_minicard->width - 1.0, + "y2", (gdouble) e_minicard->height - 1.0, + NULL); + gnome_canvas_item_set ( + e_minicard->header_rect, + "x2", (gdouble) e_minicard->width - 3.0, + NULL); if (old_height != e_minicard->height) e_canvas_item_request_parent_reflow (item); @@ -1073,12 +1125,14 @@ e_minicard_compare (EMinicard *minicard1, if (minicard1->contact && minicard2->contact) { gchar *file_as1, *file_as2; - g_object_get (minicard1->contact, - "file_as", &file_as1, - NULL); - g_object_get (minicard2->contact, - "file_as", &file_as2, - NULL); + g_object_get ( + minicard1->contact, + "file_as", &file_as1, + NULL); + g_object_get ( + minicard2->contact, + "file_as", &file_as2, + NULL); if (file_as1 && file_as2) cmp = g_utf8_collate (file_as1, file_as2); @@ -1109,9 +1163,10 @@ e_minicard_selected (EMinicard *minicard, * it. */ if (signal_id != 0) { - g_signal_emit (item->parent, - signal_id, 0, - item, event, &ret_val); + g_signal_emit ( + item->parent, + signal_id, 0, + item, event, &ret_val); } } return ret_val; @@ -1123,9 +1178,10 @@ e_minicard_drag_begin (EMinicard *minicard, { gint ret_val = 0; GnomeCanvasItem *parent; - g_signal_emit (minicard, - signals[DRAG_BEGIN], 0, - event, &ret_val); + g_signal_emit ( + minicard, + signals[DRAG_BEGIN], 0, + event, &ret_val); parent = GNOME_CANVAS_ITEM (minicard)->parent; if (parent && E_IS_REFLOW (parent)) { diff --git a/addressbook/gui/widgets/ea-addressbook-view.c b/addressbook/gui/widgets/ea-addressbook-view.c index 5120f083b7..f1c21d1001 100644 --- a/addressbook/gui/widgets/ea-addressbook-view.c +++ b/addressbook/gui/widgets/ea-addressbook-view.c @@ -58,16 +58,18 @@ ea_ab_view_get_type (void) * Figure out the size of the class and instance * we are run-time deriving from (GailWidget, in this case) */ - factory = atk_registry_get_factory (atk_get_default_registry (), - GTK_TYPE_EVENT_BOX); + factory = atk_registry_get_factory ( + atk_get_default_registry (), + GTK_TYPE_EVENT_BOX); derived_atk_type = atk_object_factory_get_accessible_type (factory); g_type_query (derived_atk_type, &query); tinfo.class_size = query.class_size; tinfo.instance_size = query.instance_size; - type = g_type_register_static (derived_atk_type, - "EaABView", &tinfo, 0); + type = g_type_register_static ( + derived_atk_type, + "EaABView", &tinfo, 0); } return type; diff --git a/addressbook/gui/widgets/ea-addressbook.c b/addressbook/gui/widgets/ea-addressbook.c index b57720be39..ca218f4245 100644 --- a/addressbook/gui/widgets/ea-addressbook.c +++ b/addressbook/gui/widgets/ea-addressbook.c @@ -50,10 +50,11 @@ void e_minicard_view_a11y_init (void) EA_SET_FACTORY (e_minicard_view_get_type (), ea_minicard_view); if (atk_get_root ()) { - g_signal_add_emission_hook (g_signal_lookup ("event", - e_minicard_get_type ()), - 0, ea_addressbook_focus_watcher, - NULL, (GDestroyNotify) NULL); + g_signal_add_emission_hook ( + g_signal_lookup ("event", + e_minicard_get_type ()), + 0, ea_addressbook_focus_watcher, + NULL, (GDestroyNotify) NULL); } } diff --git a/addressbook/gui/widgets/ea-minicard-view.c b/addressbook/gui/widgets/ea-minicard-view.c index 65b20feb1a..67f112e66a 100644 --- a/addressbook/gui/widgets/ea-minicard-view.c +++ b/addressbook/gui/widgets/ea-minicard-view.c @@ -108,20 +108,24 @@ ea_minicard_view_get_type (void) * Figure out the size of the class and instance * we are run-time deriving from (GailWidget, in this case) */ - factory = atk_registry_get_factory (atk_get_default_registry (), - GNOME_TYPE_CANVAS_GROUP); + factory = atk_registry_get_factory ( + atk_get_default_registry (), + GNOME_TYPE_CANVAS_GROUP); derived_atk_type = atk_object_factory_get_accessible_type (factory); g_type_query (derived_atk_type, &query); tinfo.class_size = query.class_size; tinfo.instance_size = query.instance_size; - type = g_type_register_static (derived_atk_type, - "EaMinicardView", &tinfo, 0); - g_type_add_interface_static (type, ATK_TYPE_SELECTION, - &atk_selection_info); - g_type_add_interface_static (type, ATK_TYPE_ACTION, - &atk_action_info); + type = g_type_register_static ( + derived_atk_type, + "EaMinicardView", &tinfo, 0); + g_type_add_interface_static ( + type, ATK_TYPE_SELECTION, + &atk_selection_info); + g_type_add_interface_static ( + type, ATK_TYPE_ACTION, + &atk_action_info); } @@ -169,9 +173,10 @@ ea_minicard_view_get_name (AtkObject *accessible) if (display_name == NULL) display_name = ""; - string = g_strdup_printf (ngettext ("current address book folder %s has %d card", - "current address book folder %s has %d cards", - reflow->count), display_name, reflow->count); + string = g_strdup_printf ( + ngettext ("current address book folder %s has %d card", + "current address book folder %s has %d cards", + reflow->count), display_name, reflow->count); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, string); g_free (string); @@ -262,7 +267,7 @@ ea_minicard_view_ref_child (AtkObject *accessible, ATK_GOBJECT_ACCESSIBLE (accessible))); if (!reflow) return NULL; - if (!reflow->items ) + if (!reflow->items) return NULL; /* a minicard */ if (index < child_num) { @@ -342,7 +347,7 @@ selection_interface_get_selection_count (AtkSelection *selection) atk_gobj = ATK_GOBJECT_ACCESSIBLE (selection); reflow = E_REFLOW (atk_gobject_accessible_get_object (atk_gobj)); - if (!reflow ) + if (!reflow) return FALSE; return e_selection_model_selected_count (reflow->selection); @@ -426,7 +431,7 @@ static const gchar * atk_action_interface_get_name (AtkAction *iface, gint i) { - if ( i >= G_N_ELEMENTS (action_name) || i < 0) + if (i >= G_N_ELEMENTS (action_name) || i < 0) return NULL; return action_name[i]; diff --git a/addressbook/gui/widgets/ea-minicard.c b/addressbook/gui/widgets/ea-minicard.c index 45d496ffa0..8a93265d7f 100644 --- a/addressbook/gui/widgets/ea-minicard.c +++ b/addressbook/gui/widgets/ea-minicard.c @@ -97,18 +97,21 @@ ea_minicard_get_type (void) * we are run-time deriving from (GailWidget, in this case) */ - factory = atk_registry_get_factory (atk_get_default_registry (), - GNOME_TYPE_CANVAS_GROUP); + factory = atk_registry_get_factory ( + atk_get_default_registry (), + GNOME_TYPE_CANVAS_GROUP); derived_atk_type = atk_object_factory_get_accessible_type (factory); g_type_query (derived_atk_type, &query); tinfo.class_size = query.class_size; tinfo.instance_size = query.instance_size; - type = g_type_register_static ( derived_atk_type, - "EaMinicard", &tinfo, 0); - g_type_add_interface_static (type, ATK_TYPE_ACTION, - &atk_action_info); + type = g_type_register_static ( + derived_atk_type, + "EaMinicard", &tinfo, 0); + g_type_add_interface_static ( + type, ATK_TYPE_ACTION, + &atk_action_info); } return type; @@ -145,8 +148,9 @@ ea_minicard_get_name (AtkObject *accessible) g_return_val_if_fail (EA_IS_MINICARD (accessible), NULL); memset (name, '\0', BUFFERSIZE); - card = E_MINICARD (atk_gobject_accessible_get_object - (ATK_GOBJECT_ACCESSIBLE (accessible))); + card = E_MINICARD ( + atk_gobject_accessible_get_object ( + ATK_GOBJECT_ACCESSIBLE (accessible))); if (!card) return NULL; @@ -290,7 +294,7 @@ static const gchar * atk_action_interface_get_name (AtkAction *iface, gint i) { - if ( i >= G_N_ELEMENTS (action_name) || i < 0) + if (i >= G_N_ELEMENTS (action_name) || i < 0) return NULL; return action_name[i]; diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index 66928b9f85..e00e089d38 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -552,12 +552,15 @@ eab_contact_display_init (EABContactDisplay *display) ui_manager = e_web_view_get_ui_manager (web_view); #ifdef WITH_CONTACT_MAPS - g_signal_connect (web_view, "create-plugin-widget", + g_signal_connect ( + web_view, "create-plugin-widget", G_CALLBACK (contact_display_object_requested), display); #endif - g_signal_connect (web_view, "notify::load-status", + g_signal_connect ( + web_view, "notify::load-status", G_CALLBACK (contact_display_load_status_changed), NULL); - g_signal_connect (web_view, "style-set", + g_signal_connect ( + web_view, "style-set", G_CALLBACK (load_contact), NULL); e_web_view_install_request_handler (E_WEB_VIEW (display), E_TYPE_FILE_REQUEST); @@ -654,7 +657,7 @@ eab_contact_display_set_show_maps (EABContactDisplay *display, { g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display)); - if ((display->priv->show_maps ? 1 : 0) == (show_maps ? 1 : 0)) + if (display->priv->show_maps == show_maps) return; display->priv->show_maps = show_maps; diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c index d04cc07f04..7a001cf44c 100644 --- a/addressbook/gui/widgets/eab-contact-formatter.c +++ b/addressbook/gui/widgets/eab-contact-formatter.c @@ -333,9 +333,10 @@ accum_time_attribute (GString *buffer, date = e_contact_get (contact, field); if (date) { - gdate = g_date_new_dmy ( date->day, - date->month, - date->year ); + gdate = g_date_new_dmy ( + date->day, + date->month, + date->year); g_date_strftime (sdate, 100, "%x", gdate); g_date_free (gdate); render_table_row (buffer, html_label, sdate, icon, html_flags); @@ -477,8 +478,8 @@ render_contact_list_row (EABContactFormatter *formatter, buffer, "<td width=" IMAGE_COL_WIDTH " valign=\"top\" align=\"left\">" "<img src=\"evo-file://%s/minus.png\" " - "id=\"%s\" " - "class=\"navigable _evo_collapse_button\">" + "id=\"%s\" " + "class=\"navigable _evo_collapse_button\">" "</td><td width=\"100%%\" align=\"left\">%s", evolution_imagesdir, e_destination_get_contact_uid (destination), @@ -642,13 +643,15 @@ accum_address_map (GString *buffer, g_string_append (buffer, "<tr><td colspan=\"3\">"); if (map_type == E_CONTACT_ADDRESS_WORK) { - g_string_append (buffer, - "<object type=\"application/x-work-map-widget\" " - "width=\"250\" height=\"250\"></object>"); + g_string_append ( + buffer, + "<object type=\"application/x-work-map-widget\" " + "width=\"250\" height=\"250\"></object>"); } else { - g_string_append (buffer, - "<object type=\"application/x-home-map-widget\" " - "width=\"250\" height=\"250\"></object>"); + g_string_append ( + buffer, + "<object type=\"application/x-home-map-widget\" " + "width=\"250\" height=\"250\"></object>"); } g_string_append (buffer, "</td></tr>"); @@ -869,8 +872,8 @@ render_compact (EABContactFormatter *formatter, max_dimension = calced_height; if (max_dimension > MAX_COMPACT_IMAGE_DIMENSION) { - calced_width *= ( (gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension); - calced_height *= ( (gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension); + calced_width *= ((gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension); + calced_height *= ((gfloat) MAX_COMPACT_IMAGE_DIMENSION / max_dimension); } g_object_unref (pixbuf); @@ -892,7 +895,8 @@ render_compact (EABContactFormatter *formatter, photo_data = g_base64_encode ( photo->data.inlined.data, photo->data.inlined.length); - g_string_append_printf (buffer, + g_string_append_printf ( + buffer, "<img border=\"1\" src=\"data:%s;base64,%s\" " "width=\"%d\" height=\"%d\">", photo->data.inlined.mime_type, @@ -1093,22 +1097,26 @@ eab_contact_formatter_get_property (GObject *object, switch (property_id) { case PROP_DISPLAY_MODE: - g_value_set_int (value, + g_value_set_int ( + value, eab_contact_formatter_get_display_mode ( formatter)); return; case PROP_RENDER_MAPS: - g_value_set_boolean (value, + g_value_set_boolean ( + value, eab_contact_formatter_get_render_maps ( formatter)); return; case PROP_STYLE: - g_value_set_object (value, + g_value_set_object ( + value, eab_contact_formatter_get_style ( formatter)); return; case PROP_STATE: - g_value_set_uint (value, + g_value_set_uint ( + value, eab_contact_formatter_get_state ( formatter)); return; @@ -1203,10 +1211,11 @@ EABContactFormatter * eab_contact_formatter_new (EABContactDisplayMode mode, gboolean render_maps) { - return g_object_new (EAB_TYPE_CONTACT_FORMATTER, - "display-mode", mode, - "render-maps", render_maps, - NULL); + return g_object_new ( + EAB_TYPE_CONTACT_FORMATTER, + "display-mode", mode, + "render-maps", render_maps, + NULL); } void diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index e0eed37cc3..736f64d422 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -141,7 +141,7 @@ eab_load_error_dialog (GtkWidget *parent, label = g_strdup_printf ( _("This address book cannot be opened. Please check that the " - "path %s exists and that permissions are set to access it."), path); + "path %s exists and that permissions are set to access it."), path); g_free (path); label_string = label; @@ -994,7 +994,8 @@ parse_address_template_section (const gchar *format, if (address->street && *(address->street)) { g_string_append (res, address->street); if (address->ext && *(address->ext)) - g_string_append_printf (res, "\n%s", + g_string_append_printf ( + res, "\n%s", address->ext); ret = TRUE; } @@ -1136,11 +1137,13 @@ eab_format_address (EContact *contact, * and skip full names, as it's part of the EContact itself, * check this bug for reason: https://bugzilla.gnome.org/show_bug.cgi?id=667912 */ - parse_address_template_section (format, - NULL, - (address_type == E_CONTACT_ADDRESS_WORK) ? e_contact_get_const (contact, E_CONTACT_ORG): NULL, - addr, - &result); + parse_address_template_section ( + format, + NULL, + (address_type == E_CONTACT_ADDRESS_WORK) ? + e_contact_get_const (contact, E_CONTACT_ORG) : NULL, + addr, + &result); /* Add the country line. In some countries, the address can be located above the * rest of the address */ diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 3adf2afe4f..c95b2f4357 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -257,7 +257,7 @@ parseLine (GHashTable *dn_contact_hash, return FALSE; } - colon = (gchar *) strchr ( ptr, ':' ); + colon = (gchar *) strchr (ptr, ':'); if (colon) { gint i; @@ -266,7 +266,7 @@ parseLine (GHashTable *dn_contact_hash, 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++) { @@ -475,11 +475,12 @@ add_to_notes (EContact *contact, if (!field_text || !*field_text) return; - new_text = g_strdup_printf ("%s%s%s: %s", - old_text ? old_text : "", - old_text && *old_text && - *(old_text + strlen (old_text) - 1) != '\n' ? "\n" : "", - e_contact_pretty_name (field), field_text); + new_text = g_strdup_printf ( + "%s%s%s: %s", + old_text ? old_text : "", + old_text && *old_text && + *(old_text + strlen (old_text) - 1) != '\n' ? "\n" : "", + e_contact_pretty_name (field), field_text); e_contact_set (contact, E_CONTACT_NOTE, new_text); g_free (new_text); } diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 2e452c24ad..d430bd24eb 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -95,11 +95,12 @@ add_to_notes (EContact *contact, if (!field_text || !*field_text) return; - new_text = g_strdup_printf ("%s%s%s: %s", - old_text ? old_text : "", - old_text && *old_text && - *(old_text + strlen (old_text) - 1) != '\n' ? "\n" : "", - e_contact_pretty_name (field), field_text); + new_text = g_strdup_printf ( + "%s%s%s: %s", + old_text ? old_text : "", + old_text && *old_text && + *(old_text + strlen (old_text) - 1) != '\n' ? "\n" : "", + e_contact_pretty_name (field), field_text); e_contact_set (contact, E_CONTACT_NOTE, new_text); g_free (new_text); } @@ -191,15 +192,17 @@ vcard_import_contact (VCardImporter *gci, * the rest should be kept as is */ if (location_only) { /* add VOICE */ - e_vcard_attribute_add_param_with_value (a, - e_vcard_attribute_param_new (EVC_TYPE), - "VOICE"); + e_vcard_attribute_add_param_with_value ( + a, + e_vcard_attribute_param_new (EVC_TYPE), + "VOICE"); } if (no_location) { /* add OTHER */ - e_vcard_attribute_add_param_with_value (a, - e_vcard_attribute_param_new (EVC_TYPE), - "OTHER"); + e_vcard_attribute_add_param_with_value ( + a, + e_vcard_attribute_param_new (EVC_TYPE), + "OTHER"); } } } @@ -235,7 +238,8 @@ vcard_import_contact (VCardImporter *gci, if (no_location) { /* add OTHER */ - e_vcard_attribute_add_param_with_value (a, + e_vcard_attribute_add_param_with_value ( + a, e_vcard_attribute_param_new (EVC_TYPE), "OTHER"); } @@ -977,10 +981,11 @@ evolution_contact_importer_get_preview_widget (const GSList *contacts) } gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, + gtk_list_store_set ( + store, &iter, 0, description ? description : "", 1, contact, - -1 ); + -1); g_free (free_description); } @@ -999,7 +1004,8 @@ evolution_contact_importer_get_preview_widget (const GSList *contacts) gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store)); g_object_unref (store); - gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Contact"), + gtk_tree_view_insert_column_with_attributes ( + tree_view, -1, _("Contact"), gtk_cell_renderer_text_new (), "text", 0, NULL); if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL) > 1) diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index c535be4914..290863c817 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -255,7 +255,8 @@ e_contact_get_contact_height (EContact *contact, if (value == NULL || *value == '\0') continue; - text = g_strdup_printf ("%s: %s", + text = g_strdup_printf ( + "%s: %s", e_contact_pretty_name (field), value); cntct_height += e_contact_text_height ( @@ -293,7 +294,8 @@ e_contact_print_contact (EContact *contact, if (ctxt->style->print_using_grey && ctxt->pages == ctxt->page_nr) { cairo_save (cr); cairo_set_source_rgb (cr, .85, .85, .85); - cairo_rectangle (cr, ctxt->x, ctxt->y, ctxt->column_width, + cairo_rectangle ( + cr, ctxt->x, ctxt->y, ctxt->column_width, e_contact_text_height (ctxt->context, ctxt->style->headings_font, file_as)); cairo_fill (cr); @@ -324,7 +326,8 @@ e_contact_print_contact (EContact *contact, if (value == NULL || *value == '\0') continue; - text = g_strdup_printf ("%s: %s", + text = g_strdup_printf ( + "%s: %s", e_contact_pretty_name (field), value); if (ctxt->pages == ctxt->page_nr) @@ -340,8 +343,10 @@ e_contact_print_contact (EContact *contact, (ctxt->column_width + 4)) + 1; ctxt->y = ctxt->y + ((wrapped_lines + 1) * - e_contact_text_height (ctxt->context, - ctxt->style->body_font, text)); + e_contact_text_height ( + ctxt->context, + ctxt->style->body_font, + text)); ctxt->y += .2 * get_font_height (ctxt->style->body_font); @@ -521,70 +526,70 @@ e_contact_build_style (EContactPrintStyle *style) xmlNodePtr stylenode = xmlDocGetRootElement (styledoc); xmlNodePtr node; for (node = stylenode->children; node; node = node->next) { - gchar *data = (gchar *) xmlNodeGetContent ( node ); - if (!strcmp ( (gchar *) node->name, "title" )) { + gchar *data = (gchar *) xmlNodeGetContent (node); + if (!strcmp ((gchar *) node->name, "title")) { get_string (data, &(style->title)); - } else if (!strcmp ( (gchar *) node->name, "type" )) { + } else if (!strcmp ((gchar *) node->name, "type")) { if (g_ascii_strcasecmp (data, "cards") == 0) style->type = E_CONTACT_PRINT_TYPE_CARDS; else if (g_ascii_strcasecmp (data, "memo_style") == 0) style->type = E_CONTACT_PRINT_TYPE_MEMO_STYLE; else if (g_ascii_strcasecmp (data, "phone_list") == 0) style->type = E_CONTACT_PRINT_TYPE_PHONE_LIST; - } else if (!strcmp ( (gchar *) node->name, "sections_start_new_page" )) { + } else if (!strcmp ((gchar *) node->name, "sections_start_new_page")) { style->sections_start_new_page = get_bool (data); - } else if (!strcmp ( (gchar *) node->name, "num_columns" )) { + } else if (!strcmp ((gchar *) node->name, "num_columns")) { style->num_columns = get_integer (data); - } else if (!strcmp ( (gchar *) node->name, "blank_forms" )) { + } else if (!strcmp ((gchar *) node->name, "blank_forms")) { style->blank_forms = get_integer (data); - } else if (!strcmp ( (gchar *) node->name, "letter_headings" )) { + } else if (!strcmp ((gchar *) node->name, "letter_headings")) { style->letter_headings = get_bool (data); - } else if (!strcmp ( (gchar *) node->name, "headings_font" )) { - get_font ( data, &(style->headings_font) ); - } else if (!strcmp ( (gchar *) node->name, "body_font" )) { - get_font ( data, &(style->body_font) ); - } else if (!strcmp ( (gchar *) node->name, "print_using_grey" )) { + } else if (!strcmp ((gchar *) node->name, "headings_font")) { + get_font (data, &(style->headings_font)); + } else if (!strcmp ((gchar *) node->name, "body_font")) { + get_font (data, &(style->body_font)); + } else if (!strcmp ((gchar *) node->name, "print_using_grey")) { style->print_using_grey = get_bool (data); - } else if (!strcmp ( (gchar *) node->name, "paper_width" )) { + } else if (!strcmp ((gchar *) node->name, "paper_width")) { style->paper_width = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "paper_height" )) { + } else if (!strcmp ((gchar *) node->name, "paper_height")) { style->paper_height = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "top_margin" )) { + } else if (!strcmp ((gchar *) node->name, "top_margin")) { style->top_margin = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "left_margin" )) { + } else if (!strcmp ((gchar *) node->name, "left_margin")) { style->left_margin = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "bottom_margin" )) { + } else if (!strcmp ((gchar *) node->name, "bottom_margin")) { style->bottom_margin = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "right_margin" )) { + } else if (!strcmp ((gchar *) node->name, "right_margin")) { style->right_margin = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "page_width" )) { + } else if (!strcmp ((gchar *) node->name, "page_width")) { style->page_width = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "page_height" )) { + } else if (!strcmp ((gchar *) node->name, "page_height")) { style->page_height = get_float (data); - } else if (!strcmp ( (gchar *) node->name, "orientation" )) { + } else if (!strcmp ((gchar *) node->name, "orientation")) { if (data) { style->orientation_portrait = (g_ascii_strcasecmp (data, "landscape") != 0); } else { style->orientation_portrait = TRUE; } - } else if (!strcmp ( (gchar *) node->name, "header_font" )) { - get_font ( data, &(style->header_font) ); - } else if (!strcmp ( (gchar *) node->name, "left_header" )) { + } else if (!strcmp ((gchar *) node->name, "header_font")) { + get_font (data, &(style->header_font)); + } else if (!strcmp ((gchar *) node->name, "left_header")) { get_string (data, &(style->left_header)); - } else if (!strcmp ( (gchar *) node->name, "center_header" )) { + } else if (!strcmp ((gchar *) node->name, "center_header")) { get_string (data, &(style->center_header)); - } else if (!strcmp ( (gchar *) node->name, "right_header" )) { + } else if (!strcmp ((gchar *) node->name, "right_header")) { get_string (data, &(style->right_header)); - } else if (!strcmp ( (gchar *) node->name, "footer_font" )) { - get_font ( data, &(style->footer_font) ); - } else if (!strcmp ( (gchar *) node->name, "left_footer" )) { + } else if (!strcmp ((gchar *) node->name, "footer_font")) { + get_font (data, &(style->footer_font)); + } else if (!strcmp ((gchar *) node->name, "left_footer")) { get_string (data, &(style->left_footer)); - } else if (!strcmp ( (gchar *) node->name, "center_footer" )) { + } else if (!strcmp ((gchar *) node->name, "center_footer")) { get_string (data, &(style->center_footer)); - } else if (!strcmp ( (gchar *) node->name, "right_footer" )) { + } else if (!strcmp ((gchar *) node->name, "right_footer")) { get_string (data, &(style->right_footer)); - } else if (!strcmp ( (gchar *) node->name, "reverse_on_even_pages" )) { + } else if (!strcmp ((gchar *) node->name, "reverse_on_even_pages")) { style->reverse_on_even_pages = get_bool (data); } if (data) @@ -716,7 +721,7 @@ contact_page_draw_footer (GtkPrintOperation *operation, * g_object_get (operation, "n-pages", &n_pages, NULL)*/ text = g_strdup_printf (_("Page %d"), page_nr + 1); - setup = gtk_print_context_get_page_setup ( context); + setup = gtk_print_context_get_page_setup (context); page_height = gtk_page_setup_get_page_height (setup, GTK_UNIT_POINTS); page_width = gtk_page_setup_get_page_width (setup, GTK_UNIT_POINTS); page_margin = gtk_page_setup_get_bottom_margin (setup, GTK_UNIT_POINTS); |