aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
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
parent02546395deebd56211a55a7f8e9ad2bf00adddf0 (diff)
downloadgsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.gz
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.bz2
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.lz
gsoc2013-evolution-1ebc39be4ef89d876f919df18b516e0c9e93ccdb.tar.xz
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')
-rw-r--r--addressbook/ChangeLog14
-rw-r--r--addressbook/backend/ebook/e-card-simple.c2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c66
3 files changed, 46 insertions, 36 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 994e429dfb..64ce436f8a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,17 @@
+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.
+
2003-03-26 Chris Toshok <toshok@ximian.com>
[ fixes bug #19178 ]
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 0acc304840..db008011cd 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -783,6 +783,8 @@ void e_card_simple_set_delivery_address (ECardSimple *simple
{
e_card_delivery_address_unref(simple->delivery[id]);
simple->delivery[id] = e_card_delivery_address_ref(delivery);
+ e_card_address_label_unref(simple->address[id]);
+ simple->address[id] = e_card_delivery_address_to_label(simple->delivery[id]);
simple->changed = TRUE;
}
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);
}
}
}