Added the function e_card_delivery_address_to_label.

2000-10-18  Christopher James Lahey  <clahey@helixcode.com>

	* backend/ebook/e-card.c, backend/ebook/e-card.h: Added the
	function e_card_delivery_address_to_label.

	* contact-editor/e-contact-editor-address.c: Fixed a potential
	crash.

	* contact-editor/e-contact-editor.c: Made this save the changed
	data to the string version of the address.

svn path=/trunk/; revision=6023
This commit is contained in:
Christopher James Lahey
2000-10-19 03:32:55 +00:00
committed by Chris Lahey
parent f3533f595d
commit 6cb2f5ffe5
7 changed files with 51 additions and 20 deletions
+11
View File
@@ -1,3 +1,14 @@
2000-10-18 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/e-card.c, backend/ebook/e-card.h: Added the
function e_card_delivery_address_to_label.
* contact-editor/e-contact-editor-address.c: Fixed a potential
crash.
* contact-editor/e-contact-editor.c: Made this save the changed
data to the string version of the address.
2000-10-19 Michael Meeks <michael@helixcode.com>
* gui/component/addressbook.c (change_view_type): update to new
+11
View File
@@ -1212,6 +1212,17 @@ e_card_delivery_address_to_string(const ECardDeliveryAddress *addr)
return final;
}
ECardAddrLabel *
e_card_delivery_address_to_label (const ECardDeliveryAddress *addr)
{
ECardAddrLabel *label;
label = e_card_address_label_new();
label->flags = addr->flags;
label->data = e_card_delivery_address_to_string(addr);
return label;
}
ECardAddrLabel *
e_card_address_label_new (void)
{
+1
View File
@@ -124,6 +124,7 @@ void e_card_delivery_address_free ( ECardDeliveryAd
gboolean e_card_delivery_address_is_empty (const ECardDeliveryAddress *addr);
char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr);
ECardDeliveryAddress *e_card_delivery_address_from_label (const ECardAddrLabel *label);
ECardAddrLabel *e_card_delivery_address_to_label (const ECardDeliveryAddress *addr);
ECardAddrLabel *e_card_address_label_new (void);
ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr);
@@ -205,8 +205,10 @@ static void
extract_info(EContactEditorAddress *editor)
{
ECardDeliveryAddress *address = editor->address;
if (!address)
if (!address) {
address = e_card_delivery_address_new();
editor->address = address;
}
address->street = extract_field(editor, "entry-street" );
address->po = extract_field(editor, "entry-po" );
address->ext = extract_field(editor, "entry-ext" );
+11 -9
View File
@@ -533,22 +533,24 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
result = gnome_dialog_run (dialog);
if (result == 0) {
ECardDeliveryAddress *new_address;
GtkWidget *address_widget;
gtk_object_get(GTK_OBJECT(dialog),
"address", &new_address,
NULL);
e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address);
e_card_delivery_address_free(new_address);
#if 0
GtkWidget *fname_widget;
fname_widget = glade_xml_get_widget(editor->gui, "text-address");
if (fname_widget && GTK_IS_ENTRY(fname_widget)) {
char *full_name = e_card_delivery_address_to_string(address);
e_utf8_gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name);
g_free(full_name);
address_widget = glade_xml_get_widget(editor->gui, "text-address");
if (address_widget && GTK_IS_EDITABLE(address_widget)) {
char *string = e_card_delivery_address_to_string(new_address);
e_utf8_gtk_editable_set_text(GTK_EDITABLE(address_widget), string);
g_free(string);
} else {
ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_free(address);
}
#endif
e_card_delivery_address_free(new_address);
}
gtk_object_unref(GTK_OBJECT(dialog));
}
@@ -205,8 +205,10 @@ static void
extract_info(EContactEditorAddress *editor)
{
ECardDeliveryAddress *address = editor->address;
if (!address)
if (!address) {
address = e_card_delivery_address_new();
editor->address = address;
}
address->street = extract_field(editor, "entry-street" );
address->po = extract_field(editor, "entry-po" );
address->ext = extract_field(editor, "entry-ext" );
@@ -533,22 +533,24 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
result = gnome_dialog_run (dialog);
if (result == 0) {
ECardDeliveryAddress *new_address;
GtkWidget *address_widget;
gtk_object_get(GTK_OBJECT(dialog),
"address", &new_address,
NULL);
e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address);
e_card_delivery_address_free(new_address);
#if 0
GtkWidget *fname_widget;
fname_widget = glade_xml_get_widget(editor->gui, "text-address");
if (fname_widget && GTK_IS_ENTRY(fname_widget)) {
char *full_name = e_card_delivery_address_to_string(address);
e_utf8_gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name);
g_free(full_name);
address_widget = glade_xml_get_widget(editor->gui, "text-address");
if (address_widget && GTK_IS_EDITABLE(address_widget)) {
char *string = e_card_delivery_address_to_string(new_address);
e_utf8_gtk_editable_set_text(GTK_EDITABLE(address_widget), string);
g_free(string);
} else {
ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_free(address);
}
#endif
e_card_delivery_address_free(new_address);
}
gtk_object_unref(GTK_OBJECT(dialog));
}