aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-03-29 06:22:40 +0800
committerChris Toshok <toshok@src.gnome.org>2003-03-29 06:22:40 +0800
commit1ebc39be4ef89d876f919df18b516e0c9e93ccdb (patch)
treea6ee2399a38b5f7fc4d355e038fb4d167281a81f /addressbook/gui
parent02546395deebd56211a55a7f8e9ad2bf00adddf0 (diff)
downloadgsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.gz
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.zst
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.zip
[ fix the contact editor so that the only time the address is parsed is
2003-03-28 Chris Toshok <toshok@ximian.com> [ fix the contact editor so that the only time the address is parsed is when the user types in the address GtkTextView. ] * gui/contact-editor/e-contact-editor.c (address_mailing_changed): make this use delivery addresses instead of labels. (full_addr_clicked): same. (find_address_mailing): same. * backend/ebook/e-card-simple.c (e_card_simple_set_delivery_address): make this operate similar to e_card_simple_set_address: it sets both the delivery address and the label for the address. svn path=/trunk/; revision=20567
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c66
1 files changed, 30 insertions, 36 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index a51b066ad7..3450c307aa 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -352,8 +352,8 @@ address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor)
static void
address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
{
- ECardAddrLabel *address;
- GtkWidget *text;
+ const ECardDeliveryAddress *curr;
+ ECardDeliveryAddress *address;
gboolean mailing_address;
if (editor->address_choice == -1)
@@ -362,38 +362,31 @@ address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
mailing_address = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
/* Mark the current address as the mailing address */
- text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT_VIEW(text)) {
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
- GtkTextIter start_iter, end_iter;
-
- address = e_card_address_label_new();
-
- if (mailing_address)
- address->flags |= E_CARD_ADDR_DEFAULT;
- else
- address->flags &= ~E_CARD_ADDR_DEFAULT;
+ curr = e_card_simple_get_delivery_address (editor->simple,
+ editor->address_choice);
- gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter);
- gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
+ address = e_card_delivery_address_copy (curr);
- address->data = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
+ if (mailing_address)
+ address->flags |= E_CARD_ADDR_DEFAULT;
+ else
+ address->flags &= ~E_CARD_ADDR_DEFAULT;
- e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_unref(address);
- }
+ e_card_simple_set_delivery_address(editor->simple, editor->address_choice, address);
+ e_card_delivery_address_unref (address);
/* Unset the previous mailing address flag */
if (mailing_address && editor->address_mailing != -1) {
- const ECardAddrLabel *curr;
+ const ECardDeliveryAddress *curr;
- curr = e_card_simple_get_address(editor->simple,
- editor->address_mailing);
- address = e_card_address_label_copy (curr);
+ curr = e_card_simple_get_delivery_address(editor->simple,
+ editor->address_mailing);
+ address = e_card_delivery_address_copy (curr);
address->flags &= ~E_CARD_ADDR_DEFAULT;
- e_card_simple_set_address(editor->simple,
- editor->address_mailing,
- address);
+ e_card_simple_set_delivery_address(editor->simple,
+ editor->address_mailing,
+ address);
+ e_card_delivery_address_unref (address);
}
/* Remember the new mailing address */
@@ -777,6 +770,9 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
if (editor->address_editable[editor->address_choice] && result == GTK_RESPONSE_OK) {
ECardDeliveryAddress *new_address;
GtkWidget *address_widget;
+ int saved_choice = editor->address_choice;
+
+ editor->address_choice = -1;
g_object_get (dialog,
"address", &new_address,
@@ -798,12 +794,10 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
gtk_text_buffer_insert (buffer, &start_iter, string, strlen (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_unref(address);
}
+ editor->address_choice = saved_choice;
+
e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address);
e_card_delivery_address_unref(new_address);
@@ -1934,22 +1928,22 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito
static void
find_address_mailing (EContactEditor *editor)
{
- const ECardAddrLabel *address;
+ const ECardDeliveryAddress *address;
int i;
editor->address_mailing = -1;
for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- address = e_card_simple_get_address(editor->simple, i);
+ address = e_card_simple_get_delivery_address(editor->simple, i);
if (address && (address->flags & E_CARD_ADDR_DEFAULT)) {
if (editor->address_mailing == -1) {
editor->address_mailing = i;
} else {
- ECardAddrLabel *new;
+ ECardDeliveryAddress *new;
- new = e_card_address_label_copy (address);
+ new = e_card_delivery_address_copy (address);
new->flags &= ~E_CARD_ADDR_DEFAULT;
- e_card_simple_set_address(editor->simple, i, new);
- e_card_address_label_unref (new);
+ e_card_simple_set_delivery_address(editor->simple, i, new);
+ e_card_delivery_address_unref (new);
}
}
}