aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog15
-rw-r--r--addressbook/backend/ebook/e-card-simple.c21
-rw-r--r--addressbook/backend/ebook/e-card-simple.h1
-rw-r--r--addressbook/gui/component/e-addressbook-model.c3
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c12
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c22
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c3
7 files changed, 66 insertions, 11 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 27a59f3d8b..09232910a5 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,20 @@
2000-07-09 Christopher James Lahey <clahey@helixcode.com>
+ * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h:
+ Added a field that gives the name if it exists and the company
+ name otherwise.
+
+ * gui/component/e-addressbook-model.c: Formatting changes.
+
+ * gui/component/select-names/e-select-names-table-model.c: Added
+ stripping of names and display of company name if name doesn't
+ exist.
+
+ * gui/component/select-names/e-select-names.c: Fixed up the
+ display so that we display both name and email address.
+
+2000-07-09 Christopher James Lahey <clahey@helixcode.com>
+
* gui/component/select-names/e-select-names-model.c: Fixed a small
off by one error that was causing an extra character to get
deleted sometimes.
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index cc3ff416ce..ddad7249dd 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -58,6 +58,7 @@ enum _ECardSimpleInternalType {
E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS,
E_CARD_SIMPLE_INTERNAL_TYPE_PHONE,
E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL,
+ E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL,
};
struct _ECardSimpleFieldData {
@@ -108,6 +109,7 @@ static ECardSimpleFieldData field_data[] =
{ E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
{ E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
{ E_CARD_SIMPLE_FIELD_MAILER, "mailer", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
+ { E_CARD_SIMPLE_FIELD_NAME_OR_ORG, "nameororg", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL },
};
static void e_card_simple_init (ECardSimple *simple);
@@ -904,6 +906,19 @@ char *e_card_simple_get (ECardSimple *simple,
string = e_card_simple_get_email(simple,
field_data[field].list_type_index);
return g_strdup(string);
+ case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL:
+ switch (field) {
+ case E_CARD_SIMPLE_FIELD_NAME_OR_ORG:
+ gtk_object_get(GTK_OBJECT(simple->card),
+ "full_name", &string,
+ NULL);
+ if (string && *string)
+ return g_strdup(string);
+ gtk_object_get(GTK_OBJECT(simple->card),
+ "org", &string,
+ NULL);
+ return g_strdup(string);
+ }
default:
return NULL;
}
@@ -1080,6 +1095,8 @@ void e_card_simple_set (ECardSimple *simple,
field_data[field].list_type_index,
data);
break;
+ case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL:
+ break;
}
break;
}
@@ -1096,8 +1113,12 @@ ECardSimpleType e_card_simple_type (ECardSimple *simple,
case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL:
default:
return E_CARD_SIMPLE_TYPE_STRING;
+
case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
return E_CARD_SIMPLE_TYPE_DATE;
+
+ case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL:
+ return E_CARD_SIMPLE_TYPE_STRING;
}
}
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
index 7e2be4b728..2d3b1cb4f4 100644
--- a/addressbook/backend/ebook/e-card-simple.h
+++ b/addressbook/backend/ebook/e-card-simple.h
@@ -111,6 +111,7 @@ enum _ECardSimpleField {
E_CARD_SIMPLE_FIELD_ANNIVERSARY,
E_CARD_SIMPLE_FIELD_BIRTH_DATE,
E_CARD_SIMPLE_FIELD_MAILER,
+ E_CARD_SIMPLE_FIELD_NAME_OR_ORG,
E_CARD_SIMPLE_FIELD_LAST
};
diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c
index 2401677807..ee36d2ca1a 100644
--- a/addressbook/gui/component/e-addressbook-model.c
+++ b/addressbook/gui/component/e-addressbook-model.c
@@ -81,8 +81,9 @@ addressbook_value_at (ETableModel *etc, int col, int row)
{
EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc);
const char *value;
- if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count )
+ if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1 || row >= addressbook->data_count )
return NULL;
+
value = e_card_simple_get_const(addressbook->data[row],
col + 1);
return (void *)(value ? value : "");
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c
index 2e33fdfe85..0c56606c31 100644
--- a/addressbook/gui/component/select-names/e-select-names-table-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-table-model.c
@@ -12,6 +12,7 @@
#include <string.h>
#include <gtk/gtk.h>
+#include "e-util/e-util.h"
#include "e-select-names-table-model.h"
#include "addressbook/backend/ebook/e-card-simple.h"
@@ -122,14 +123,21 @@ fill_in_info (ESelectNamesTableModel *model)
case E_SELECT_NAMES_MODEL_DATA_TYPE_CARD: {
ECardSimple *simple = e_card_simple_new(data->card);
model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME);
+ if ((model->data[count].name == 0) || *model->data[count].name == 0) {
+ model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG);
+ }
+ if (model->data[count].name == 0)
+ model->data[count].name = g_strdup("");
model->data[count].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL);
+ if (model->data[count].email == 0)
+ model->data[count].email = g_strdup("");
gtk_object_unref(GTK_OBJECT(simple));
count ++;
break;
}
case E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS:
- model->data[count].name = g_strdup(data->string);
- model->data[count].email = g_strdup(data->string);
+ model->data[count].name = e_strdup_strip(data->string);
+ model->data[count].email = e_strdup_strip(data->string);
count ++;
break;
}
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 90b64b1183..75fd27d32d 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -98,16 +98,16 @@ e_select_names_class_init (ESelectNamesClass *klass)
#define SPEC "<ETableSpecification no-header=\"1\"> \
<columns-shown> \
- <column> 0 </column> \
- <column> 2 </column> \
+ <column> 2 </column> \
+ <column> 1 </column> \
</columns-shown> \
- <grouping> <leaf column=\"0\" ascending=\"1\"/> </grouping> \
+ <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \
</ETableSpecification>"
#define SPEC2 "<ETableSpecification no-header=\"1\"> \
<columns-shown> \
<column> 0 </column> \
- <column> 2 </column> \
+ <column> 1 </column> \
</columns-shown> \
<grouping> </grouping> \
</ETableSpecification>"
@@ -142,7 +142,11 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n
header = e_table_header_new ();
e_table_header_add_column (header, e_table_col_new (0, "Full Name", 1.0, 20, cell_left_just,
- g_str_compare, TRUE), 0);
+ g_str_compare, TRUE), -1);
+ e_table_header_add_column (header, e_table_col_new (1, "Email", 1.0, 20, cell_left_just,
+ g_str_compare, TRUE), -1);
+ e_table_header_add_column (header, e_table_col_new (34, "Name", 1.0, 20, cell_left_just,
+ g_str_compare, TRUE), -1);
book = e_book_new();
gtk_object_ref(GTK_OBJECT(model));
@@ -193,6 +197,8 @@ e_select_names_init (ESelectNames *e_select_names)
GNOME_STOCK_BUTTON_OK,
GNOME_STOCK_BUTTON_CANCEL,
NULL);
+
+ gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE);
e_select_names->table = E_TABLE(glade_xml_get_widget(gui, "table-source"));
e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model");
@@ -348,8 +354,10 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
model = e_select_names_table_model_new(source);
header = e_table_header_new ();
cell_left_just = e_cell_text_new (model, NULL, GTK_JUSTIFY_LEFT);
- e_table_header_add_column (header, e_table_col_new (0, "Full Name", 1.0, 20, cell_left_just,
- g_str_compare, TRUE), 0);
+ e_table_header_add_column (header, e_table_col_new (0, "Name", 1.0, 20, cell_left_just,
+ g_str_compare, TRUE), -1);
+ e_table_header_add_column (header, e_table_col_new (1, "Email", 1.0, 20, cell_left_just,
+ g_str_compare, TRUE), -1);
etable = e_table_new (header, model, SPEC2);
gtk_signal_connect(GTK_OBJECT(etable), "double_click",
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 2401677807..ee36d2ca1a 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -81,8 +81,9 @@ addressbook_value_at (ETableModel *etc, int col, int row)
{
EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc);
const char *value;
- if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count )
+ if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1 || row >= addressbook->data_count )
return NULL;
+
value = e_card_simple_get_const(addressbook->data[row],
col + 1);
return (void *)(value ? value : "");