diff options
Diffstat (limited to 'addressbook/contact-editor')
-rw-r--r-- | addressbook/contact-editor/Makefile.am | 1 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 58 | ||||
-rw-r--r-- | addressbook/contact-editor/fullname-strings.h | 8 | ||||
-rw-r--r-- | addressbook/contact-editor/fullname.glade | 525 |
4 files changed, 272 insertions, 320 deletions
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 <config.h> #include <gnome.h> #include "e-contact-editor.h" -#include <e-name-western.h> #include <e-contact-editor-fullname.h> 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 @@ </widget> <widget> - <class>GtkVBox</class> - <name>vbox-checkfullname</name> + <class>GtkTable</class> + <name>table1</name> + <border_width>8</border_width> + <rows>5</rows> + <columns>3</columns> <homogeneous>False</homogeneous> - <spacing>0</spacing> + <row_spacing>6</row_spacing> + <column_spacing>21</column_spacing> <child> <padding>0</padding> <expand>True</expand> @@ -90,329 +94,288 @@ </child> <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>8</border_width> - <rows>5</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>21</column_spacing> + <class>GtkAccelLabel</class> + <name>accellabel1</name> + <label>Title:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>Title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>First:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> + <widget> + <class>GtkAccelLabel</class> + <name>accellabel2</name> + <label>First:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> - <widget> - <class>GtkAccelLabel</class> - <name>accellabel3</name> - <label>Middle:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> + <widget> + <class>GtkAccelLabel</class> + <name>accellabel3</name> + <label>Middle:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> - <widget> - <class>GtkAccelLabel</class> - <name>accellabel4</name> - <label>Last:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> + <widget> + <class>GtkAccelLabel</class> + <name>accellabel4</name> + <label>Last:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> - <widget> - <class>GtkAccelLabel</class> - <name>accellabel5</name> - <label>Suffix:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> + <widget> + <class>GtkAccelLabel</class> + <name>accellabel5</name> + <label>Suffix:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>True</yfill> + </child> + </widget> - <widget> - <class>GtkCombo</class> - <name>combo-title</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> + <widget> + <class>GtkCombo</class> + <name>combo-title</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>False</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items> Mr. Mrs. Dr. </items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-title</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkCombo</class> - <name>combo-suffix</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> -Senior -Junior -II -III -Esquire -</items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-suffix</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> <widget> <class>GtkEntry</class> - <name>entry-first</name> + <child_name>GtkCombo:entry</child_name> + <name>entry-title</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> <text_max_length>0</text_max_length> <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> </widget> + </widget> - <widget> - <class>GtkEntry</class> - <name>entry-middle</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> + <widget> + <class>GtkCombo</class> + <name>combo-suffix</name> + <value_in_list>False</value_in_list> + <ok_if_empty>True</ok_if_empty> + <case_sensitive>False</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items> +Sr. +Jr. +I +II +III +Esq. +</items> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>4</top_attach> + <bottom_attach>5</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> <widget> <class>GtkEntry</class> - <name>entry-last</name> + <child_name>GtkCombo:entry</child_name> + <name>entry-suffix</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> <text_max_length>0</text_max_length> <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> </widget> </widget> <widget> - <class>GtkVBox</class> - <name>vbox3</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> + <class>GtkEntry</class> + <name>entry-first</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> </child> + </widget> - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-showagain</name> - <can_focus>True</can_focus> - <label>Show this again when name is incomplete or unclear</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> + <widget> + <class>GtkEntry</class> + <name>entry-middle</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>2</top_attach> + <bottom_attach>3</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>entry-last</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <left_attach>1</left_attach> + <right_attach>3</right_attach> + <top_attach>3</top_attach> + <bottom_attach>4</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> </widget> </widget> </widget> |