From 0d345b68bf4ab7f2d21f3387f11e1c42c335e0b4 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 2 Mar 2001 11:02:33 +0000 Subject: new function. (e_minicard_view_event): split out the creation of the 2001-03-02 Chris Toshok * gui/widgets/e-minicard-view.c (supported_fields_cb): new function. (e_minicard_view_event): split out the creation of the contact editor to the supported_fields callback. * gui/widgets/e-minicard.c (supported_fields_cb): new function. (e_minicard_event): split out the creation of the contact editor to the supported_fields callback. * gui/widgets/e-addressbook-view.c (table_double_click): split function into two functions, since e_book_get_supported_fields requires a callback now. (supported_fields_cb): new function. * gui/component/addressbook.c (new_contact_cb): split this into two functions, since e_book_get_supported_fields requires a callback now. (supported_fields_cb): new function. * contact-editor/test-editor.c (main): track change to e_contact_editor_new (pass NULL for the writable_fields arg.) * contact-editor/contact-editor.glade: fix several labels so they make better sense (since we look them up in e-contact-editor.c.) * contact-editor/e-contact-editor.h (struct _EContactEditor): add writable_fields. also, add it to e_contact_editor_new. * contact-editor/e-contact-editor.c (e_contact_editor_class_init): add writable_fields arg. (e_contact_editor_destroy): unref the writable_fields list. (e_contact_editor_new): pass @fields as the writable_fields arg. (e_contact_editor_set_arg): add writable_fields support. (enable_writable_fields): new (very hairy) function, to disable everything and reenable just the fields listed in the writable_fields list. (_email_arrow_pressed): set label-email1, entry-email1, and checkbutton-htmlmail to be sensitive since the only way to get here is to activate a writable field in the menu. (_address_arrow_pressed): set label-address, button-fulladdr, and text-address to be sensitive for the same reason. (_phone_arrow_pressed): sensitize the label and entry for the same reason. svn path=/trunk/; revision=8516 --- addressbook/gui/component/addressbook.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'addressbook/gui/component/addressbook.c') diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 1cea4c21f2..b80a2b80d7 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -98,22 +98,14 @@ editor_closed_cb (EContactEditor *ce, gpointer data) } static void -new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) +supported_fields_cb (EBook *book, EBookStatus status, EList *fields, gpointer closure) { - ECard *card; - EBook *book; EContactEditor *ce; - AddressbookView *view = (AddressbookView *) user_data; + ECard *card; card = e_card_new(""); - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, TRUE); + ce = e_contact_editor_new (card, TRUE, fields); gtk_signal_connect (GTK_OBJECT (ce), "add_card", GTK_SIGNAL_FUNC (add_card_cb), book); @@ -127,6 +119,21 @@ new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) gtk_object_sink(GTK_OBJECT(card)); } +static void +new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) +{ + EBook *book; + AddressbookView *view = (AddressbookView *) user_data; + + gtk_object_get(GTK_OBJECT(view->view), + "book", &book, + NULL); + + g_assert (E_IS_BOOK (book)); + + e_book_get_supported_fields (book, supported_fields_cb, view); +} + static void config_cb (BonoboUIComponent *uih, void *user_data, const char *path) { -- cgit v1.2.3