From e2b6ff7a6c1e1580c26ee0719b349151e8dad6fd Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Sep 2011 01:13:42 -0400 Subject: Miscellaneous cleanups from the account-mgmt branch. Reducing diff noise so I can see important changes easier when comparing branches. A few API changes, but nothing that affects functionality. --- .../gui/contact-editor/e-contact-quick-add.c | 2 + .../gui/contact-editor/e-contact-quick-add.h | 26 ++-- .../contact-list-editor/e-contact-list-editor.c | 138 ++++++++++++--------- addressbook/gui/merging/eab-contact-compare.c | 3 +- addressbook/gui/merging/eab-contact-compare.h | 62 ++++++--- addressbook/gui/merging/eab-contact-merging.c | 20 ++- addressbook/gui/merging/eab-contact-merging.h | 15 ++- addressbook/gui/widgets/e-addressbook-model.c | 9 +- addressbook/gui/widgets/e-addressbook-model.h | 6 +- addressbook/gui/widgets/e-addressbook-selector.c | 6 +- .../gui/widgets/e-addressbook-table-adapter.c | 7 +- addressbook/gui/widgets/e-addressbook-view.c | 9 +- addressbook/gui/widgets/ea-minicard-view.c | 19 +-- addressbook/gui/widgets/eab-gui-util.c | 24 ++-- addressbook/importers/evolution-csv-importer.c | 9 +- addressbook/importers/evolution-ldif-importer.c | 2 +- addressbook/importers/evolution-vcard-importer.c | 6 +- addressbook/util/eab-book-util.c | 6 +- addressbook/util/eab-book-util.h | 23 ++-- 19 files changed, 248 insertions(+), 144 deletions(-) (limited to 'addressbook') diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 96af36fed2..3595437f28 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -411,6 +411,7 @@ source_changed (ESourceComboBox *source_combo_box, ESource *source; source = e_source_combo_box_get_active (source_combo_box); + if (source != NULL) { if (qa->source != NULL) g_object_unref (qa->source); @@ -472,6 +473,7 @@ build_quick_add_dialog (QuickAdd *qa) gconf_client, "/apps/evolution/addressbook/sources"); source = e_source_list_peek_default_source (qa->source_list); g_object_unref (gconf_client); + qa->combo_box = e_source_combo_box_new (qa->source_list); e_source_combo_box_set_active ( E_SOURCE_COMBO_BOX (qa->combo_box), source); diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h index a4d06ef12a..861ddba24d 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.h +++ b/addressbook/gui/contact-editor/e-contact-quick-add.h @@ -25,16 +25,22 @@ #include -typedef void (*EContactQuickAddCallback) (EContact *new_contact, gpointer closure); - -void e_contact_quick_add (const gchar *name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_email (const gchar *email, EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_vcard (const gchar *vcard, EContactQuickAddCallback cb, gpointer closure); +typedef void (*EContactQuickAddCallback) (EContact *new_contact, + gpointer closure); + +void e_contact_quick_add (const gchar *name, + const gchar *email, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_free_form (const gchar *text, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_email (const gchar *email, + EContactQuickAddCallback cb, + gpointer closure); +void e_contact_quick_add_vcard (const gchar *vcard, + EContactQuickAddCallback cb, + gpointer closure); #endif /* __E_CONTACT_QUICK_ADD_H__ */ 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 1750f5a686..d6a373ad38 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -49,6 +49,10 @@ #include "e-contact-list-model.h" #include "eab-contact-merging.h" +#define E_CONTACT_LIST_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate)) + #define CONTACT_LIST_EDITOR_WIDGET(editor, name) \ (e_builder_get_widget \ (E_CONTACT_LIST_EDITOR (editor)->priv->builder, name)) @@ -1341,6 +1345,76 @@ contact_list_editor_dispose (GObject *object) G_OBJECT_CLASS (parent_class)->dispose (object); } +static void +contact_list_editor_constructed (GObject *object) +{ + EContactListEditor *editor; + GtkTreeViewColumn *column; + GtkCellRenderer *renderer; + GtkTreeView *view; + GtkTreeSelection *selection; + + editor = E_CONTACT_LIST_EDITOR (object); + + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); + + editor->priv->editable = TRUE; + editor->priv->allows_contact_lists = TRUE; + + editor->priv->builder = gtk_builder_new (); + e_load_ui_builder_definition ( + editor->priv->builder, "contact-list-editor.ui"); + gtk_builder_connect_signals (editor->priv->builder, NULL); + + /* Embed a pointer to the EContactListEditor in the top-level + * widget. Signal handlers can then access the pointer from any + * child widget by calling contact_list_editor_extract(widget). */ + g_object_set_data (G_OBJECT (WIDGET (DIALOG)), TOPLEVEL_KEY, editor); + + view = GTK_TREE_VIEW (WIDGET (TREE_VIEW)); + editor->priv->model = e_contact_list_model_new (); + gtk_tree_view_set_model (view, editor->priv->model); + + selection = gtk_tree_view_get_selection (view); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); + g_signal_connect (selection, "changed", + G_CALLBACK (contact_list_editor_selection_changed_cb), editor); + + gtk_tree_view_enable_model_drag_dest (view, NULL, 0, GDK_ACTION_LINK); + e_drag_dest_add_directory_targets (WIDGET (TREE_VIEW)); + gtk_drag_dest_add_text_targets (WIDGET (TREE_VIEW)); + + column = gtk_tree_view_column_new (); + renderer = gtk_cell_renderer_text_new (); + g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); + gtk_tree_view_column_pack_start (column, renderer, TRUE); + gtk_tree_view_append_column (view, column); + + gtk_tree_view_column_set_cell_data_func ( + column, renderer, (GtkTreeCellDataFunc) + contact_list_editor_render_destination, NULL, NULL); + + editor->priv->name_selector = e_name_selector_new (); + + e_name_selector_model_add_section ( + e_name_selector_peek_model (editor->priv->name_selector), + "Members", _("_Members"), NULL); + + g_signal_connect ( + editor, "notify::book", + G_CALLBACK (contact_list_editor_notify_cb), NULL); + g_signal_connect ( + editor, "notify::editable", + G_CALLBACK (contact_list_editor_notify_cb), NULL); + + gtk_widget_show_all (WIDGET (DIALOG)); + + setup_custom_widgets (editor); + + e_name_selector_load_books (editor->priv->name_selector); +} + /**************************** EABEditor Callbacks ****************************/ static void @@ -1492,6 +1566,7 @@ contact_list_editor_class_init (EContactListEditorClass *class) object_class->set_property = contact_list_editor_set_property; object_class->get_property = contact_list_editor_get_property; object_class->dispose = contact_list_editor_dispose; + object_class->constructed = contact_list_editor_constructed; editor_class = EAB_EDITOR_CLASS (class); editor_class->show = contact_list_editor_show; @@ -1550,68 +1625,7 @@ contact_list_editor_class_init (EContactListEditorClass *class) static void contact_list_editor_init (EContactListEditor *editor) { - EContactListEditorPrivate *priv; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkTreeView *view; - GtkTreeSelection *selection; - - editor->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE ( - editor, E_TYPE_CONTACT_LIST_EDITOR, EContactListEditorPrivate); - - priv->editable = TRUE; - priv->allows_contact_lists = TRUE; - - priv->builder = gtk_builder_new (); - e_load_ui_builder_definition (priv->builder, "contact-list-editor.ui"); - gtk_builder_connect_signals (priv->builder, NULL); - - /* Embed a pointer to the EContactListEditor in the top-level - * widget. Signal handlers can then access the pointer from any - * child widget by calling contact_list_editor_extract(widget). */ - g_object_set_data (G_OBJECT (WIDGET (DIALOG)), TOPLEVEL_KEY, editor); - - view = GTK_TREE_VIEW (WIDGET (TREE_VIEW)); - priv->model = e_contact_list_model_new (); - gtk_tree_view_set_model (view, priv->model); - - selection = gtk_tree_view_get_selection (view); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - g_signal_connect (selection, "changed", - G_CALLBACK (contact_list_editor_selection_changed_cb), editor); - - gtk_tree_view_enable_model_drag_dest (view, NULL, 0, GDK_ACTION_LINK); - e_drag_dest_add_directory_targets (WIDGET (TREE_VIEW)); - gtk_drag_dest_add_text_targets (WIDGET (TREE_VIEW)); - - column = gtk_tree_view_column_new (); - renderer = gtk_cell_renderer_text_new (); - g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); - gtk_tree_view_column_pack_start (column, renderer, TRUE); - gtk_tree_view_append_column (view, column); - - gtk_tree_view_column_set_cell_data_func ( - column, renderer, (GtkTreeCellDataFunc) - contact_list_editor_render_destination, NULL, NULL); - - priv->name_selector = e_name_selector_new (); - - e_name_selector_model_add_section ( - e_name_selector_peek_model (priv->name_selector), - "Members", _("_Members"), NULL); - - g_signal_connect ( - editor, "notify::book", - G_CALLBACK (contact_list_editor_notify_cb), NULL); - g_signal_connect ( - editor, "notify::editable", - G_CALLBACK (contact_list_editor_notify_cb), NULL); - - gtk_widget_show_all (WIDGET (DIALOG)); - - setup_custom_widgets (editor); - - e_name_selector_load_books (priv->name_selector); + editor->priv = E_CONTACT_LIST_EDITOR_GET_PRIVATE (editor); } /***************************** Public Interface ******************************/ diff --git a/addressbook/gui/merging/eab-contact-compare.c b/addressbook/gui/merging/eab-contact-compare.c index a25ad4e403..231a14281c 100644 --- a/addressbook/gui/merging/eab-contact-compare.c +++ b/addressbook/gui/merging/eab-contact-compare.c @@ -834,7 +834,8 @@ eab_contact_locate_match_full (EBookClient *book_client, source = e_source_list_peek_default_source (info->source_list); - e_client_utils_open_new (source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, + e_client_utils_open_new ( + source, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, book_loaded_cb, info); } diff --git a/addressbook/gui/merging/eab-contact-compare.h b/addressbook/gui/merging/eab-contact-compare.h index 7ce31eddb9..8c07a56f08 100644 --- a/addressbook/gui/merging/eab-contact-compare.h +++ b/addressbook/gui/merging/eab-contact-compare.h @@ -26,8 +26,8 @@ #ifndef __EAB_CONTACT_COMPARE_H__ #define __EAB_CONTACT_COMPARE_H__ -#include #include +#include typedef enum { EAB_CONTACT_MATCH_NOT_APPLICABLE = 0, @@ -45,26 +45,56 @@ typedef enum { EAB_CONTACT_MATCH_PART_FAMILY_NAME = 1 << 3 } EABContactMatchPart; -typedef void (*EABContactMatchQueryCallback) (EContact *contact, EContact *match, EABContactMatchType type, gpointer closure); +typedef void (*EABContactMatchQueryCallback) (EContact *contact, + EContact *match, + EABContactMatchType type, + gpointer closure); -EABContactMatchType eab_contact_compare_name_to_string (EContact *contact, const gchar *str); +EABContactMatchType + eab_contact_compare_name_to_string + (EContact *contact, + const gchar *str); -EABContactMatchType eab_contact_compare_name_to_string_full (EContact *contact, const gchar *str, - gboolean allow_partial_matches, - gint *matched_parts, EABContactMatchPart *first_matched_part, - gint *matched_character_count); +EABContactMatchType + eab_contact_compare_name_to_string_full + (EContact *contact, + const gchar *str, + gboolean allow_partial_matches, + gint *matched_parts, + EABContactMatchPart *first_matched_part, + gint *matched_character_count); -EABContactMatchType eab_contact_compare_file_as (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_name (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_nickname (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_email (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_address (EContact *contact1, EContact *contact2); -EABContactMatchType eab_contact_compare_telephone (EContact *contact1, EContact *contact2); +EABContactMatchType + eab_contact_compare_file_as (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_name (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_nickname (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_email (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_address (EContact *contact1, + EContact *contact2); +EABContactMatchType + eab_contact_compare_telephone (EContact *contact1, + EContact *contact2); -EABContactMatchType eab_contact_compare (EContact *contact1, EContact *contact2); +EABContactMatchType + eab_contact_compare (EContact *contact1, + EContact *contact2); -void eab_contact_locate_match (EContact *contact, EABContactMatchQueryCallback cb, gpointer closure); -void eab_contact_locate_match_full (EBookClient *book_client, EContact *contact, GList *avoid, EABContactMatchQueryCallback cb, gpointer closure); +void eab_contact_locate_match (EContact *contact, + EABContactMatchQueryCallback cb, + gpointer closure); +void eab_contact_locate_match_full (EBookClient *book_client, + EContact *contact, + GList *avoid, + EABContactMatchQueryCallback cb, + gpointer closure); #endif /* __E_CONTACT_COMPARE_H__ */ diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index f791eab114..1e70b97d77 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -73,7 +73,10 @@ add_lookup (EContactMergingLookup *lookup) { if (running_merge_requests < SIMULTANEOUS_MERGING_REQUESTS) { running_merge_requests++; - eab_contact_locate_match_full (lookup->book_client, lookup->contact, lookup->avoid, match_query_callback, lookup); + eab_contact_locate_match_full ( + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } else { merging_queue = g_list_append (merging_queue, lookup); @@ -97,8 +100,9 @@ finished_lookup (void) running_merge_requests++; eab_contact_locate_match_full ( - lookup->book_client, lookup->contact, - lookup->avoid, match_query_callback, lookup); + lookup->book_client, + lookup->contact, lookup->avoid, + match_query_callback, lookup); } } @@ -138,8 +142,8 @@ final_cb_as_id (EBookClient *book_client, if (lookup->id_cb) lookup->id_cb ( - lookup->book_client, error, - lookup->contact ? + lookup->book_client, + error, lookup->contact ? e_contact_get_const ( lookup->contact, E_CONTACT_UID) : NULL, lookup->closure); @@ -566,7 +570,11 @@ match_query_callback (EContact *contact, if (lookup->op == E_CONTACT_MERGING_FIND) { if (lookup->c_cb) - lookup->c_cb (lookup->book_client, NULL, (gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE ? NULL : match, lookup->closure); + lookup->c_cb ( + lookup->book_client, NULL, + (gint) type <= (gint) + EAB_CONTACT_MATCH_VAGUE ? NULL : match, + lookup->closure); free_lookup (lookup); finished_lookup (); diff --git a/addressbook/gui/merging/eab-contact-merging.h b/addressbook/gui/merging/eab-contact-merging.h index c8e2ddb3ef..a922d6b9fb 100644 --- a/addressbook/gui/merging/eab-contact-merging.h +++ b/addressbook/gui/merging/eab-contact-merging.h @@ -30,9 +30,18 @@ G_BEGIN_DECLS -typedef void (*EABMergingAsyncCallback) (EBookClient *book_client, const GError *error, gpointer closure); -typedef void (*EABMergingIdAsyncCallback) (EBookClient *book_client, const GError *error, const gchar *id, gpointer closure); -typedef void (*EABMergingContactAsyncCallback) (EBookClient *book_client, const GError *error, EContact *contact, gpointer closure); +typedef void (*EABMergingAsyncCallback) (EBookClient *book_client, + const GError *error, + gpointer closure); +typedef void (*EABMergingIdAsyncCallback) (EBookClient *book_client, + const GError *error, + const gchar *id, + gpointer closure); +typedef void (*EABMergingContactAsyncCallback) + (EBookClient *book_client, + const GError *error, + EContact *contact, + gpointer closure); gboolean eab_merging_book_add_contact (EBookClient *book_client, EContact *contact, diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 74e794bd6e..fa61c4e5e2 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -576,7 +576,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) "EBookClient", NULL, E_TYPE_BOOK_CLIENT, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -586,7 +587,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) "Editable", NULL, FALSE, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, @@ -597,7 +599,8 @@ addressbook_model_class_init (EAddressbookModelClass *class) NULL, NULL, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT)); + G_PARAM_CONSTRUCT | + G_PARAM_STATIC_STRINGS)); signals[WRITABLE_STATUS] = g_signal_new ("writable_status", diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h index 13d23e92b0..680352c717 100644 --- a/addressbook/gui/widgets/e-addressbook-model.h +++ b/addressbook/gui/widgets/e-addressbook-model.h @@ -104,8 +104,10 @@ gint e_addressbook_model_find (EAddressbookModel *model, EBookClient * e_addressbook_model_get_client (EAddressbookModel *model); void e_addressbook_model_set_client (EAddressbookModel *model, EBookClient *book_client); -gboolean e_addressbook_model_get_editable (EAddressbookModel *model); -void e_addressbook_model_set_editable (EAddressbookModel *model, +gboolean e_addressbook_model_get_editable + (EAddressbookModel *model); +void e_addressbook_model_set_editable + (EAddressbookModel *model, gboolean editable); gchar * e_addressbook_model_get_query (EAddressbookModel *model); void e_addressbook_model_set_query (EAddressbookModel *model, diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index b6bfa01537..30bb8899f5 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -293,7 +293,8 @@ target_client_open_ready_cb (GObject *source_object, } eab_merging_book_add_contact ( - merge_context->target_client, merge_context->current_contact, + merge_context->target_client, + merge_context->current_contact, addressbook_selector_merge_next_cb, merge_context); } @@ -335,7 +336,8 @@ addressbook_selector_data_dropped (ESourceSelector *selector, merge_context->remove_from_source = remove_from_source; merge_context->pending_adds = TRUE; - e_client_utils_open_new (destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, + e_client_utils_open_new ( + destination, E_CLIENT_SOURCE_TYPE_CONTACTS, FALSE, NULL, e_client_utils_authenticate_handler, NULL, target_client_open_ready_cb, merge_context); diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index f102b684d7..463bdc7a3d 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -168,8 +168,11 @@ addressbook_set_value_at (ETableModel *etc, EAddressbookTableAdapterPrivate *priv = adapter->priv; if (e_addressbook_model_get_editable (priv->model)) { + EBookClient *book_client; EContact *contact; + book_client = e_addressbook_model_get_client (priv->model); + if (col >= COLS || row >= e_addressbook_model_contact_count (priv->model)) return; @@ -191,7 +194,7 @@ addressbook_set_value_at (ETableModel *etc, e_contact_set (contact, col, (gpointer) val); eab_merging_book_modify_contact ( - e_addressbook_model_get_client (priv->model), + book_client, contact, contact_modified_cb, etc); g_object_unref (contact); @@ -218,8 +221,8 @@ addressbook_append_row (ETableModel *etm, { EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER (etm); EAddressbookTableAdapterPrivate *priv = adapter->priv; - EContact *contact; EBookClient *book_client; + EContact *contact; gint col; contact = e_contact_new (); diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 7f3a7a85b8..9bda90a280 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1111,7 +1111,7 @@ folder_bar_message (EAddressbookView *view, { EShellView *shell_view; EShellSidebar *shell_sidebar; - const gchar *name; + const gchar *display_name; shell_view = e_addressbook_view_get_shell_view (view); shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); @@ -1119,8 +1119,8 @@ folder_bar_message (EAddressbookView *view, if (view->priv->source == NULL) return; - name = e_source_peek_name (view->priv->source); - e_shell_sidebar_set_primary_text (shell_sidebar, name); + display_name = e_source_peek_name (view->priv->source); + e_shell_sidebar_set_primary_text (shell_sidebar, display_name); e_shell_sidebar_set_secondary_text (shell_sidebar, message); } @@ -1622,7 +1622,8 @@ view_transfer_contacts (EAddressbookView *view, contacts = e_addressbook_view_get_selected (view); eab_transfer_contacts ( - book_client, contacts, delete_from_source, alert_sink); + book_client, contacts, + delete_from_source, alert_sink); } } diff --git a/addressbook/gui/widgets/ea-minicard-view.c b/addressbook/gui/widgets/ea-minicard-view.c index 58d3a5fd2b..6772a0bf80 100644 --- a/addressbook/gui/widgets/ea-minicard-view.c +++ b/addressbook/gui/widgets/ea-minicard-view.c @@ -149,7 +149,8 @@ ea_minicard_view_get_name (AtkObject *accessible) gchar *string; EMinicardView *card_view; EBookClient *book_client = NULL; - const gchar *source_name; + ESource *source; + const gchar *display_name; g_return_val_if_fail (EA_IS_MINICARD_VIEW (accessible), NULL); @@ -163,13 +164,14 @@ ea_minicard_view_get_name (AtkObject *accessible) card_view = E_MINICARD_VIEW (reflow); g_object_get (card_view->adapter, "client", &book_client, NULL); g_return_val_if_fail (E_IS_BOOK_CLIENT (book_client), NULL); - source_name = e_source_peek_name (e_client_get_source (E_CLIENT (book_client))); - if (!source_name) - source_name=""; + source = e_client_get_source (E_CLIENT (book_client)); + display_name = e_source_peek_name (source); + 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), source_name, reflow->count); + reflow->count), display_name, reflow->count); ATK_OBJECT_CLASS (parent_class)->set_name (accessible, string); g_free (string); @@ -372,7 +374,9 @@ static void atk_action_interface_init (AtkActionIface *iface) iface->get_name = atk_action_interface_get_name; } -static gboolean atk_action_interface_do_action (AtkAction *action, gint i) +static gboolean +atk_action_interface_do_action (AtkAction *action, + gint i) { gboolean return_value = TRUE; EMinicardView *card_view; @@ -405,7 +409,8 @@ static gboolean atk_action_interface_do_action (AtkAction *action, gint i) return return_value; } -static gint atk_action_interface_get_n_action (AtkAction *iface) +static gint +atk_action_interface_get_n_action (AtkAction *iface) { return G_N_ELEMENTS (action_name); } diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index c951b290c7..00f4e884c7 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -34,13 +34,13 @@ #include #include +#include #include #include #include #include #include "eab-gui-util.h" #include "util/eab-book-util.h" -#include #include "e-util/e-alert-dialog.h" #include "e-util/e-html-utils.h" #include "shell/e-shell.h" @@ -319,14 +319,18 @@ eab_select_source (ESource *except_source, selector = e_source_selector_new (source_list); e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE); if (except_source) - g_object_set_data (G_OBJECT (ok_button), "except-source", e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (except_source))); - g_signal_connect (selector, "primary_selection_changed", - G_CALLBACK (source_selection_changed_cb), ok_button); + g_object_set_data ( + G_OBJECT (ok_button), "except-source", + e_source_list_peek_source_by_uid (source_list, e_source_peek_uid (except_source))); + g_signal_connect ( + selector, "primary_selection_changed", + G_CALLBACK (source_selection_changed_cb), ok_button); if (select_uid) { source = e_source_list_peek_source_by_uid (source_list, select_uid); if (source) - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), source); + e_source_selector_set_primary_selection ( + E_SOURCE_SELECTOR (selector), source); } scrolled_window = gtk_scrolled_window_new (NULL, NULL); @@ -493,7 +497,9 @@ do_copy (gpointer data, book_client = process->destination; process->count++; - eab_merging_book_add_contact (book_client, contact, contact_added_cb, process); + eab_merging_book_add_contact ( + book_client, + contact, contact_added_cb, process); } static void @@ -533,6 +539,7 @@ eab_transfer_contacts (EBookClient *source_client, gboolean delete_from_source, EAlertSink *alert_sink) { + ESource *source; ESource *destination; static gchar *last_uid = NULL; ContactCopyProcess *process; @@ -559,9 +566,10 @@ eab_transfer_contacts (EBookClient *source_client, desc = _("Copy contacts to"); } + source = e_client_get_source (E_CLIENT (source_client)); + destination = eab_select_source ( - e_client_get_source (E_CLIENT (source_client)), - desc, NULL, last_uid, window); + source, desc, NULL, last_uid, window); if (!destination) return; diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c index f41a806940..20d0209f4b 100644 --- a/addressbook/importers/evolution-csv-importer.c +++ b/addressbook/importers/evolution-csv-importer.c @@ -40,7 +40,7 @@ #include -#include "e-util/e-import.h" +#include #include "evolution-addressbook-importers.h" @@ -784,9 +784,12 @@ csv_getwidget (EImport *ei, if (primary == NULL) { primary = e_source_list_peek_source_any (source_list); g_object_ref (primary); - g_datalist_set_data_full(&target->data, "csv-source", primary, g_object_unref); + g_datalist_set_data_full ( + &target->data, "csv-source", primary, + (GDestroyNotify) g_object_unref); } - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); + e_source_selector_set_primary_selection ( + E_SOURCE_SELECTOR (selector), primary); g_object_unref (source_list); g_signal_connect ( diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c index 8eb0c57192..989bb805f4 100644 --- a/addressbook/importers/evolution-ldif-importer.c +++ b/addressbook/importers/evolution-ldif-importer.c @@ -47,7 +47,7 @@ #include -#include "e-util/e-import.h" +#include #include "evolution-addressbook-importers.h" diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index cf3a429337..be97f25c98 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -42,9 +42,9 @@ #include #include -#include "e-util/e-import.h" -#include "e-util/e-datetime-format.h" -#include "misc/e-web-view-preview.h" +#include +#include +#include #include "evolution-addressbook-importers.h" diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c index 5c8d3350fd..9839e5174f 100644 --- a/addressbook/util/eab-book-util.c +++ b/addressbook/util/eab-book-util.c @@ -180,7 +180,7 @@ eab_book_and_contact_list_from_string (const gchar *str, *book_client = e_book_client_new_from_uri (uri, NULL); g_free (uri); - return *book_client ? TRUE : FALSE; + return (*book_client != NULL); } gchar * @@ -193,11 +193,11 @@ eab_book_and_contact_list_to_string (EBookClient *book_client, if (!s0) s0 = g_strdup (""); - if (book_client) + if (book_client != NULL) { s1 = g_strconcat ( "Book: ", e_client_get_uri ( E_CLIENT (book_client)), "\r\n", s0, NULL); - else + } else s1 = g_strdup (s0); g_free (s0); diff --git a/addressbook/util/eab-book-util.h b/addressbook/util/eab-book-util.h index 602e7bd44b..4376863973 100644 --- a/addressbook/util/eab-book-util.h +++ b/addressbook/util/eab-book-util.h @@ -28,14 +28,21 @@ G_BEGIN_DECLS -GSList * eab_contact_list_from_string (const gchar *str); -gchar * eab_contact_list_to_string (const GSList *contacts); - -gboolean eab_book_and_contact_list_from_string (const gchar *str, EBookClient **book_client, GSList **contacts); -gchar * eab_book_and_contact_list_to_string (EBookClient *book_client, const GSList *contacts); - -gint e_utf8_casefold_collate_len (const gchar *str1, const gchar *str2, gint len); -gint e_utf8_casefold_collate (const gchar *str1, const gchar *str2); +GSList * eab_contact_list_from_string (const gchar *str); +gchar * eab_contact_list_to_string (const GSList *contacts); + +gboolean eab_book_and_contact_list_from_string + (const gchar *str, + EBookClient **book_client, + GSList **contacts); +gchar * eab_book_and_contact_list_to_string + (EBookClient *book_client, + const GSList *contacts); +gint e_utf8_casefold_collate_len (const gchar *str1, + const gchar *str2, + gint len); +gint e_utf8_casefold_collate (const gchar *str1, + const gchar *str2); G_END_DECLS -- cgit v1.2.3