aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-06 14:18:47 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-06 14:18:47 +0800
commit19848dbc6d5c085289af80975e53395443d41ee2 (patch)
tree051f68510fdce778cc2499af21f53f02d282e599 /addressbook
parentaf494c55837bf4d88c421ce6ce3f8378727998c7 (diff)
downloadgsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.tar.gz
gsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.tar.zst
gsoc2013-evolution-19848dbc6d5c085289af80975e53395443d41ee2.zip
Changed "FIXME: Save and Close" to "Save and Close". Removed some toolbar
2000-07-06 Christopher James Lahey <clahey@helixcode.com> * contact-editor/e-contact-editor.c: Changed "FIXME: Save and Close" to "Save and Close". Removed some toolbar items that will never be used. * gui/component/select-names/e-select-names-model.c, gui/component/select-names/e-select-names-model.h: Added functions to allow you to modify the model (not implemented yet.) * gui/component/select-names/e-select-names-table-model.c, gui/component/select-names/e-select-names-table-model.h: Finished this. Doesn't support changing the model at all. * gui/component/select-names/e-select-names-text-model.c: Finished this. Changing the model by typing is done, but doesn't work since none of the functions in the base model are implemented. svn path=/trunk/; revision=3918
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog18
-rw-r--r--addressbook/contact-editor/e-contact-editor.c8
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c50
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h26
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c229
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.h9
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c64
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c8
8 files changed, 375 insertions, 37 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index ad019beb68..87950b1cef 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,21 @@
+2000-07-06 Christopher James Lahey <clahey@helixcode.com>
+
+ * contact-editor/e-contact-editor.c: Changed "FIXME: Save and
+ Close" to "Save and Close". Removed some toolbar items that will
+ never be used.
+
+ * gui/component/select-names/e-select-names-model.c,
+ gui/component/select-names/e-select-names-model.h: Added functions
+ to allow you to modify the model (not implemented yet.)
+
+ * gui/component/select-names/e-select-names-table-model.c,
+ gui/component/select-names/e-select-names-table-model.h: Finished
+ this. Doesn't support changing the model at all.
+
+ * gui/component/select-names/e-select-names-text-model.c: Finished
+ this. Changing the model by typing is done, but doesn't work
+ since none of the functions in the base model are implemented.
+
2000-07-05 Chris Toshok <toshok@helixcode.com>
* gui/component/addressbook.c (new_server_cb): call
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index cedd798edf..6c28351c32 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -772,7 +772,7 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data)
/* Toolbar */
static GnomeUIInfo toolbar[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"),
+ GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"),
N_("Save the appointment and close the dialog box"),
tb_save_and_close_cb,
GNOME_STOCK_PIXMAP_SAVE),
@@ -782,12 +782,6 @@ static GnomeUIInfo toolbar[] = {
GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."),
N_("Insert a file as an attachment"), NULL),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_NONE (N_("FIXME: Recurrence..."),
- N_("Configure recurrence rules"), NULL),
- GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_NONE (N_("FIXME: Invite Attendees..."),
- N_("Invite attendees to a meeting"), NULL),
- GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("FIXME: Delete"),
N_("Delete this item"), NULL),
GNOMEUIINFO_SEPARATOR,
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index 8399136dd8..f819a1197e 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -198,3 +198,53 @@ EList *e_select_names_model_get_data (ESelect
{
return model->data;
}
+
+void
+e_select_names_model_insert (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ char *data)
+{
+}
+
+void
+e_select_names_model_insert_length (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ char *data,
+ int length)
+{
+}
+
+void
+e_select_names_model_delete (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ int length)
+{
+}
+
+void
+e_select_names_model_replace (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ int replacement_length,
+ char *data)
+{
+}
+
+
+void
+e_select_names_model_add_item (ESelectNamesModel *model,
+ EIterator *iterator, /* NULL for at the beginning. */
+ ESelectNamesModelData *data)
+{
+}
+
+void
+e_select_names_model_remove_item (ESelectNamesModel *model,
+ EIterator *iterator)
+{
+}
+
+
diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h
index 20c90818f7..313b4dee25 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-model.h
@@ -55,6 +55,32 @@ struct _ESelectNamesModelClass {
ESelectNamesModel *e_select_names_model_new (void);
+/* These lengths are allowed to go over objects and act just like the text model does. */
+void e_select_names_model_insert (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ char *data);
+void e_select_names_model_insert_length (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ char *data,
+ int length);
+void e_select_names_model_delete (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ int length);
+void e_select_names_model_replace (ESelectNamesModel *model,
+ EIterator *iterator, /* Must be one of the iterators in the model. */
+ int index,
+ int replacement_length,
+ char *data);
+
+void e_select_names_model_add_item (ESelectNamesModel *model,
+ EIterator *iterator, /* NULL for at the beginning. */
+ ESelectNamesModelData *data);
+void e_select_names_model_remove_item (ESelectNamesModel *model,
+ EIterator *iterator);
+
/* Of type ECard */
EList *e_select_names_model_get_cards (ESelectNamesModel *model);
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 dc3edda5f9..7f4d916435 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
@@ -13,6 +13,7 @@
#include <gtk/gtk.h>
#include "e-select-names-table-model.h"
+#include "addressbook/backend/ebook/e-card-simple.h"
/* Object argument IDs */
enum {
@@ -27,6 +28,33 @@ static void e_select_names_table_model_destroy (GtkObject *object);
static void e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_select_names_table_model_model_changed (ESelectNamesModel *source,
+ ESelectNamesTableModel *model);
+
+
+static void
+e_select_names_table_model_add_source (ESelectNamesTableModel *model,
+ ESelectNamesModel *source)
+{
+ model->source = source;
+ if (model->source)
+ gtk_object_ref(GTK_OBJECT(model->source));
+ model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed",
+ GTK_SIGNAL_FUNC(e_select_names_table_model_model_changed),
+ model);
+}
+
+static void
+e_select_names_table_model_drop_source (ESelectNamesTableModel *model)
+{
+ if (model->source_changed_id)
+ gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id);
+ if (model->source)
+ gtk_object_unref(GTK_OBJECT(model->source));
+ model->source = NULL;
+ model->source_changed_id = 0;
+}
+
/**
* e_select_names_table_model_get_type:
* @void:
@@ -76,20 +104,57 @@ e_select_names_table_model_new (ESelectNamesModel *source)
}
static void
-e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass)
+fill_in_info (ESelectNamesTableModel *model)
{
- GtkObjectClass *object_class;
- ETableModelClass *table_model_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- table_model_class = E_TABLE_MODEL_CLASS(klass);
-
- gtk_object_add_arg_type ("ESelectNamesTableModel::source",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE);
+ if (model->source) {
+ EList *list = e_select_names_model_get_data(model->source);
+ EIterator *iterator = e_list_get_iterator(list);
+ int count = 0;
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ const ESelectNamesModelData *data = e_iterator_get(iterator);
+ if (data->type != E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL) {
+ count ++;
+ }
+ }
+ model->count = count;
+ model->data = g_new(ESelectNamesTableModelData, count);
+ count = 0;
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ const ESelectNamesModelData *data = e_iterator_get(iterator);
+ switch (data->type) {
+ 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);
+ model->data[count].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL);
+ 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);
+ count ++;
+ break;
+ case E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL:
+ break;
+ }
+ }
+ } else {
+ model->count = 0;
+ }
+}
- object_class->destroy = e_select_names_table_model_destroy;
- object_class->get_arg = e_select_names_table_model_get_arg;
- object_class->set_arg = e_select_names_table_model_set_arg;
+static void
+clear_info (ESelectNamesTableModel *model)
+{
+ int i;
+ for (i = 0; i < model->count; i++) {
+ g_free(model->data[i].name);
+ g_free(model->data[i].email);
+ }
+ g_free(model->data);
+ model->data = NULL;
+ model->count = -1;
}
/*
@@ -103,10 +168,107 @@ e_select_names_table_model_destroy (GtkObject *object)
model = E_SELECT_NAMES_TABLE_MODEL (object);
- if (model->source)
- gtk_object_unref(GTK_OBJECT(model->source));
+ e_select_names_table_model_drop_source (model);
+ clear_info(model);
+}
+
+/* This function returns the number of columns in our ETableModel. */
+static int
+e_select_names_table_model_col_count (ETableModel *etc)
+{
+ return 2;
+}
+
+/* This function returns the number of rows in our ETableModel. */
+static int
+e_select_names_table_model_row_count (ETableModel *etc)
+{
+ ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc);
+ if (e_select_names_table_model->count == -1) {
+ if (e_select_names_table_model->source) {
+ fill_in_info(e_select_names_table_model);
+ } else {
+ return 0;
+ }
+ }
+ return e_select_names_table_model->count;
+}
+
+/* This function returns the value at a particular point in our ETableModel. */
+static void *
+e_select_names_table_model_value_at (ETableModel *etc, int col, int row)
+{
+ ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc);
+ if (e_select_names_table_model->data == NULL) {
+ }
+ switch (col) {
+ case 0:
+ if (e_select_names_table_model->data[row].name == NULL) {
+ fill_in_info(e_select_names_table_model);
+ }
+ return e_select_names_table_model->data[row].name;
+ break;
+ case 1:
+ if (e_select_names_table_model->data[row].email == NULL) {
+ fill_in_info(e_select_names_table_model);
+ }
+ return e_select_names_table_model->data[row].email;
+ break;
+ }
+ return "";
+}
+
+/* This function sets the value at a particular point in our ETableModel. */
+static void
+e_select_names_table_model_set_value_at (ETableModel *etc, int col, int row, const void *val)
+{
+}
+
+/* This function returns whether a particular cell is editable. */
+static gboolean
+e_select_names_table_model_is_cell_editable (ETableModel *etc, int col, int row)
+{
+ return FALSE;
+}
+
+/* This function duplicates the value passed to it. */
+static void *
+e_select_names_table_model_duplicate_value (ETableModel *etc, int col, const void *value)
+{
+ return g_strdup(value);
+}
+
+/* This function frees the value passed to it. */
+static void
+e_select_names_table_model_free_value (ETableModel *etc, int col, void *value)
+{
+ g_free(value);
+}
+
+static void *
+e_select_names_table_model_initialize_value (ETableModel *etc, int col)
+{
+ return g_strdup("");
+}
+
+static gboolean
+e_select_names_table_model_value_is_empty (ETableModel *etc, int col, const void *value)
+{
+ return !(value && *(char *)value);
+}
+
+static char *
+e_select_names_table_model_value_to_string (ETableModel *etc, int col, const void *value)
+{
+ return g_strdup(value);
}
+static void
+e_select_names_table_model_model_changed (ESelectNamesModel *source,
+ ESelectNamesTableModel *model)
+{
+ clear_info(model);
+}
/* Set_arg handler for the model */
static void
@@ -118,11 +280,8 @@ e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id
switch (arg_id) {
case ARG_SOURCE:
- if (model->source)
- gtk_object_unref(GTK_OBJECT(model->source));
- model->source = E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT(*arg));
- if (model->source)
- gtk_object_ref(GTK_OBJECT(model->source));
+ e_select_names_table_model_drop_source (model);
+ e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT (*arg)));
break;
default:
return;
@@ -154,4 +313,36 @@ static void
e_select_names_table_model_init (ESelectNamesTableModel *model)
{
model->source = NULL;
+ model->source_changed_id = 0;
+
+ model->count = -1;
+ model->data = NULL;
+}
+
+static void
+e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass)
+{
+ GtkObjectClass *object_class;
+ ETableModelClass *table_model_class;
+
+ object_class = GTK_OBJECT_CLASS(klass);
+ table_model_class = E_TABLE_MODEL_CLASS(klass);
+
+ gtk_object_add_arg_type ("ESelectNamesTableModel::source",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE);
+
+ object_class->destroy = e_select_names_table_model_destroy;
+ object_class->get_arg = e_select_names_table_model_get_arg;
+ object_class->set_arg = e_select_names_table_model_set_arg;
+
+ table_model_class->column_count = e_select_names_table_model_col_count;
+ table_model_class->row_count = e_select_names_table_model_row_count;
+ table_model_class->value_at = e_select_names_table_model_value_at;
+ table_model_class->set_value_at = e_select_names_table_model_set_value_at;
+ table_model_class->is_cell_editable = e_select_names_table_model_is_cell_editable;
+ table_model_class->duplicate_value = e_select_names_table_model_duplicate_value;
+ table_model_class->free_value = e_select_names_table_model_free_value;
+ table_model_class->initialize_value = e_select_names_table_model_initialize_value;
+ table_model_class->value_is_empty = e_select_names_table_model_value_is_empty;
+ table_model_class->value_to_string = e_select_names_table_model_value_to_string;
}
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.h b/addressbook/gui/component/select-names/e-select-names-table-model.h
index 94cbaff13a..9afc3f7a12 100644
--- a/addressbook/gui/component/select-names/e-select-names-table-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-table-model.h
@@ -21,6 +21,11 @@
#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL))
#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL))
+typedef struct {
+ char *name;
+ char *email;
+} ESelectNamesTableModelData;
+
typedef struct _ESelectNamesTableModel ESelectNamesTableModel;
typedef struct _ESelectNamesTableModelClass ESelectNamesTableModelClass;
@@ -28,6 +33,10 @@ struct _ESelectNamesTableModel {
ETableModel parent;
ESelectNamesModel *source;
+ int source_changed_id;
+
+ int count;
+ ESelectNamesTableModelData *data; /* This is used as an array. */
};
struct _ESelectNamesTableModelClass {
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c
index db273796f3..abbbae3321 100644
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-text-model.c
@@ -33,7 +33,7 @@ static void e_select_names_text_model_insert_length (ETextModel *model, gint po
static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length);
static void e_select_names_text_model_model_changed (ESelectNamesModel *source,
- ESelectNamesTextModel *model);
+ ESelectNamesTextModel *model);
ETextModelClass *parent_class;
@@ -111,27 +111,83 @@ e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass)
text_model_class->delete = e_select_names_text_model_delete;
}
+static int
+get_length(EIterator *iterator)
+{
+ const ESelectNamesModelData *data = e_iterator_get(iterator);
+ return strlen(data->string);
+}
+
static void
e_select_names_text_model_set_text (ETextModel *model, gchar *text)
{
-#if 0
- e_select_names_model_clear(model);
-#endif
+ ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source;
+ EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source));
+
+ e_iterator_reset(iterator);
+ e_select_names_model_replace(source,
+ iterator,
+ 0,
+ strlen(model->text),
+ text);
}
static void
e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text)
{
+ ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source;
+ EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source));
+
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ int this_length = get_length(iterator);
+ if (position <= this_length) {
+ e_select_names_model_insert(source,
+ iterator,
+ position,
+ text);
+ } else {
+ position -= this_length;
+ }
+ }
}
static void
e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length)
{
+ ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source;
+ EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source));
+
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ int this_length = get_length(iterator);
+ if (position <= this_length) {
+ e_select_names_model_insert_length(source,
+ iterator,
+ position,
+ text,
+ length);
+ } else {
+ position -= this_length;
+ }
+ }
}
static void
e_select_names_text_model_delete (ETextModel *model, gint position, gint length)
{
+ ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source;
+ EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source));
+
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ int this_length = get_length(iterator);
+ if (position <= this_length) {
+ e_select_names_model_delete(source,
+ iterator,
+ position,
+ length);
+ } else {
+ position -= this_length;
+ }
+ }
}
static void
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index cedd798edf..6c28351c32 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -772,7 +772,7 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data)
/* Toolbar */
static GnomeUIInfo toolbar[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"),
+ GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"),
N_("Save the appointment and close the dialog box"),
tb_save_and_close_cb,
GNOME_STOCK_PIXMAP_SAVE),
@@ -782,12 +782,6 @@ static GnomeUIInfo toolbar[] = {
GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."),
N_("Insert a file as an attachment"), NULL),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_NONE (N_("FIXME: Recurrence..."),
- N_("Configure recurrence rules"), NULL),
- GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_NONE (N_("FIXME: Invite Attendees..."),
- N_("Invite attendees to a meeting"), NULL),
- GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_NONE (N_("FIXME: Delete"),
N_("Delete this item"), NULL),
GNOMEUIINFO_SEPARATOR,