From 695a9d492e4161939542844a19b7188b4a6bf99b Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 30 Apr 2000 14:37:55 +0000 Subject: Added ename includes and libs. 2000-04-30 Christopher James Lahey * backend/ebook/Makefile.am: Added ename includes and libs. * backend/ebook/e-card.c, backend/ebook/e-card.h: Added e_card_name_from_string. Added header for e_card_delivery_address_from_string, even though it's not implemented yet. * contact-editor/Makefile.am: Removed the ename includes since we no longer use ename directly here. * contact-editor/e-contact-editor.c: Fixed this to properly save the address labels displayed. Updated this to use the function e_card_name_from_string instead of doing it by hand. * contact-editor/fullname-strings.h, contact-editor/fullname.glade: Deleted an unused field. Changed the set of prefixes and suffixes. svn path=/trunk/; revision=2689 --- addressbook/contact-editor/Makefile.am | 1 - addressbook/contact-editor/e-contact-editor.c | 58 ++- addressbook/contact-editor/fullname-strings.h | 8 +- addressbook/contact-editor/fullname.glade | 525 ++++++++++++-------------- 4 files changed, 272 insertions(+), 320 deletions(-) (limited to 'addressbook/contact-editor') diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am index a8fc308314..fdb25b98a3 100644 --- a/addressbook/contact-editor/Makefile.am +++ b/addressbook/contact-editor/Makefile.am @@ -13,7 +13,6 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/addressbook/ \ -I$(top_srcdir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/ename \ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ -DG_LOG_DOMAIN=\"contact-editor\" diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index a8bc443200..3d25e8a1a9 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -23,7 +23,6 @@ #include #include #include "e-contact-editor.h" -#include #include static void e_contact_editor_init (EContactEditor *card); @@ -41,6 +40,7 @@ static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, E static void fill_in_info(EContactEditor *editor); static void extract_info(EContactEditor *editor); static void set_fields(EContactEditor *editor); +static void set_address_field(EContactEditor *editor, int result); static GtkVBoxClass *parent_class = NULL; @@ -239,22 +239,18 @@ address_text_changed (GtkWidget *widget, EContactEditor *editor) { gchar *string; GtkEditable *editable = GTK_EDITABLE(widget); + if (editor->address_choice == -1) + return; if (editor->address[editor->address_choice]) { - g_free(editor->address[editor->address_choice]); - editor->address[editor->address_choice] = NULL; - } - - string = gtk_editable_get_chars(editable, 0, -1); - if (editor->address[editor->address_choice]) { - if (editor->address[editor->address_choice]->data) - g_free(editor->address[editor->address_choice]->data); + g_free(editor->address[editor->address_choice]->data); editor->address[editor->address_choice]->data = NULL; } else { editor->address[editor->address_choice] = e_card_address_label_new(); } - editor->address[editor->address_choice]->data = g_strdup(string); - g_free(string); + + string = gtk_editable_get_chars(editable, 0, -1); + editor->address[editor->address_choice]->data = string; } static void @@ -263,24 +259,14 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor) char *string; ECardName *name; GtkEntry *entry = GTK_ENTRY(widget); - ENameWestern *western; name = editor->name; if (name) e_card_name_free(name); - name = e_card_name_new(); - string = gtk_entry_get_text(entry); - western = e_name_western_parse (string); - - name->prefix = g_strdup (western->prefix); - name->given = g_strdup (western->first ); - name->additional = g_strdup (western->middle); - name->family = g_strdup (western->last ); - name->suffix = g_strdup (western->suffix); - e_name_western_free(western); + name = e_card_name_from_string(string); editor->name = name; } @@ -772,8 +758,7 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "text-address", "Add new Address type"); if (result != -1) { - editor->address_choice = result; - set_fields(editor); + set_address_field(editor, result); } } @@ -789,9 +774,6 @@ static void set_fields(EContactEditor *editor) { GtkEntry *entry; - GtkEditable *editable; - char *string = NULL; - int position; entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone1")); if (editor->phone[editor->phone_choice[0]]) @@ -819,17 +801,25 @@ set_fields(EContactEditor *editor) set_field(entry, editor->email[editor->email_choice]); else set_field(entry, ""); + + set_address_field(editor, -1); +} + +static void +set_address_field(EContactEditor *editor, int result) +{ + GtkEditable *editable; + int position; + if (result == -1) + result = editor->address_choice; + editor->address_choice = -1; - if (editor->address[editor->address_choice]) { - string = g_strdup (editor->address[editor->address_choice]->data); - } position = 0; editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address")); gtk_editable_delete_text(editable, 0, -1); - if (string) { - gtk_editable_insert_text(editable, string, strlen(string), &position); - g_free(string); - } + if (editor->address[result] && editor->address[result]->data) + gtk_editable_insert_text(editable, editor->address[result]->data, strlen(editor->address[result]->data), &position); + editor->address_choice = result; } static void diff --git a/addressbook/contact-editor/fullname-strings.h b/addressbook/contact-editor/fullname-strings.h index cd6b118547..9c49107400 100644 --- a/addressbook/contact-editor/fullname-strings.h +++ b/addressbook/contact-editor/fullname-strings.h @@ -16,10 +16,10 @@ gchar *s = N_("\n" "Dr.\n" ""); gchar *s = N_("\n" - "Senior\n" - "Junior\n" + "Sr.\n" + "Jr.\n" + "I\n" "II\n" "III\n" - "Esquire\n" + "Esq.\n" ""); -gchar *s = N_("Show this again when name is incomplete or unclear"); diff --git a/addressbook/contact-editor/fullname.glade b/addressbook/contact-editor/fullname.glade index 3f1fc58a50..37022ab0e1 100644 --- a/addressbook/contact-editor/fullname.glade +++ b/addressbook/contact-editor/fullname.glade @@ -79,10 +79,14 @@ - GtkVBox - vbox-checkfullname + GtkTable + table1 + 8 + 5 + 3 False - 0 + 6 + 21 0 True @@ -90,329 +94,288 @@ - GtkTable - table1 - 8 - 5 - 3 - False - 6 - 21 + GtkAccelLabel + accellabel1 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 - 0 - True - True - - - - GtkAccelLabel - accellabel1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 + 0 + 1 + 0 + 1 0 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - + False + False + False + False + True + True + + - - GtkAccelLabel - accellabel2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 + + GtkAccelLabel + accellabel2 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 0 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - + False + False + False + False + True + True + + - - GtkAccelLabel - accellabel3 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 + + GtkAccelLabel + accellabel3 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 2 + 3 0 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - + False + False + False + False + True + True + + - - GtkAccelLabel - accellabel4 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 + + GtkAccelLabel + accellabel4 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 3 + 4 0 0 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - + False + False + False + False + True + True + + - - GtkAccelLabel - accellabel5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 + + GtkAccelLabel + accellabel5 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 0 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - + False + False + False + False + True + True + + - - GtkCombo - combo-title - False - True - False - True - False - + + GtkCombo + combo-title + False + True + False + True + False + Mr. Mrs. Dr. - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - entry-title - True - True - True - 0 - - - - - - GtkCombo - combo-suffix - False - True - False - True - False - -Senior -Junior -II -III -Esquire - - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - entry-suffix - True - True - True - 0 - - - + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + GtkEntry - entry-first + GtkCombo:entry + entry-title True True True 0 - - 1 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - + - - GtkEntry - entry-middle - True - True - True - 0 - - - 1 - 3 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - + + GtkCombo + combo-suffix + False + True + False + True + False + +Sr. +Jr. +I +II +III +Esq. + + + 1 + 2 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + GtkEntry - entry-last + GtkCombo:entry + entry-suffix True True True 0 - - 1 - 3 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - GtkVBox - vbox3 - False - 0 + GtkEntry + entry-first + True + True + True + 0 + - 0 - True - True + 1 + 3 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + - - GtkCheckButton - checkbutton-showagain - True - - False - True - - 0 - False - False - - + + GtkEntry + entry-middle + True + True + True + 0 + + + 1 + 3 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + GtkEntry + entry-last + True + True + True + 0 + + + 1 + 3 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + -- cgit v1.2.3