aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade484
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-strings.h2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c243
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h2
4 files changed, 318 insertions, 413 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index 139e652056..cd17ffd288 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -47,7 +47,7 @@
<class>GtkTable</class>
<name>table-contact-editor-general</name>
<border_width>7</border_width>
- <rows>12</rows>
+ <rows>11</rows>
<columns>8</columns>
<homogeneous>False</homogeneous>
<row_spacing>4</row_spacing>
@@ -150,54 +150,6 @@
</widget>
<widget>
- <class>GtkEntry</class>
- <name>entry-fullname</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>3</left_attach>
- <right_attach>4</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>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-web</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>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>8</top_attach>
- <bottom_attach>9</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>GtkLabel</class>
<name>label-phone3</name>
<label>Business Fax</label>
@@ -483,7 +435,7 @@
<spacing>0</spacing>
<child>
<left_attach>0</left_attach>
- <right_attach>8</right_attach>
+ <right_attach>7</right_attach>
<top_attach>10</top_attach>
<bottom_attach>11</bottom_attach>
<xpad>0</xpad>
@@ -528,81 +480,6 @@
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>8</right_attach>
- <top_attach>11</top_attach>
- <bottom_attach>12</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-contacts</name>
- <can_focus>True</can_focus>
- <label>Contacts...</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-contacts</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>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-categories</name>
- <can_focus>True</can_focus>
- <label>Categories...</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-categories</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>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
<class>GtkAlignment</class>
<name>alignment2</name>
<xalign>0</xalign>
@@ -656,141 +533,6 @@
</widget>
<widget>
- <class>GtkEntry</class>
- <name>entry-jobtitle</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>3</left_attach>
- <right_attach>4</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>GtkEntry</class>
- <name>entry-company</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>3</left_attach>
- <right_attach>4</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-fileas</name>
- <can_focus>True</can_focus>
- <value_in_list>False</value_in_list>
- <ok_if_empty>True</ok_if_empty>
- <case_sensitive>True</case_sensitive>
- <use_arrows>True</use_arrows>
- <use_arrows_always>False</use_arrows_always>
- <items></items>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</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>
- <class>GtkEntry</class>
- <child_name>GtkCombo:entry</child_name>
- <name>entry-fileas</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>GtkHBox</class>
- <name>hbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</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-email1</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>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button23</name>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
<class>GtkAlignment</class>
<name>alignment3</name>
<xalign>1</xalign>
@@ -978,12 +720,12 @@
<widget>
<class>GtkHSeparator</class>
- <name>hseparator6</name>
+ <name>hseparator4</name>
<child>
- <left_attach>0</left_attach>
- <right_attach>4</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
+ <left_attach>4</left_attach>
+ <right_attach>8</right_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>2</ypad>
<xexpand>True</xexpand>
@@ -991,20 +733,153 @@
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment6</name>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xscale>0</xscale>
+ <yscale>0</yscale>
+ <child>
+ <left_attach>6</left_attach>
+ <right_attach>7</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>
+ <class>GtkButton</class>
+ <name>button-phone3</name>
+
+ <widget>
+ <class>Placeholder</class>
+ </widget>
+ </widget>
</widget>
<widget>
- <class>GtkHSeparator</class>
- <name>hseparator4</name>
+ <class>GtkEntry</class>
+ <name>entry-fullname</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>4</left_attach>
- <right_attach>8</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
<xpad>0</xpad>
- <ypad>2</ypad>
+ <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-jobtitle</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>3</left_attach>
+ <right_attach>4</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>GtkEntry</class>
+ <name>entry-company</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>3</left_attach>
+ <right_attach>4</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-email1</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>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>5</top_attach>
+ <bottom_attach>6</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-web</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>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>8</top_attach>
+ <bottom_attach>9</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
@@ -1034,38 +909,61 @@
</widget>
<widget>
- <class>GtkAlignment</class>
- <name>alignment6</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
+ <class>GtkCombo</class>
+ <name>combo-fileas</name>
+ <value_in_list>False</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>True</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items></items>
<child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
- <xexpand>False</xexpand>
+ <xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
- <yfill>True</yfill>
+ <yfill>False</yfill>
</child>
<widget>
- <class>GtkButton</class>
- <name>button-phone3</name>
-
- <widget>
- <class>Placeholder</class>
- </widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>combo-entry1</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>GtkHSeparator</class>
+ <name>hseparator6</name>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>7</top_attach>
+ <bottom_attach>8</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>2</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
<class>GtkCheckButton</class>
<name>checkbutton-htmlmail</name>
<can_focus>True</can_focus>
@@ -1081,10 +979,10 @@
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
+ <xshrink>True</xshrink>
+ <yshrink>True</yshrink>
<xfill>True</xfill>
- <yfill>False</yfill>
+ <yfill>True</yfill>
</child>
</widget>
</widget>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h
index 28fce326e1..7f0a8a83f1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-strings.h
+++ b/addressbook/gui/contact-editor/e-contact-editor-strings.h
@@ -15,8 +15,6 @@ gchar *s = N_("Job Title:");
gchar *s = N_("Company:");
gchar *s = N_("File As:");
gchar *s = N_("Web page address:");
-gchar *s = N_("Contacts...");
-gchar *s = N_("Categories...");
gchar *s = N_("This is the mailing address");
gchar *s = N_("A_ddress...");
gchar *s = N_("Business");
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index f12660be18..91339e9da3 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -76,14 +76,12 @@ ECardPhoneFlags phone_correspondences[] = {
0xFF, /* E_CONTACT_EDITOR_PHONE_ID_TTYTTD, */
};
-#if 0
-enum _EContactEditorAddressId {
- E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS,
- E_CONTACT_EDITOR_ADDRESS_ID_HOME,
- E_CONTACT_EDITOR_ADDRESS_ID_OTHER,
+ECardAddressFlags addr_correspondences[] = {
+ E_CARD_ADDR_WORK, /* E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS, */
+ E_CARD_ADDR_HOME, /* E_CONTACT_EDITOR_ADDRESS_ID_HOME, */
+ E_CARD_ADDR_POSTAL, /* E_CONTACT_EDITOR_ADDRESS_ID_OTHER, */
E_CONTACT_EDITOR_ADDRESS_ID_LAST
};
-#endif
GtkType
e_contact_editor_get_type (void)
@@ -161,8 +159,7 @@ _add_details_images(GtkTable *table)
{
_add_image(table, DATADIR "/evolution/briefcase.png", 0, 1, 0, 2);
_add_image(table, DATADIR "/evolution/head.png", 0, 1, 4, 6);
- _add_image(table, DATADIR "/evolution/netmeeting.png", 0, 1, 7, 9);
- _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 10, 12);
+ _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 7, 9);
}
static void
@@ -191,7 +188,7 @@ _replace_buttons(EContactEditor *editor)
}
static void
-phone_label_changed (GtkWidget *widget, EContactEditor *editor)
+phone_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
int which;
gchar *string;
@@ -208,30 +205,21 @@ phone_label_changed (GtkWidget *widget, EContactEditor *editor)
} else
return;
string = gtk_entry_get_text(entry);
- if (string) {
- if (editor->phone[editor->phone_choice[which - 1]]) {
- if (editor->phone[editor->phone_choice[which - 1]]->number)
- g_free(editor->phone[editor->phone_choice[which - 1]]->number);
- editor->phone[editor->phone_choice[which - 1]]->number = NULL;
- } else {
- editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1);
- editor->phone[editor->phone_choice[which - 1]]->number = NULL;
- editor->phone[editor->phone_choice[which - 1]]->flags = 0;
- }
- editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string);
+ if (editor->phone[editor->phone_choice[which - 1]]) {
+ if (editor->phone[editor->phone_choice[which - 1]]->number)
+ g_free(editor->phone[editor->phone_choice[which - 1]]->number);
+ editor->phone[editor->phone_choice[which - 1]]->number = NULL;
} else {
- if (editor->phone[editor->phone_choice[which - 1]]) {
- if (editor->phone[editor->phone_choice[which - 1]]->number) {
- g_free(editor->phone[editor->phone_choice[which - 1]]->number);
- editor->phone[editor->phone_choice[which - 1]]->number = g_strdup("");
- }
- }
+ editor->phone[editor->phone_choice[which - 1]] = g_new(ECardPhone, 1);
+ editor->phone[editor->phone_choice[which - 1]]->number = NULL;
+ editor->phone[editor->phone_choice[which - 1]]->flags = 0;
}
+ editor->phone[editor->phone_choice[which - 1]]->number = g_strdup(string);
set_fields(editor);
}
static void
-email_label_changed (GtkWidget *widget, EContactEditor *editor)
+email_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
gchar *string;
GtkEntry *entry = GTK_ENTRY(widget);
@@ -244,8 +232,31 @@ email_label_changed (GtkWidget *widget, EContactEditor *editor)
string = gtk_entry_get_text(entry);
editor->email[editor->email_choice] = g_strdup(string);
+}
- set_fields(editor);
+static void
+address_text_changed (GtkWidget *widget, EContactEditor *editor)
+{
+ gchar *string;
+ GtkEditable *editable = GTK_EDITABLE(widget);
+
+ 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);
+ editor->address[editor->address_choice]->data = NULL;
+ } else {
+ editor->address[editor->address_choice] = g_new(ECardAddrLabel, 1);
+ editor->address[editor->address_choice]->data = NULL;
+ editor->address[editor->address_choice]->flags = 0;
+ }
+ editor->address[editor->address_choice]->data = g_strdup(string);
+ g_free(string);
}
static void
@@ -253,7 +264,7 @@ set_entry_changed_signal_phone(EContactEditor *editor, char *id)
{
GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
gtk_signal_connect(GTK_OBJECT(widget), "changed",
- phone_label_changed, editor);
+ phone_entry_changed, editor);
}
static void
@@ -266,7 +277,10 @@ set_entry_changed_signals(EContactEditor *editor)
set_entry_changed_signal_phone(editor, "entry-phone4");
widget = glade_xml_get_widget(editor->gui, "entry-email1");
gtk_signal_connect(GTK_OBJECT(widget), "changed",
- email_label_changed, editor);
+ email_entry_changed, editor);
+ widget = glade_xml_get_widget(editor->gui, "text-address");
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ address_text_changed, editor);
}
static void
@@ -699,8 +713,12 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito
editor->address_popup = gnome_popup_menu_new(editor->address_info);
}
- result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "entry-address1", "Add new Address type");
- result ++;
+ 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);
+ }
}
static void
@@ -715,6 +733,9 @@ 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]])
@@ -731,6 +752,7 @@ set_fields(EContactEditor *editor)
set_field(entry, editor->phone[editor->phone_choice[2]]->number);
else
set_field(entry, "");
+
entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-phone4"));
if (editor->phone[editor->phone_choice[3]])
set_field(entry, editor->phone[editor->phone_choice[3]]->number);
@@ -741,6 +763,17 @@ set_fields(EContactEditor *editor)
set_field(entry, editor->email[editor->email_choice]);
else
set_field(entry, "");
+
+ 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);
+ }
}
static void
@@ -763,25 +796,26 @@ fill_in_info(EContactEditor *editor)
const ECardPhone *phone;
const char *email;
const ECardDate *bday;
+ const ECardAddrLabel *address;
GtkEditable *editable;
int position = 0;
ECardIterator *iterator;
gtk_object_get(GTK_OBJECT(card),
- "full_name", &fname,
- "address", &address_list,
- "phone", &phone_list,
- "email", &email_list,
- "url", &url,
- "org", &org,
- "org_unit", &org_unit,
- "title", &title,
- "role", &role,
- "nickname", &nickname,
- "fburl", &fburl,
- "note", &note,
- "birth_date", &bday,
+ "full_name", &fname,
+ "address_label", &address_list,
+ "phone", &phone_list,
+ "email", &email_list,
+ "url", &url,
+ "org", &org,
+ "org_unit", &org_unit,
+ "title", &title,
+ "role", &role,
+ "nickname", &nickname,
+ "fburl", &fburl,
+ "note", &note,
+ "birth_date", &bday,
NULL);
position = 0;
@@ -789,39 +823,7 @@ fill_in_info(EContactEditor *editor)
gtk_editable_delete_text(editable, 0, -1);
if (fname)
gtk_editable_insert_text(editable, fname, strlen(fname), &position);
-#if 0
- position = 0;
- iterator = e_card_list_get_iterator(address_list);
- for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
- address = e_card_iterator_get(iterator);
- if (address->flags & E_CARD_ADDR_WORK) {
- if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]) {
- e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS]);
- }
- editor->address[E_CONTACT_EDITOR_ADDRESS_ID_BUSINESS] =
- e_card_delivery_address_copy(address);
- }
- if (address->flags & E_CARD_ADDR_HOME) {
- if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]) {
- e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME]);
- }
- editor->address[E_CONTACT_EDITOR_ADDRESS_ID_HOME] =
- e_card_delivery_address_copy(address);
- }
- if (address->flags & E_CARD_ADDR_PARCEL) {
- if (editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]) {
- e_card_delivery_address_free(editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER]);
- }
- editor->address[E_CONTACT_EDITOR_ADDRESS_ID_OTHER] =
- e_card_delivery_address_copy(address);
- }
- }
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address"));
- gtk_editable_delete_text(editable, 0, -1);
- if (address)
- gtk_editable_insert_text(editable, address->city, strlen(address->city), &position);
- gtk_object_unref(GTK_OBJECT(iterator));
-#endif
+
for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
int i;
phone = e_card_iterator_get(iterator);
@@ -846,6 +848,18 @@ fill_in_info(EContactEditor *editor)
}
gtk_object_unref(GTK_OBJECT(iterator));
+ for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ int i;
+ address = e_card_iterator_get(iterator);
+ for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) {
+ if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (editor->address[i] == NULL)) {
+ editor->address[i] = e_card_address_label_copy(address);
+ break;
+ }
+ }
+ }
+ gtk_object_unref(GTK_OBJECT(iterator));
+
position = 0;
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web"));
gtk_editable_delete_text(editable, 0, -1);
@@ -927,6 +941,7 @@ extract_info(EContactEditor *editor)
char *fburl;
char *note;
const ECardPhone *phone;
+ const ECardAddrLabel *address;
const char *email;
ECardDate *bday;
GtkEditable *editable;
@@ -940,9 +955,9 @@ extract_info(EContactEditor *editor)
ECardIterator *iterator;
gtk_object_get(GTK_OBJECT(card),
- "address", &address_list,
- "phone", &phone_list,
- "email", &email_list,
+ "address_label", &address_list,
+ "phone", &phone_list,
+ "email", &email_list,
NULL);
position = 0;
@@ -953,29 +968,6 @@ extract_info(EContactEditor *editor)
"full_name", fname,
NULL);
g_free(fname);
-#if 0
- iterator = e_card_list_get_iterator(address_list);
- address = e_card_iterator_get(iterator);
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "text-address"));
- string = gtk_editable_get_chars(editable, 0, -1);
- if (string && *string) {
- if (address) {
- address_copy = e_card_delivery_address_copy(address);
- if (address_copy->city)
- g_free(address_copy->city);
- address_copy->city = string;
- e_card_iterator_set(iterator, address_copy);
- e_card_delivery_address_free(address_copy);
- } else {
- address_copy = g_new0(ECardDeliveryAddress, 1);
- address_copy->city = string;
- e_card_list_append(address_list, address_copy);
- e_card_delivery_address_free(address_copy);
- }
- } else
- g_free(string);
- gtk_object_unref(GTK_OBJECT(iterator));
-#endif
for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) {
int i;
@@ -1033,20 +1025,37 @@ extract_info(EContactEditor *editor)
editor->email[i] = NULL;
}
}
-#if 0
- position = 0;
- iterator = e_card_list_get_iterator(email_list);
- editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-email1"));
- email = gtk_editable_get_chars(editable, 0, -1);
- if (email && *email) {
- if (e_card_iterator_is_valid(iterator))
- e_card_iterator_set(iterator, email);
- else
- e_card_list_append(email_list, email);
- }
- g_free(email);
+
+ for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); iterator_next ? e_card_iterator_next(iterator) : FALSE ) {
+ int i;
+ address = e_card_iterator_get(iterator);
+ iterator_next = 1;
+ for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) {
+ if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) {
+ if (editor->address[i]) {
+ if (editor->address[i]->data && *editor->address[i]->data) {
+ e_card_iterator_set(iterator, editor->address[i]);
+ } else {
+ e_card_iterator_delete(iterator);
+ iterator_next = 0;
+ }
+ e_card_address_label_free(editor->address[i]);
+ editor->address[i] = NULL;
+ break;
+ }
+ }
+ }
+ }
gtk_object_unref(GTK_OBJECT(iterator));
-#endif
+ for (i = 0; i < E_CONTACT_EDITOR_ADDRESS_ID_LAST; i ++) {
+ if (editor->address[i]) {
+ editor->address[i]->flags = addr_correspondences[i];
+ e_card_list_append(address_list, editor->address[i]);
+ e_card_address_label_free(editor->address[i]);
+ editor->address[i] = NULL;
+ }
+ }
+
position = 0;
editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, "entry-web"));
url = gtk_editable_get_chars(editable, 0, -1);
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index fd80dc4c00..394d136eed 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -112,7 +112,7 @@ struct _EContactEditor
ECardPhone *phone[E_CONTACT_EDITOR_PHONE_ID_LAST];
char *email[E_CONTACT_EDITOR_EMAIL_ID_LAST];
- ECardDeliveryAddress *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST];
+ ECardAddrLabel *address[E_CONTACT_EDITOR_ADDRESS_ID_LAST];
EContactEditorEmailId email_choice;
EContactEditorPhoneId phone_choice[4];