diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2003-12-11 10:52:35 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2003-12-11 10:52:35 +0800 |
commit | 80237219dd2404cae88c8ec5653d40a63f6be130 (patch) | |
tree | 3ad3e6f3b0c860a753f49a1de3ef0f962f04d8f5 | |
parent | b05794f797b0c92a0080059964948f38e00a25d9 (diff) | |
download | gsoc2013-evolution-80237219dd2404cae88c8ec5653d40a63f6be130.tar.gz gsoc2013-evolution-80237219dd2404cae88c8ec5653d40a63f6be130.tar.zst gsoc2013-evolution-80237219dd2404cae88c8ec5653d40a63f6be130.zip |
Make "address" a boxed type. (e_contact_editor_address_init): Set address
2003-12-10 Hans Petter Jansson <hpj@ximian.com>
* gui/contact-editor/e-contact-editor-address.c
(e_contact_editor_address_class_init): Make "address" a boxed type.
(e_contact_editor_address_init): Set address to NULL.
(e_contact_editor_address_dispose): Free address.
(e_contact_editor_address_new): Take an EContactAddress.
(e_contact_editor_address_set_property): Re-implement setting the
address property.
(e_contact_editor_address_get_property): Ditto for getting.
(fill_in_info): Enable, use EContactAddress fields.
(extract_info): Ditto.
* gui/contact-editor/e-contact-editor-address.h:
Re-enable the address field, as EContactAddress.
svn path=/trunk/; revision=23923
-rw-r--r-- | addressbook/ChangeLog | 16 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-address.c | 84 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-address.h | 8 |
3 files changed, 59 insertions, 49 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index ca93fbf1ca..4e455e5698 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,19 @@ +2003-12-10 Hans Petter Jansson <hpj@ximian.com> + + * gui/contact-editor/e-contact-editor-address.c + (e_contact_editor_address_class_init): Make "address" a boxed type. + (e_contact_editor_address_init): Set address to NULL. + (e_contact_editor_address_dispose): Free address. + (e_contact_editor_address_new): Take an EContactAddress. + (e_contact_editor_address_set_property): Re-implement setting the + address property. + (e_contact_editor_address_get_property): Ditto for getting. + (fill_in_info): Enable, use EContactAddress fields. + (extract_info): Ditto. + + * gui/contact-editor/e-contact-editor-address.h: + Re-enable the address field, as EContactAddress. + 2003-12-09 JP Rosevear <jpr@ximian.com> * gui/contact-list-editor/e-contact-list-editor.c (fill_in_info): diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c index 34977e3fb7..6ea61a105d 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ b/addressbook/gui/contact-editor/e-contact-editor-address.c @@ -92,10 +92,11 @@ e_contact_editor_address_class_init (EContactEditorAddressClass *klass) object_class->dispose = e_contact_editor_address_dispose; g_object_class_install_property (object_class, PROP_ADDRESS, - g_param_spec_pointer ("address", - _("Address"), - /*_( */"XXX blurb" /*)*/, - G_PARAM_READWRITE)); + g_param_spec_boxed ("address", + _("Address"), + /*_( */"XXX blurb" /*)*/, + e_contact_address_get_type (), + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_EDITABLE, g_param_spec_boolean ("editable", @@ -420,9 +421,7 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) gtk_window_set_resizable(GTK_WINDOW(e_contact_editor_address), TRUE); -#if notyet e_contact_editor_address->address = NULL; -#endif gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL, NULL); e_contact_editor_address->gui = gui; @@ -455,26 +454,24 @@ e_contact_editor_address_dispose (GObject *object) e_contact_editor_address->gui = NULL; } -#if notyet if (e_contact_editor_address->address) { - e_card_delivery_address_unref(e_contact_editor_address->address); + e_contact_address_free (e_contact_editor_address->address); e_contact_editor_address->address = NULL; } -#endif if (G_OBJECT_CLASS (parent_class)->dispose) (* G_OBJECT_CLASS (parent_class)->dispose) (object); } GtkWidget* -e_contact_editor_address_new (/* XXX notyet const ECardDeliveryAddress *address*/) +e_contact_editor_address_new (const EContactAddress *address) { GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_ADDRESS, NULL); -#if notyet + g_object_set (widget, "address", address, NULL); -#endif + return widget; } @@ -488,11 +485,11 @@ e_contact_editor_address_set_property (GObject *object, guint prop_id, switch (prop_id){ case PROP_ADDRESS: -#if notyet - e_card_delivery_address_unref(e_contact_editor_address->address); - e_contact_editor_address->address = e_card_delivery_address_copy(g_value_get_pointer (value)); - fill_in_info(e_contact_editor_address); -#endif + if (e_contact_editor_address->address) + g_boxed_free (e_contact_address_get_type (), e_contact_editor_address->address); + + e_contact_editor_address->address = g_value_dup_boxed (value); + fill_in_info (e_contact_editor_address); break; case PROP_EDITABLE: { int i; @@ -547,10 +544,8 @@ e_contact_editor_address_get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_ADDRESS: - extract_info(e_contact_editor_address); -#if notyet - g_value_set_pointer (value, e_card_delivery_address_ref(e_contact_editor_address->address)); -#endif + extract_info (e_contact_editor_address); + g_value_set_static_boxed (value, e_contact_editor_address->address); break; case PROP_EDITABLE: g_value_set_boolean (value, e_contact_editor_address->editable ? TRUE : FALSE); @@ -576,18 +571,17 @@ fill_in_field(EContactEditorAddress *editor, char *field, char *string) static void fill_in_info(EContactEditorAddress *editor) { -#if notyet - ECardDeliveryAddress *address = editor->address; + EContactAddress *address = editor->address; + if (address) { - fill_in_field(editor, "entry-street" , address->street ); - fill_in_field(editor, "entry-po" , address->po ); - fill_in_field(editor, "entry-ext" , address->ext ); - fill_in_field(editor, "entry-city" , address->city ); - fill_in_field(editor, "entry-region" , address->region ); - fill_in_field(editor, "entry-code" , address->code ); - fill_in_field(editor, "entry-country", address->country); + fill_in_field (editor, "entry-street" , address->street ); + fill_in_field (editor, "entry-po" , address->po ); + fill_in_field (editor, "entry-ext" , address->ext ); + fill_in_field (editor, "entry-city" , address->locality); + fill_in_field (editor, "entry-region" , address->region ); + fill_in_field (editor, "entry-code" , address->code ); + fill_in_field (editor, "entry-country", address->country ); } -#endif } static char * @@ -603,18 +597,20 @@ extract_field(EContactEditorAddress *editor, char *field) static void extract_info(EContactEditorAddress *editor) { -#if notyet - ECardDeliveryAddress *address = editor->address; - if (!address) { - address = e_card_delivery_address_new(); - editor->address = address; + EContactAddress *address = editor->address; + + if (address) { + g_boxed_free (e_contact_address_get_type (), address); } - address->street = extract_field(editor, "entry-street" ); - address->po = extract_field(editor, "entry-po" ); - address->ext = extract_field(editor, "entry-ext" ); - address->city = extract_field(editor, "entry-city" ); - address->region = extract_field(editor, "entry-region" ); - address->code = extract_field(editor, "entry-code" ); - address->country = extract_field(editor, "entry-country"); -#endif + + address = g_new0 (EContactAddress, 1); + editor->address = address; + + address->street = extract_field(editor, "entry-street" ); + address->po = extract_field(editor, "entry-po" ); + address->ext = extract_field(editor, "entry-ext" ); + address->locality = extract_field(editor, "entry-city" ); + address->region = extract_field(editor, "entry-region" ); + address->code = extract_field(editor, "entry-code" ); + address->country = extract_field(editor, "entry-country"); } diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h index 893a2ea2f7..30fefa0e56 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-address.h +++ b/addressbook/gui/contact-editor/e-contact-editor-address.h @@ -48,11 +48,9 @@ typedef struct _EContactEditorAddressClass EContactEditorAddressClass; struct _EContactEditorAddress { GtkDialog parent; - -#if notyet + /* item specific fields */ - ECardDeliveryAddress *address; -#endif + EContactAddress *address; guint editable : 1; @@ -65,7 +63,7 @@ struct _EContactEditorAddressClass }; -GtkWidget *e_contact_editor_address_new(/* XXX not yet const ECardDeliveryAddress *name*/); +GtkWidget *e_contact_editor_address_new (const EContactAddress *address); GType e_contact_editor_address_get_type (void); G_END_DECLS |