From 649bc025dbf8807ab001c874a3f53de1d1826e5b Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 20 Jun 2001 00:45:48 +0000 Subject: track change to e_addressbook_show_contact_editor signature. 2001-06-19 Chris Toshok * gui/widgets/e-addressbook-view.c (table_double_click): track change to e_addressbook_show_contact_editor signature. * gui/widgets/e-minicard-view.c (e_minicard_view_event): same. * gui/widgets/e-minicard.c (e_minicard_event): same. * gui/widgets/e-addressbook-util.c (e_addressbook_error_dialog): add an entry for "Card ID already exists". (e_addressbook_show_contact_editor): track the change to signal names and e_contact_editor_new signature here. * gui/widgets/e-addressbook-util.h: change e_addressbook_show_contact_editor's signature to match e_contact_editor_new more closely. * gui/widgets/e-addressbook-table-adapter.c (unlink_model): free up the simple mapping to plug a potentially sizeable memory leak. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_activate_obj): call e_addressbook_show_contact_editor here. * gui/component/select-names/e-select-names-popup.c (edit_contact_info_have_book_cb): remove the get_supported_fields stuff, since the contact editor handles it for us now, and call e_addressbook_show_contact_editor. * gui/component/e-address-popup.c (edit_contact_info_cb): same. * gui/component/addressbook.c (new_contact_cb): track change to e_addressbook_show_contact_editor. svn path=/trunk/; revision=10318 --- addressbook/gui/widgets/e-addressbook-util.c | 89 ++++++---------------------- 1 file changed, 19 insertions(+), 70 deletions(-) (limited to 'addressbook/gui/widgets/e-addressbook-util.c') diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c index c8ef417116..7ec044adf8 100644 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ b/addressbook/gui/widgets/e-addressbook-util.c @@ -37,6 +37,7 @@ e_addressbook_error_dialog (const gchar *msg, EBookStatus status) N_("Repository offline"), N_("Permission denied"), N_("Card not found"), + N_("Card ID already exists"), N_("Protocol not supported"), N_("Canceled"), N_("Other error") @@ -53,11 +54,12 @@ e_addressbook_error_dialog (const gchar *msg, EBookStatus status) static void card_added_cb (EBook* book, EBookStatus status, const char *id, - gpointer user_data) + gpointer user_data) { g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); - if (status != E_BOOK_STATUS_SUCCESS) + if (status != E_BOOK_STATUS_SUCCESS) { e_addressbook_error_dialog (_("Error adding card"), status); + } } static void @@ -65,97 +67,44 @@ card_modified_cb (EBook* book, EBookStatus status, gpointer user_data) { g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); - if (status != E_BOOK_STATUS_SUCCESS) + if (status != E_BOOK_STATUS_SUCCESS) { e_addressbook_error_dialog (_("Error modifying card"), status); + } } static void -card_removed_cb (EBook* book, EBookStatus status, +card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) { g_print ("%s: %s(): a card was removed\n", __FILE__, __FUNCTION__); - if (status != E_BOOK_STATUS_SUCCESS) + if (status != E_BOOK_STATUS_SUCCESS) { e_addressbook_error_dialog (_("Error removing card"), status); + } } -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_card_merging_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_card_merging_book_commit_card (book, card, card_modified_cb, NULL); -} - -/* Callback for the delete_card signal from the contact editor */ -static void -delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_remove_card (book, card, card_removed_cb, NULL); -} - -/* Callback used when the contact editor is closed */ static void editor_closed_cb (EContactEditor *ce, gpointer data) { gtk_object_unref (GTK_OBJECT (ce)); } -typedef struct { - ECard *card; - gboolean editable; -} SupportedFieldsClosure; - -static void -supported_fields_cb (EBook *book, EBookStatus status, - EList *fields, EContactEditor *ce) -{ - gtk_object_set (GTK_OBJECT (ce), - "writable_fields", fields, - NULL); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "delete_card", - GTK_SIGNAL_FUNC (delete_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - e_contact_editor_show (ce); -} - EContactEditor * e_addressbook_show_contact_editor (EBook *book, ECard *card, + gboolean is_new_card, gboolean editable) { EContactEditor *ce; - gboolean new_card = FALSE; - if (card == NULL) { - new_card = TRUE; - card = e_card_new (""); - } + ce = e_contact_editor_new (book, card, is_new_card, editable); - ce = e_contact_editor_new (card, new_card, NULL, - !editable); - - e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, ce); + gtk_signal_connect (GTK_OBJECT (ce), "card_added", + GTK_SIGNAL_FUNC (card_added_cb), NULL); + gtk_signal_connect (GTK_OBJECT (ce), "card_modified", + GTK_SIGNAL_FUNC (card_modified_cb), NULL); + gtk_signal_connect (GTK_OBJECT (ce), "card_deleted", + GTK_SIGNAL_FUNC (card_deleted_cb), NULL); + gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), NULL); return ce; } -- cgit v1.2.3